I finished one of my first Arduino projects last night. It isn’t terribly exciting to watch, but it employs a number of things that will be invaluable in future projects. Basically it cycles a large, seven-segment LED display through the numbers 0-9. Yes, any digital clock can do that, but that wasn’t the point.
The first obstacle when driving large LEDs or motors from the Arduino is power. The Arduino outputs are only 5 volts at a maximum of 40 milliamps. While this is fine for driving single, small LEDs, it is not enough for larger loads. To overcome this, it is common to use a transistor as a switch — using a small current from the microcontroller to turn on a larger current. Since I have several devices to control all at once, up to eight displays with seven segments each, I used a couple of integrated circuits which contain a number of transistors in a small, convenient, inexpensive package.
For this project, I used a UDN2982A for the anodes and a ULN2003A for the cathodes. The LED displays are common-anode, so I really only needed one of the eight available channels on the 2982 and could have used a single transistor instead. Also, since I only have one display, I could have omitted the transistor on the anode completely by wiring the common anode directly to my 12V source. However, since this is simply a proof-of-concept for a larger project, I used transistor arrays on both ends. The larger project will include up to eight displays, so I will need to control both the anodes and cathodes for multiplexing purposes.
Here is a photograph and a schematic. This was my first time to use TinyCAD as well, so please excuse my drawing skills.
The video is on YouTube: Arduino – Seven-Segment LED Display Test
Finally, here is the source code: SevenSegTest.pde