Electronics > Microcontrollers
Need Advise on Driving an LED Display
TheRuler8510:
Using an ATMega, I'm trying to run a 4-digit, 7 segment LED display. The issue how to interface MCU to LED. If my main objective is low BOM cost, what is the best path to choose?
The I2C driver chips are expensive ($10), so I was thinking a cheap alternative would be to use a cheap 8-bit shift register with open drain outputs, and use four 2N2222 to multiplex the 4 digits. I was thinking I have to write my own interface library to talk to the shift register, meaning constructing my own clock and data signals, etc.
Am I off in the weeds, or is there a better way? The SPI libraries seem too complex for this simple job.
Thanks in advance.
uwezi:
If the number of used pins is not a concern than you could wire up the segments to a port pin each (7 + an optional dot) and then use another 4 pins which drive the digits using transistors. You write about 2N2222 so I assume that your display comes with common cathodes.
Otherwise you would need to shift the bits with a clock signal and an additional latch-signal (3 port pins) - using e.g. an 74xx595 you should find plenty of code examples on the net...
uwezi:
Stretching the specs of the ATmega slightly you can even leave out the transistors, but you should include current-limiting resistors in series with each segment. This is something which I ask my students to do in the third practical lab exercise - see the attached schematics.
TheRuler8510:
--- Quote from: uwezi on March 01, 2014, 09:47:42 pm ---If the number of used pins is not a concern than you could wire up the segments to a port pin each (7 + an optional dot) and then use another 4 pins which drive the digits using transistors. You write about 2N2222 so I assume that your display comes with common cathodes.
--- End quote ---
Ah-Ha...Excellent! It seems so simple, but I did not think of driving direct with MCU. I could not see the forest 'for the trees.
The display has common cathodes. Anyhow the ATMega328 has plenty of pins for this.
Thanks and Regards,
dannyf:
--- Quote ---The issue how to interface MCU to LED.
--- End quote ---
The trade-off is between the number of pins needed and complexity.
The simplest would be using a driver (7219 for example). It is expensive and requires 5v drive. But needs just a few pins from the mcu.
The next would be some sorts of shift registers, hc164 or hc595 (slightly better). either 1 shift register + 8 pins or 2 shift registers (2 - 3 pins). More complex to drive.
The most complex is to use all pins and no other parts. It takes up lots of pins and you have to drive it via interrupt to be flicker free. The least expensive but most complex (and maybe simplest at the same time) solution.
Navigation
[0] Message Index
[#] Next page
Go to full version