An early test result, showing text and millseconds since power-on.
About a year ago, I bought a few 11 digit, 7 segment red LED displays from Active Surplus up on Queen Street in Toronto. (Excellent store. If you're into hacking stuff at all, it's well worth the trip. Look for the monkey on Queen street to find their entrance.)
This past week, I wasn't sure what to do at Interlock on Tuesday night, but I had recently re-found these displays, so I figured I would finally get them working. I hit Radio Shack to get a Seeed Studio Arduino Shield ($10 with a mess of components, probably the best deal in all of Radio Shack.)
The display with a header soldered on, and the shield with its assorted parts.
I was all set to figure out how to reverse-engineer the pinout on the bottom of the display; I googled for the LED module, and found specs on those, and then on a whim, decided to check on the entire module board, a Rohm LU-3011, and found the jackpot, this post about figuring out the pinout. It suddenly became very easy to do this project.
The two key things gleaned from that above post, which I have mirrored here, are this table of enables for each of the 11 digits:
Digit | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
Pin | 1 | 2 | 3 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 |
Mapping of the segments to the pins on the header.
The basic way these displays work is that all of the 7 segments (plus one decimal point) are all tied together to the pins specified above. Then the anodes for each of the displays are broken out to the pins in the table above. So to draw a '7', you would set all of the segments to LOW, except for pins 11, 19, and 7 which you set HIGH. Then to turn on a specific digit, let's say digit 11 (rightmost), you set the digit enable pin 18 to be an output, and set it LOW. Set all of the other digit enables to be inputs (tri-state, not low or high), and only position 11 will show a "7". You repeat this for all of the 11 digits in the display, and you can display 11 full digits from just those 19 pins.
In my code (available below) I start at digit 1, and work down to digit 11, enabling each one, in turn, showing its segments, waiting 1 millisecond, then disable that digit, move on to the next one. Because of this quick display time, and to preserve brightness, I did not put any current limiting resistors in the mix. Perhaps this was a bad idea, but it works great for now. ;)
I soldered a pin header on the display, and built up a shield to plug it into.
All of the digit enables wired up. The top ones are a bit messy. Sorry about that.
I wired it up such that the digit enables and segments are wired directly to IO lines on my Arduino. This used all of the IO lines, minus the D13 pin, which has an on-board LED.
The code that I wrote (available below) lets you do arbitrary digits per character, so that i can do (primitive) alphanumerics, or do animation patterns, etc. I also store the decimal point as a separate character going in to the display code, so "3.141" is five ascii characters going in, but a flag is set on the '3' position saying that this digit should also display its decimal point, so it only consumes four digits in the display.
just testing out all of the segments and digits
For now, it displays a nice clock and some animations on my desk, but I plan on changing it around a little in the near future. I want to use the D13 line as one of the segment enables (probably decimal point) and move the segment enables off of the Serial Receive line. That way i will be able to control it via serial to display patterns, animations or text content. Since the hardware serial port is hardwired to 0 and 1, and I will be using the TX line for the LED displays, I'll have to instead use the Software Serial, with only its Receive line mapped to an IO pin, and its Transmit line mapped to junk. I've done this before and it works well.
The code for this project is available in my Geodesic Sphere github repository.
This project was constructed and started at the Interlock Rochester hackerspace.
No comments:
Post a Comment