I've seen some pretty nifty edge-lit DIY projects. From the Death Star, to the USS Enterprise, to fun sayings or name tags, there are lots of examples.
A few months ago I got the idea to make some for some friends. Laser cutting various pieces of acrylic would be the easy part. The hard part was a base that non-techies could use and control with ease. I wanted several features, but didn't want to have to solder together five different boards for each one, so I ended up designing my own board, doing the assembly, 3D-printing enclosures and more.
Edge lighting is a fairly basic idea. When you shine an LED through a clear substance like a piece of glass or acrylic, it just goes straight through, but if you give it something to reflect off, such as a rough surface, it will refract the light, making that area visible. When you intentionally rough up or engrave a specific pattern it will light up, making a nice sign.
Quiz time: what is the most common edge-lit display you see on a daily basis? I haven't checked any official sources for this, but seeing as this is something I see daily and you probably do too, this is the answer I'm looking for. Winner gets to have a smug look all day for correctly answering a random online question.
A few of the features I wanted were:
- Powered over USB - I could have gotten a different power supply, but USB is so universal and cheap now that I wouldn't have to worry about spending more money on power supplies they would lose or have to remember which to use. Because the enclosure would be decent sized, I chose a full-size USB B port for its durability as a power jack (I did end up putting two footprints there if I change my mind).
- Capable of being programmed over USB - While I don't expect friends or family to program them, if I make a new piece of acrylic that I want a new fancy light display for, I want to just have them bring the device, plug in a USB cable, hit upload and be done.
- Be capable of running FastLED - This library does all the work for lots of different LED strips. I could use whatever strip I had lying around, just change one or two lines in the code and be done. The code actually has lines for the most popular options that are commented out. All I have to do is make sure the right one is uncommented and hit upload.
- Have a power button and a mode button - This allows them to change modes, which will most likely just be different colors and possibly a pattern such as rainbow or Cylon.
- Entirely enclosed - Some people (like engineers) like to see their electronics; most don't.
- Battery powered - I wanted the option to add a battery to this. That would allow the user to show off their new toy for a while before plugging it back in.
I chose the SamD21 chip as a nice powerhouse that can be programmed over USB and can handle the FastLED library. While it has more pins than I needed, I chose to break out a bunch of them anyway.
The board has two ports on the end that can take screw terminals (or just solder wires in). One port has power, ground and an I/O pin; the other port has power, ground and two I/O pins. This allows me to use one for WS2812s or other LED strips that only have one data line, and the other for APA102s or other LED strips that have a data line and a clock line.
I also broke out a couple of other ports with different I/O pins just in case, as well as a place for three different buttons. I spent some time digging into the graphical datasheet to determine which pins to use. There are a combination of SPI/I2C/digital and analog pins broken out. I also added a voltage regulator and battery charger with a JST connector.
Then I had to figure out power. Most LEDs are rated for 5V power (and data), but the SamD21 runs at 3.3V. After asking around, it sounds like while out of spec the APA102s will communicate fine at 3.3V, but they need closer to 5V to power them. I ended up running Vin to my ports, which is either directly from the battery or the USB port. Vin also goes to the voltage regulator to give the SamD21 3.3V, which it will use to talk to the APA102s (or WS2812).
Then there were the non-electronics parts. I dug around in a bin of buttons and switches, found some that would work and set about designing an enclosure.
The current one fits the board snugly. Almost too snugly. If I had to redo the whole design I'd make the board as narrow as possible. One-and-a-half inches doesn't sound like much, but once you add a quarter-inch on each side and add some height, the enclosure size is pretty decent. That's OK, it still has to hold up the acrylic, and hold a power switch, USB jack and button for the mode.
The next step is 3D-printing some enclosures, and laser printing some test acrylic. After some testing, I decided to add a small slot to the lid to slide the LED strip in (Scotch tape works very poorly to hold the LED strip to the lid). I ended up printing a separate piece and using 'ABS glue' (acetone and ABS) to connect it to the lid. While it is a bit hard to explain, you can see the small trough in the image below; it gets attached to the bottom of the lid, allowing the LED strip to slide in between it and the lid.
The next step was ordering parts. I got some PCBs on one of our QC test panels, since they had some extra room, and ordered a stencil. Time to build these up. As someone who never worked in PCB assembly I was a bit nervous, but things worked out pretty well (keep in mind trying to find 0402 components can be tricky). I got a couple of boards stenciled, hand-populated and reflowed with a hot air rework station (I was afraid of all my components blowing off if I walked them downstairs to the oven). After a quick test it was go time.
Once it was time to program I realized that my SamD21 wasn't getting any power. I had designed the board to connect Vin to either the battery or the USB port, but without a switch, it wasn't connected to either. This meant I had to add in my panel mount On/Off/On power switch to program the board. Once that was done I grabbed an Atmel ICE and got the bootloader up and running and was able to test my code. The code is fairly basic - a button connected to an interrupt changes the mode. The code runs through a switch statement and does something different for each mode.
After some troubleshooting and learning new skills I had a working project. I can cut new pieces of acrylic and just drop them in, and I can build more using the same board and same basic code using whatever LED strips I can find. I can switch between quite a few modes with the push of a button, and it doesn't look to the user like a bunch of wires and PCBs. I might choose to update the board and code to use Circuit Python and make it even more user friendly (might be nice for a master brightness control) now that we have that functionality on our SamD21 boards. Let me know what you think.
comments | comment feed