# Multiplexing via 7 seg display via Arduino board

Discussion in 'General Electronics Chat' started by chrischrischris, Sep 14, 2013.

1. ### chrischrischris Thread Starter Member

Feb 18, 2012
287
10
Can someone please clear up a query I have on multiplexing. I've just spent a stack of time trying to learn to program an arduino to study the effect of:

1. When multiplexing 2 seven segment digits, what is the lowest delay required so that I don't see the "flickering"
Same with 3 seven segment displays
Same with 4
Also what is the intensity difference with having 2 digits multiplexed vs on full time
Ditto with 4 digits

I believe from what I've read that the delay should be around 30 frames per second. Does this mean a delay of 33/1000 sec for 2 digits? I seem to have to type in 10 in my code for it to stop the flicker (not 33).

For 3 digits I need to set the delay to 7 and for 4 digits, a delay of 3. Can someone please tell me the maths for this.

I've also uploaded a video of my code running (see link below).

If anyone's interested in the code, see attached file...
View attachment Multiplex example.txt

Last edited: Sep 14, 2013
2. ### Dodgydave AAC Fanatic!

Jun 22, 2012
5,127
766
I use pic programming, and have a delay of 2 millisec , and call it 50 times in total , so each segment is on for 100 millisec in total, it works upto 5 digits, for more digits i would use a cd4511 segment decoder driver, no multiplex required.

so digit 1 on for 2ms (digits 2-3 off),
then digit 2 on 2ms, (digits 1-3 off),
then digit 3 on 2ms, (digits 1-2 off),

do this 50 times

Last edited: Sep 14, 2013
3. ### chrischrischris Thread Starter Member

Feb 18, 2012
287
10
Sorry, still not 100% sure...

So the delay time for each you have as 2ms.
If 5 digits, then 1 loop = 5 x 2 =10ms.
I would assume this repeats continuously, so in 1 second it loops 1000/10 = 100 times.

So does that mean that the frequency for each individual digit is 100 times per second each (i.e. 100 loops x 2ms x 5 digits = 1000ms)?

If this is correct, based on movie film rate being set to between 26 to 30 frames/sec, wouldn't this mean the fequency for 5 digits could be 1000/(30 x 2) = 6.6ms delay each? Or does a digital led display need a higher frequency than film?

4. ### Dodgydave AAC Fanatic!

Jun 22, 2012
5,127
766
If your worried about multiplexing, use the cd4511 cmos drivers, easier to use just put the binary value to each chip, set the latch, then move to the next segment, and so on,the chip will hold the value until it is refreshed with the latch pin. As for the multiplexing each digit is on for 2msec, the more times you call the display routine the less flicker,i have used it upto 4 digits and called it 125 times, so each digit is on for 2msec, off for 6msec, 8msecX 125=1sec.

5 digits would be on for 2msec off for 8msec, 10msec total time do that for 100 times = 1 second
or better use the cd4511 chip

Last edited: Sep 15, 2013
absf likes this.
5. ### chrischrischris Thread Starter Member

Feb 18, 2012
287
10
Ok, that's makes more sense. However it doesn't equate then to frames (flicker) per second. 4 digits - 125 times per second - therefore each digit is on 1/4 of the time.

I've found that they digits are considerably dimmer. Do you know if it's therefore 1/4 the intensity? If so, can I up the current to each digit (reaching the peak allowable, so as to compensate - as I want these digits visible outdoors in sunlight.

As for the 4511, in my previous 4 digit counter, I used 2 x 4518 dual BCD counters with four 4511's. However, this time I'm trying to achieve the same with less circuitry and greater flexibility. Am I steering in the wrong track trying to not use 45xx's?

As another option, can I use port manipulation to overcome the intensity drop of the digits? If so, any ideas where I can look for comparible code?

Last edited: Sep 15, 2013
6. ### Dodgydave AAC Fanatic!

Jun 22, 2012
5,127
766
I would use the cd4511 chips, that will give you max brightness,no hassle with muxing.