Multiplexing LED displays - two options. Need help which to use.

Folks,

A little project I may build is a 4 digit clock with LED display.
This is to simply sit beside the 'puta and display the time as I don't have a clock visible near it.

It will be plugged into a "spare" USB port for power.

Now, 4 digits, 7 segment displays.
That's 8 pins needed.
4 for the digit and 4 to select which digit is being displayed.

But here in lies the "problem":
Using BCD - 7 Segment display driver chip is good and it allows a "select" that chip, and a "Latch" to keep the display active when the input pins are doing other things.

But that would mean 4 of these chips also.

What I was thinking is to do it another way:
The 4 pins go from the Arduino to the encoder chip, then the outputs multipled to the 4 displays.
Say the displays are common cathode.
Each of the cathode pins go to the other 4 pins on the arduino.
That way the digit select is done by which pin is LOW on the arduino.

Obviously it is going to "flash" the display, but at a high speed, and I could "modulate" that speed to control the brightness.

Another question is the resistors:
I'm guessing - from past experience - that I would have to use individual resistors for each digit, as a "common" resistor for all 4 probably wouldn't work. :-/

Any thoughts?
Thanks in advance.

Hi,

The Arduino pins won't be able to sink enough current to make the displays bright enough, given 1:4 multiplex ratio. You need some npn transistors or a ULN2003 or ULN2803.

Also you will need one series resistor per segment, not one per digit.

What parts do you already have that you want to use? There are lots of other ways to do this, some easier than others.

Paul

PaulRB:
The Arduino pins won't be able to sink enough current to make the displays bright enough, given 1:4 multiplex ratio.

Says who?

The LEDs probably have a maximum current of 20mA and the Arduino is perfectly capable of driving that. 1:4 isn't a massive ratio.

Just use 1 MAX7219, connect via SPI and send it the 4 digits you want displayed.
1 resistor to control max brightness, 15 levels of brightness control.

fungus:
Says who?

The LEDs probably have a maximum current of 20mA and the Arduino is perfectly capable of driving that. 1:4 isn't a massive ratio.

I'm saying the arduino can't sink 20mA per LED times 8 segments. That's why the transistors/ULN are needed.

If the Arduino pin must sink the current from 8 segments, you can only afford just over 3mA per segment, which, combined with a 1:4 multiplex ratio is less than 1mA per segment on average.

and I could "modulate" that speed to control the brightness.

No, changing the speed does not affect the brightness. Changing the ration of on / off time affects the brightness.

Grumpy:

I stand corrected.

Vocabulary error.

These are two options on how to do it.
Understand they are basic circuits. But the "guts" of it are shown to the two ways I can see as easy.

CrossRoads:
Max7219 not easily available.
I'm trying to make it with easy to get things.

LED options.pdf (188 KB)

So what chips do you have?
7446? 7447? something else, like shift registers?
Common anode or common cathode displays?
Can multiplex with 4 transistors.
http://www.ti.com/lit/ds/snos257a/snos257a.pdf

Cross Roads,

I haven't really looked yet.

I am just wanting to make a "CHEAP & NASTY" clock with 4 LED digits which is plugged into a USB port.
I have found the afore mentioned display driver chip but it is a bit expensive. I shall have to cost 4 x BCD/7 Segment drivers vs the multiple resistors or the few resistors if I mux them together.

But space/size and price are all in the equation. :frowning:

As I said it really just a basic clock.
I may even try to write a program for the PC so every time it boots it sends the time to it.

lost_and_confused:
I am just wanting to make a "CHEAP & NASTY" clock with 4 LED digits which is plugged into a USB port.
I have found the afore mentioned display driver chip but it is a bit expensive.

Official prices are ridiculous, yes, but they're less than $1 on eBay: MAX7219 for sale | eBay

You can even get chip + seven segment displays for $3, eg: http://www.ebay.com/itm/370821393783

For true cheap & nasty, just need a single uC with 11 IO, and as many buttons as you need for changing time. Could be just 1 with good coding (press & hold to cycle thru the digit to update, then single presses to advance thru the digits).
Are you communicating over USB, or just powering?
All A segmets wired in parallel, all B segments, etc.
Drive 1 segment High, sink current for 1 digit. Repeat 28 for all segments. Easy to do. Just need 4 resistors for current limiting.
Keep track of the values of the 4 digits.
Would go with external crystal for best accuracy:
http://www.digikey.com/product-detail/en/9B-16.000MEEJ-B/887-1244-ND/2207664
So: '168, crystal, two 22pf caps, 10K reset pullup resistor, two 0.1uF decoupling caps, 4 current limiting resistors, 1 button, 4 displays. ICSP header for programming. USB connector for plugging in USB cable.

In fact, Nick Gammon made just such a clock here, with an RTC as well for time retention

There's something I don't understand about about Nick's design.

Supose the time is 11:11 in the morning. 8 segments need to be lit (ignoring any colons or decimal points). With the 270R series resistors, around 20mA flows through whichever of the 8 segments is lit at any instant. On average, each segment receives 2.5mA. Thats not going to be very bright, but ok for indoors.

If the time is 20:08, 25 segments need to be lit. On average each segment reveives less than 1mA. That's goind to be barely visible except in a dark room, isn't it?

Am I missing something?

Paul

You can see in the photographs that the segment brightness depends onhow many segments are on at any one time.
Either of those two earlier schematics would do. You have to multiplex both of them.

In Nick's design,each segment is lit full on with up to the limit of the segment (typically 20mA) for 1/28 of the cycle time.
If you want it flicker free, you want to cycle thru all of the segments 24 times/second.
So, drive-time for any segment is 1/24 second/28 segments = 1488 microseconds.
So you can write your loop to check when 1488uS passed, when it has turn off the current segment and turn on the next segment. That's single segment multiplexing.
Check the spec on your display - individual LEDs are often spec'ed for a higher current for short periods - if your display supports that you drive like 35mA vs 20mA to make things look brighter.