7-segment LED display using Arduino

In summary, the speakers discuss different methods of creating an LED display with 3 digits and 21 LEDs, using an Arduino and addressing issues such as flickering and eye sensitivity. Some suggestions include using digital pins to cycle through the displays quickly, pulsing the display at a frequency above 100Hz, and using a serial-in parallel-out register like 74HC595.
  • #1
Curl
758
0
I want to make an LED display that can show 3 digits, so I have 7 segments for each digit for a total of 7x3=21 LEDs. I need this to display some data from a sensor I'm capturing with an Arduino, and I want to use the same Arduino to run the display.

How can I do this without flickering the LEDs? The only way I could think of is to use 7 digital pins to display the digits 1 by 1 and just cycle through them very quickly. The problem is that this means the LEDs are off 2/3 of the time, and also they have to flicker which can't be good for the LEDs and the eyes (I'm speculating).

Maybe there is some trick you can do, but I'm not familiar with electronics and I've thought about this for 4 days doing all sorts of designs with transistors and the bottom line is that I can't do it, it's like the hardest riddle ever.

Any ideas?
 
Engineering news on Phys.org
  • #2
A crude way would be to use latches to hold each LED on or off until you visit it next. Not good for large displays, perhaps, but for only 21 LEDs it would be a possibility.
 
  • #3
Curl said:
I want to make an LED display that can show 3 digits, so I have 7 segments for each digit for a total of 7x3=21 LEDs. [...] The only way I could think of is to use 7 digital pins to display the digits 1 by 1 and just cycle through them very quickly. The problem is that this means the LEDs are off 2/3 of the time, and also they have to flicker which can't be good for the LEDs and the eyes (I'm speculating).
What problem? Google suggests that the normal way to do this is by multiplexing groups of LEDs tied together in common anode/cathode configurations. You'll need 10 pins on your uC.

Lab11_Circuit_SevenSegmentMultiplexing-550x345.jpg


Source: http://embedded-lab.com/blog/?p=2086
 
  • #4
At night in your room try moving your eyes about as if you were following a fast moving bug

your eyes will likely pick up the flicker of your LED alarm clock digits.
The eye normally can't see the flicker, it's too fast. But when the eye is moving it can see the flicker as a series of flashes.

Same thing applies when driving in traffic at night, you'll see taillights on new cars flicker when your eye scans around the roadway.

So let Mother Nature help you out. That's what gnurf's link is telling you - everybody's doing it.
 
  • #5
pulsing the display is how all led displays work, and how led brightness is controlled. Your eye integrates the pulsed light. Anything above 100Hz will be undetectable by most people. Note that the night adapted periphery of your vision is the most sensitive to flicker. Say you choose 100Hz, then you need to switch at 300Hz for each display to be 100Hz. The eye also is pretty linear in that you need 3 times the current if you are on for 1/3 the time.
 
  • #6
meBigGuy said:
pulsing the display is how all led displays work, and how led brightness is controlled. Your eye integrates the pulsed light. Anything above 100Hz will be undetectable by most people. Note that the night adapted periphery of your vision is the most sensitive to flicker. Say you choose 100Hz, then you need to switch at 300Hz for each display to be 100Hz. The eye also is pretty linear in that you need 3 times the current if you are on for 1/3 the time.

Why would that be? Servicing three displays would only mean that the duty cycle of each would be 1/3 as long as if just one display was being supplied. So they would each be pulsed at 100Hz.
 
  • #7
An idea worth considering perhaps is using an 8-bit serial-In parallel-out register like 74HC595 for example (sophiecentaur suggested something similar if I am not mistaken). You will only need three pins on your arduino: data, clock and a signal to transfer the data you shifted into the register to the output pins which you wire to your display. The 74HC595 also has a serial out option so you can wire three of them in series and then shift in 24 bits. The 8 ones you shift in first will end up in the last HC595 in series, second 8 bits in the middle one and the last 8 bits in the first one. You then wire a 7 segment LED display to each of the shift registers and voila.

Every time you will want to update any of the displays you will have to update all of them, but the other two will again receive the same data. Not a problem.

Datasheet for 74HC595: http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

Cheers!
 
  • #8
NEUR said:
An idea worth considering perhaps is using an 8-bit serial-In parallel-out register like 74HC595 for example (sophiecentaur suggested something similar if I am not mistaken). You will only need three pins on your arduino: data, clock and a signal to transfer the data you shifted into the register to the output pins which you wire to your display. The 74HC595 also has a serial out option so you can wire three of them in series and then shift in 24 bits. The 8 ones you shift in first will end up in the last HC595 in series, second 8 bits in the middle one and the last 8 bits in the first one. You then wire a 7 segment LED display to each of the shift registers and voila.

Every time you will want to update any of the displays you will have to update all of them, but the other two will again receive the same data. Not a problem.

Datasheet for 74HC595: http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

Cheers!

I was going to suggest this very same thing. In general a great way to multiplex.
 
  • #9
sophiecentaur said:
Why would that be? Servicing three displays would only mean that the duty cycle of each would be 1/3 as long as if just one display was being supplied. So they would each be pulsed at 100Hz.

if I turn each display on for 1 clock pulse at 100Hz it will be 3 cycles before I turn it on again. You know, display1 on for 10ms, then display2 on for 10ms, then display3 on for 10ms. So for a 100Hz clock, display 1 is on for 10ms every 30ms.


NEUR said:
An idea worth considering perhaps is using an 8-bit serial-In parallel-out register like 74HC595 for example (sophiecentaur suggested something similar if I am not mistaken).

The serial interface to load the segment values is a good idea if you want to save pins. If you want you can drive all the displays from a 21 bit (or 22 if you want to include the enable) serial chain, or alternatively include the 7 segments and the three enables as shift register output pins. Either way makes for a more complicated driver, but saves IO pins.

Remember that the display pulse width is a cool way to control brightness.
 
  • #10
meBigGuy said:
if I turn each display on for 1 clock pulse at 100Hz it will be 3 cycles before I turn it on again. You know, display1 on for 10ms, then display2 on for 10ms, then display3 on for 10ms. So for a 100Hz clock, display 1 is on for 10ms every 30ms.

I see where you're coming from now but, for only three segments, why ever would an Arduino limit you to one change every 'cycle'? Even the technologies of the '60s could have handled refresh rates much higher as that. Multiplexing display elements is only necessary when you are limited either by speed or the number of interconnecting wires. If you are suggesting that the driver for the three displays should be totally shared (which may be your reasoning) then I would say that's just not the right way to do it - particularly as a self-training exercise. Latches / registers rule for that application.
 
  • #11
Not sure what is wrong with the picture in post 3. Very simple, common example of what the OP was referring to. That is one way it is commonly done. The ONLY reason to go to serial drivers or other external components is because you need the pins for something else or have more complex drive requirements. But whatever one decides regarding IO, sequencing the digits in such a way is the way nearly every multi digit 7 segment LED display works.

Regarding the frequency, generally processors are doing other things. A timer interrupt every 3ms to service the display is totally reasonable. No need to update it more often.
 
  • #12
meBigGuy said:
Not sure what is wrong with the picture in post 3. Very simple, common example of what the OP was referring to. That is one way it is commonly done. The ONLY reason to go to serial drivers or other external components is because you need the pins for something else or have more complex drive requirements. But whatever one decides regarding IO, sequencing the digits in such a way is the way nearly every multi digit 7 segment LED display works.

Regarding the frequency, generally processors are doing other things. A timer interrupt every 3ms to service the display is totally reasonable. No need to update it more often.

I agree about the suggested circuit. My problem was that you implied that a 3:1 reduction was necessary because of some speed capacity limitation. It's obvious that you need to put out information for three displays at three times the rate for one display but that doesn't mean you have to do it slower in this case. When it does become a problem, you just off-load that process to other circuitry. I probably misread your original meaning.
 
  • #13
I was saying that you need to switch at least at that rate or else it would flicker. I've read that some people can sense 200Hz flicker in their peripheral vision (anecdotal).
 

Related to 7-segment LED display using Arduino

1. How does a 7-segment LED display work with an Arduino?

The 7-segment LED display is a common type of display that uses seven LED segments to create numbers and some letters. It works with an Arduino by connecting each segment to a digital pin on the board. The Arduino can then turn each segment on or off to display the desired number or character.

2. What are the advantages of using a 7-segment LED display with an Arduino?

One advantage is that it is a simple and cost-effective way to display numbers and some letters. It also requires fewer pins on the Arduino compared to other display options, making it easier to use with other components. Additionally, 7-segment displays are easy to read and can be seen from a distance.

3. How do I connect a 7-segment LED display to an Arduino?

To connect a 7-segment LED display to an Arduino, you will need to use jumper wires to connect each segment to a digital pin on the board. You will also need to connect the common cathode or anode pin of the display to a ground or power pin on the Arduino, depending on the type of display you are using.

4. Can I control multiple 7-segment LED displays with one Arduino?

Yes, it is possible to control multiple 7-segment LED displays with one Arduino by using multiplexing techniques. This involves switching between displays quickly to give the illusion that all displays are continuously lit up. However, it is important to make sure the Arduino can handle the current required for all the displays.

5. Are there any limitations to using a 7-segment LED display with an Arduino?

One limitation is that 7-segment displays can only display numbers and some letters, so it may not be suitable for displaying more complex information. Additionally, the number of digits that can be displayed is limited by the number of available pins on the Arduino. This can be overcome by using multiplexing, but it may affect the brightness of the display.

Similar threads

  • Electrical Engineering
Replies
5
Views
2K
Replies
7
Views
2K
  • Electrical Engineering
Replies
8
Views
946
Replies
5
Views
2K
  • Electrical Engineering
Replies
3
Views
1K
Replies
5
Views
1K
  • Electrical Engineering
Replies
23
Views
1K
Replies
80
Views
3K
Replies
17
Views
2K
  • Electrical Engineering
Replies
5
Views
2K
Back
Top