Go Down

Topic: Mutiplexing or Shift Registers? (Read 4576 times) previous topic - next topic


Jul 02, 2010, 02:46 am Last Edit: Jul 02, 2010, 02:48 am by Osgeld Reason: 1
use shift registers, like a 74hc595, they latch, and you can chain them, + you just use shift out

(lol I misspelled shift, and the censor put in "nuts")


Jul 02, 2010, 06:02 am Last Edit: Jul 02, 2010, 06:26 am by scswift Reason: 1
The multiplexed version will be both easier to code, and easier to build.  

Multiplexing your leds simply requires you to set pins high and low to select the digit and the leds in it you want to light.

Doing the same thing with shift registers would require three additional ICs and bypass capacitors to control your 21 leds.  And depending on what type of shift register you use you may not end up with leds that are any brighter than what you'll get with multiplexing.

To multiplex the display, wire all the leds for each digit up so all the cathodes are connected, and then connect that common cathode to a pin on the Arduino.  If you have six digits, that's six pins.

Once you have that done, you need to wire the anodes up.  For each digit, you're gonna have leds 0..3 represeting the different bits.  Take all the anodes for led 0 in each digit and wire those together.  Then connect them to a pin on the Arduino via a resistor that is sized to power a single led of the type in your display.  Do the same for the other 3 leds.  This will take 4 pins.  (Google led wizard to find the resistor size you need.  Input the higher of the two forward voltages in the led data sheet, 5v source, and 20mA or less.)

Then in your code:
1) Loop through your digits one by one.
2) Set all anode pins low. (So when you select the next digit, none of the leds are already on before you select the ones you really want.)
3) Set all cathode pins high _except_ for the one for the digit you want to light.  
4) Set the anode pins high for the leds in that digit which you want to light.
5) Pause for some period of time.  Since you want to update your display at 60hz, you don't want to spend more than 1000ms / 60hz / 6digits = 2.7 milliseconds or 2700 microseconds, on each digit.  So delay(2) will be fine.

And that's it.  Except for your am/pm led.  You can just wire that up to another pin with the same size resistor as the others going to ground.

Total: 10 pins to display 6 binary numbers, plus one pin to turn on on the am-pm indiciator. 11 pins in total.  

(And if you want to get clever, you could wire the am/pm led up so that it behaves as one of the bits in one of your digits which doesn't require all four bits, like the tens portion of the hour display, which will save you a pin.)

Well, I ment a binary time clock

No, you meant a binary-coded decimal clock.


You're both right.  Either type can be referred to as a binary clock.

Btw I would never have dreamed of building anything like this when I was 12!  

When I was 12, after burning out all the ics in my electronics kit because I didn't understand anything about how electricity flowed in a circuit, I wired up the two transformers in such a way that they melted and then my mom took away the kit. ;D  


I think I will use the 74hc595 chip. They sound easier to work with, and more pin effitient.

As for the mega: I don't want to put an arduino mega in it, because they are $65, and this is perminent... A few 35 cent chips is better than a 65 dollar arduino mega.

And yeah, I hope I dont blow up the house... My mama would take my arduino away. :'( :'(


They sound easier to work with, and more pin effitient.

If you want pin efficiency, use charlieplexing.
Six pins gets you thirty LEDs.
There's even a library in the playground.
Some people are like Slinkies.

Not really good for anything, but they bring a smile to your face when pushed down the stairs.


Jul 02, 2010, 08:38 am Last Edit: Jul 02, 2010, 08:39 am by mrmeval Reason: 1
21 will require three shift registers, they are easy to use, if you want to drive higher current LEDs then use the HEF4794 or a transistor on the output of the 595

This is what I did, I've not done more since.



You will probably want a stable time source since the Arduino does not have one.



They are officially in the mail!

Go Up