(yes)
Approach
We'll lay out and solder our LED marquee on cardboard, and build some dividers to separate pixels, and print a little screen on top to diffuse the light.
We will use a "Charlieplexing" layout to control many LEDs using only a few pins. This can be a difficult to lay out by hand. Thankfully, there is a trick: if we're willing to tilt the grid diagonally, we can use a pattern that is easy to layout and assemble. The code to drive the display gets a bit confusing, but one can always manually map the LED locations one-by-one, if push comes to shove.
Past project links
- A 5x22 LED using Charlieplexing and an AtTiny; We'll build a 'papercraft' version of this here
- The Charlieplexing layout lets us use LOTS of LEDs on only a few Arduino pins (n∙(n-1) lights for n pins)
- There is a diagonal version of Charlieplexing that is easier to use with hand-crafting
Step 0: Gather materials
I recommend bright LEDs, since the paper diffuser blocks some light. "Super bright" LEDs inside a clear packaging should work. "Hat top" wide-angle LEDs are nice because they cast light in all directions, making it easier to get a good display even if all the LEDs aren't quite aligned.
Other materials include a soldering kit and wire snips, as well as paper crafting supplies: scissors, tape, paper, scrap cardboard, and a hobby knife. We'll also use a pin to punch holes in the cardboard for the LEDs. Oh! and an Arduino, jumper wires, and current limiting resistors as well, of course.
- LEDs (110 in this build), scrap wire, current-limiting resistors, and an Arduino
- Soldering station, wire snips, low-temperature solder
- Paper crafting tools: scissors, tape, x-acto knife, push pin
- Scrap cardboard, paper, pen, printer
Step 1: Prepare circuit (card)board
First, we'll need to design our layout. We'll use a diagonal version of charlieplexing, to simplify soldering. Design files for this project are on github. I used this template.For "diagonal multiplexing", we'll have the cathodes on the front of the board, zigzagging diagonally, and the anodes on the reverse, zigzagging the other way. The lines wrap around at the edges. This can be a bit confusing at first, so reading through the blog post and working through some layouts by hands might be helpful!
For the cardboard, we want something stiff but not to thick. Cereal boxes are perfect. Tape the template to cardboard, or draw the pattern by hand. Use a thumb-tack or push-pin to poke one hole in the cardboard for each LED (just one hole as we'll wire up the other pins on the front).
After punching holes for the LED leads, trace the circuit on the reverse, for reference when soldering.
Step 2: Solder LEDs
I wired up the anodes (positive, +, usually the long wire) on the reverse, and the cathodes (negative, -, usually near the flat edge of the LED) in the front. It doesn't matter whether the anodes or cathodes are on the front/back, but it does matter that all LEDs go the same way. Be careful not to switch any!Without a rigid PCB, the LEDs get a bit wobbly, which makes soldering tricky. I soldered the LEDs one row at a time, soldering both the front and the back of the board, so that the previously-soldered LEDs are held stiffly in place.
Try to minimize mechanical stress and overheating, as this can damage
LEDs. A temperature-controlled soldering station and low-temperature
solder may help.
Step 3: Test circuit
After step 2, you may want to pause and test that all LEDs are working well. If your following this example, you should have 11 control lines controlling a 5x22 LED matrix.You'll need to write some code to scan the LEDs. Scanning them one at a time (at first) is useful. When testing, use current limiting resistors, and calculate the resistance correctly for the color of LEDs you used. To be conservative, I used 330Ω resistors. It is very sad to burn out all your LEDs after spending all that time soldering them. This online resistor calculator is handy.
To get a brighter display, you might want to consider row-column driving, rather than lighting the LEDs one at a time. This is a bit out-of-spec in a charlieplexing setup, since each pin on the Arduino is only technically supposed to source or sink 40mA of current. So far, I haven't had any issues with it.
Once everything is working well, you can consider lowering the current resistors to match the peak current of the LEDs. Most LEDs can handle extra current briefly. If you're scanning a multiplexed display rapidly, LEDs will be on only a fraction of the time. Lowering the current limiting resistor increases the power, and the brightness, of the display. Still, take care not burn out the display!
Step 4: Build case
We need to build a case for the LED matrix, to help confine and diffuse the light, and give everything a polished look (or as polished as can be, for a paper marquee).To divide the light between LEDs, I cut thin strips of cardboard. These should be only slightly taller than the LEDs themselves, to avoid absorbing excess light. These strips then supported a paper overlay, which helps diffuse the light and blacks out any regions except for the "pixels".
The paper dividers leak light, and the paper overlay absorbs too much, so things are dimmer and fuzzier than on a proper LED marquee, but it looks ok in indoor lighting.
Step 5: Software
Now that we have our "papercraft" LED marquee, we can play around with programming it. I enjoyed designing various bitmap fonts, and hooking up to the serial port on a computer to print outputs from the terminal.This display is a bit tricky to code for, owing to the unusual LED layout. If all else fails, you can store the anode/cathode pins for each light in a look-up-table. To start, try lighting up the LEDs one at a time. Once this is working well, you may want to try row-column scanning.
In charlieplexing, we use the same pins to source and sink current. Arduino pins are limited to 40mA, enough for 4-5 LEDs. In practice, you can drive more, but they will dim slightly. This is out of spec for the Atmega*8 chips, but I've never had an issue. One benefit of the unusual layout, which is a bit scrambled, is that it's somewhat rare to need more than 4-5 LEDs on each driving line, for scrolling text.
To get a smooth and bright display, you might want to write groups of pins directly by writing to the PORT and DDR registers. To make this even faster, its worth storing the required PORT/DDR register states directly, and using a small timer interrupt routine to rotate through the configurations for each scan-line of the display. For best results, you may need to turn off internal pull-up resistors, since these can source enough current to dimly light LEDs.
If you end up with dead LEDs, you may need to mask them in your driving software so that they do not turn on. In a charlieplexed grid, a dead LED can force current through the other LEDs, leading to artifacts.
I eventually affixed an Arduino pro mini for a more stand-alone solution. At the moment, I've hooked it up to battery power and set it to scroll some poetry.
No comments:
Post a Comment