Can we connect 4 4-digit 7 segment LED Displays to a single Arduino board ? Is it possible without another component in between ?
-
1There is an awfull lot to find about this on the internet... I suggest you check it out first. Try searching for IO extenders, shift registers etc. You'll find a lot of theory explained in led cube tutorials also. As @victor said, you're going to need a lot of pins if you don't use another component. So you'll be better off using external components.– PaulOct 21, 2015 at 17:48
2 Answers
Actually, this is dependent on the datasheet. Assuming it's 7 segment + dot, it will require 8 independent pins to control each of the segment. All of segments are connected to a common anode/cathode which can be connected to a pullup/pulldown.
If we have 4 digit, that means we need 4*8=32 pins, which is a lot for any microcontroller. However, if you map out the internal circuit, you'll find that the segments are multiplexed. (You can do this by touching the pins with a wire connected to a pullup resistor, and another wire connected to ground.
Generally, you'll find that all the segment pins are multiplexed together in such a way that if all anodes/cathodes are enabled, all of the digits show the same display.
So how then can we make use of this information? Here's an idea:
How about turning on each of the digits one at a time (by controlling the common anode/cathode), but doing it quickly?
An example sequence would be as follows: Set the segments for digit 1, enable the corresponding common anode/cathode for 5ms. Turn off. Set the segments for digit 2, enable the corresponding common anode/cathode for 5ms. Turn off. Do the same for digit 3 and then 4. Repeat.
Controlling in this manner means you only need 8+4 pins=12 which is available on an arduino uno. Refreshing at 4*5=20ms will hardly be visible to our human perception, thanks to persistence of vision.
My answer is really just a starting point. If you spend some time, you can try to put in other smarts which are suited for your application, using even less pins. You should try this as an exercise. ;-)
Edit: As a precaution, it's important to limit the current running through each of the LED segments so that they can live a long and happy life.
Assuming a forward voltage of 2V, adding a 1k resistor at the common anode limits the current to 3mA. This means adding resistors for all 4 anodes.
The same could work for common cathode displays, as long as the reverse breakdown voltage is not exceeded.
As with all things you find on the net, don't take my word for it. You should do the maths to check.
You need 4*4+7 = 23 pins in common cathode configuration or 4 +7*4 = 32 in common anode and arduino uno only have 20 output/input pins so if you don't want to use any external component you are going to need an Arduino mega.
Anyway, the best idea is to use a max7219 matrix led driver. look for it in google.
-
You could charlie-plex it.. that would dramatically reduce pins but would require more components than just the displays and arduino. Oct 21, 2015 at 23:55