Pages: 1 [2]   Go Down
Author Topic: Mutiplexing or Shift Registers?  (Read 1093 times)
0 Members and 1 Guest are viewing this topic.
SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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")
« Last Edit: July 01, 2010, 07:48:09 pm by Osgeld » Logged


Manchester, New Hampshire
Online Online
Edison Member
*
Karma: 1
Posts: 1286
Propmaker
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)


Quote
Well, I ment a binary time clock
Quote
No, you meant a binary-coded decimal clock.

http://en.wikipedia.org/wiki/Binary_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  
« Last Edit: July 01, 2010, 11:26:49 pm by scswift » Logged

Somewhere in Arizona
Offline Offline
God Member
*****
Karma: 0
Posts: 725
Arduino must be a drug, because I'm addicted!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. :'( :'(
Logged

UK
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2883
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Per Arduino ad Astra

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

http://mrmeval.livejournal.com/723005.html

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205021534

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

http://www.arduino.cc/playground/Main/InterfacingWithHardware#Input

« Last Edit: July 02, 2010, 01:39:58 am by mrmeval » Logged

If it was designed by man it can be repaired by man.

Somewhere in Arizona
Offline Offline
God Member
*****
Karma: 0
Posts: 725
Arduino must be a drug, because I'm addicted!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

They are officially in the mail!
Logged

Pages: 1 [2]   Go Up
Jump to: