LED Cube 8x8x8

 by chr
Contest WinnerFeatured

Step 8: IO port expansion, more multiplexing

multiplex_theoretical.png

We gathered from the last step that an 8x8x8 LED cube requires 64+8 IO lines to operate. No AVR micro controller with a DIP package (the kind of through hole chip you can easily solder or use in a breadboard, Dual Inline Package) have that many IO lines available.

To get get the required 64 output lines needed for the LED anodes, we will create a simple multiplexer circuit. This circuit will multiplex 11 IO lines into 64 output lines.

The multiplexer is built by using a component called a latch or a flip-flop. We will call them latches from here on.

This multiplexer uses an 8 bit latch IC called 74HC574. This chip has the following pins:

  • 8 inputs (D0-7)
  • 8 outputs (Q0-7)
  • 1 "latch" pin (CP)
  • 1 output enable pin (OE)

The job of the latch is to serve as a kind of simple memory. The latch can hold 8 bits of information, and these 8 bits are represented on the output pins. Consider a latch with an LED connected to output Q0. To turn this LED on, apply V+ (1) to input D0, then pull the CP pin low (GND), then high (V+).

When the CP pin changes from low to high, the state of the input D0 is "latched" onto the output Q0, and this output stays in that state regardless of future changes in the status of input D0, until new data is loaded by pulling the CP pin low and high again.
To make a latch array that can remember the on/off state of 64 LEDs we need 8 of these latches. The inputs D0-7 of all the latches are connected together in an 8 bit bus.

To load the on/off states of all the 64 LEDs we simply do this: Load the data of the first latch onto the bus. pull the CP pin of the first latch low then high. Load the data of the second latch onto the bus. pull the CP pin of the second latch low then high. Load the data of the third latch onto the bus. pull the CP pin of the third latch low then high. Rinse and repeat.

The only problem with this setup is that we need 8 IO lines to control the CP line for each latch. The solution is to use a 74HC138. This IC has 3 input lines and 8 outputs. The input lines are used to control which of the 8 output lines that will be pulled low at any time. The rest will be high. Each out the outputs on the 74HC138 is connected to the CP pin on one of the latches.

The following pseudo-code will load the contents of a buffer array onto the latch array:

// PORT A = data bus
// PORT B = address bus (74HC138)
// char buffer[8] holds 64 bits of data for the latch array

PORTB = 0x00; // This pulls CP on latch 1 low.
for (i=0; i < 8; i++)
{

PORTA = buffer[i];
PORTB = i+1;

}

The outputs of the 74HC138 are active LOW. That means that the output that is active is pulled LOW. The latch pin (CP) on the latch is a rising edge trigger, meaning that the data is latched when it changes from LOW to HIGH. To trigger the right latch, the 74HC138 needs to stay one step ahead of the counter i. If it had been an active HIGH chip, we could write PORTB = i; You are probably thinking, what happens when the counter reaches 7, that would mean that the output on PORTB is 8 (1000 binary)on the last iteration of the for() loop. Only the first 8 bits of PORT B are connected to the 74HC138. So when port B outputs 8 or 1000 in binary, the 74HC138 reads 000 in binary, thus completing its cycle. (it started at 0). The 74HC138 now outputs the following sequence: 1 2 3 4 5 6 7 0, thus giving a change from LOW to HIGH for the current latch according to counter i.

 
Remove these adsRemove these ads by Signing Up
860236695 says: Apr 21, 2013. 2:47 PM
pls check all file ,type of all change to " .tmp "
pls help my Email:
ehsan.eas.ahmadi@gmail.com
Untitled.pngUntitled.png
alexresident says: Apr 20, 2013. 8:00 AM
Could anyboby help me with the multiplex_theoretical.sch and others diagram files i'm having an error when trying to download them, it downloads a .tmp file that doesn't works, can't be opened,
i will apreciate any kind of help.
my email is alexandre-alex@ig.com.br
Thks in advance !
Solannis says: Jul 7, 2012. 2:50 PM
I think I am missing something. I am new at interpreting digital schematics, so forgive me if I am misunderstanding something. In the diagram above, it appears that all the Dn data pins (D1, D2, D3, etc.) for each 574 are tied together, along with the OE pins. If that is the case, how does each individual data pin get it's data? I understand the pesudo code and what it is doing: uploading one buffer's worth of data per 574, making sure that the appropriate 574 gets its Clock CP pin lowered then raised to latch the Dn data to the corresponding flipflops and outputs (Qn) But how does each pin figure out which data bits are specifically for it?

Or am I reading the schematic wrong to begin with? Is that dark blue line just a convention that means that all LIKE pins are connected connected, such as all D1s are connected to all other D1s, all D2s are connected to all other D2s, etc., or are all those pins (D1s, D2s, D3s, D4s, etc.) REALLY on a single, common bus? Any help would be appreciated.
leetneko in reply to SolannisJul 13, 2012. 9:07 AM
The thick dark blue line is a data bus, its a way of cutting down clutter in a diagram.
They are actually all different cables.. imagine a cat5 network cable, it has 8 wires inside it, but its all just 1 cable.

Although it can be confusing, these data buses normally have labels to show what each wire is.
Im going on the assumption that D0 is connected to 1D pins on all the multiplexers, D1 to 2D pins, D2 to 3D pins.. etc.

So a high on D1 will be a high on all 1D pins.
Then the data is latched into a specific 574 by toggling the clock pin of that specific chip via the 138

I hope i make sense..
asingh65 in reply to leetnekoFeb 23, 2013. 12:51 PM
i am confused still.....
does this mean to connect all the 1D pins of all the latches to the D0 pin of the ATmega.......??
leetneko in reply to asingh65Feb 23, 2013. 1:27 PM
Im not sure if i can explain any simplier.. but i'll try.

All the data pins of the 574's are connected together.
1D to all other 1D's, 2D to all other 2D's.. etc.

This way, you only need 8 pins on the microcontroller to send data to all chips at the same time. But only the chip with OC low will actually read the data on the rising edge of the clock signal and set its pins accordingly to that when OC goes high.

Its been a while since i've used the 74HC574N, but at least the theory of it is sound.
Solannis in reply to leetnekoAug 3, 2012. 9:49 AM
That does make sense. Thank you very much for the reply. It helps me to understand it a bit better.
asingh65 says: Feb 23, 2013. 12:50 PM
i am confused still.....
does this mean to connect all the 1D pins of all the latches to the D0 pin of the ATmega.......??
tboultwood1 says: Jul 7, 2012. 11:54 AM
Am I right in saying the latches or flip-flop thingies are also could shift registers? I have made a 3x3x3 LED cube before and 4x4x4 and failed. So I hesitate to make this in case 10 pound worth of leds are wasted! :L I might make it for an on going project though :P Great tutorial and great guide! Thank you
shenn164 says: Jun 20, 2012. 8:15 AM
Can I wire the components exactly as it is on the schematic? i'm a confused with this multiplexing circuit i don,t know exactly how it works. all the wires goes through one path. please help.
jtovar93 says: Jan 24, 2012. 8:23 PM
I'm not sure if I'm understanding correctly...

How is the 74HC574 supposed to be programmed?

Can someone please explain me?
I am confused but i would really like to make this cube, can someone explain me how the 74HC574 should be programmed, or if I am completely wrong, can someone point me in the right direction?

Thanks
triumphtotty in reply to jtovar93Jan 25, 2012. 4:07 AM
The 74HC574 is a discrete chip which performs a pre-defined function, an Octal latch (or flip-flop) array. You don't progam it. Just wire it into a circuit and it will work as defined. Google for datasheets for the 74XX parts, e.g. http://www.nxp.com/documents/data_sheet/74HC_HCT574.pdf
jtovar93 in reply to triumphtottyMar 16, 2012. 9:46 AM
Thank you.
I do consider myself a beginner but I really want to finish this cube.

Once again thank you
aleal3 says: Feb 7, 2012. 4:59 PM
What should i do with the Output Enable pin???? i have to connectit to my microcontroller?
triumphtotty in reply to aleal3Feb 8, 2012. 3:59 AM
Yup. Pin 1 on each 74HC574 should be connected together, and run to Pin 4 (PB3) on the microcontroller. If you're using the two board setup, this goes via Pin 6 on SV1-SV2.
addhi says: Feb 5, 2012. 1:40 PM
Hey guys

You can just change the file from *********.tmp to **********.sch and open it in EAGLE CAD. :-)
itsgambit says: Feb 3, 2012. 10:24 PM
I dont know what I am going wrong but when go to download the files all I get at .tmp files and not .sch or .tar files. I was able to download the pricelist file as random_string.xls ... noob to this site... awesome instructable btw will let you know how it goes when done.
triumphtotty in reply to itsgambitFeb 5, 2012. 8:26 AM
The .tmp files just need to be renamed to the correct extension, and then they will open in your program of choice!
anhthux08 says: Nov 19, 2011. 4:22 AM
YOU CAN SEND YOUR FILES multiplex_theoretical.sch to mail :nguyenthu1890@gmail.com
shiva19192 says: Nov 11, 2011. 9:45 AM
Hello sir, i am really impressed with you and your cube. Really i also want to try that. Iam just a beginner to this digital electronics. could u please explaine me in that STEP 8 & 9.
икънчев says: Sep 4, 2011. 7:14 AM
Hi All,

I am looking for the schematic files. Did someone managed to download them and construct the cube?
jahanzeb.gul1 says: Jul 5, 2011. 8:25 AM
Hey !

I am newbie, whenever i click on the attached file (multiplex_theoretical.sch), it is downloaded as .tmp file further more i dnt have eagle also can anyone send me link of that software !

Regards !
икънчев in reply to jahanzeb.gul1Sep 4, 2011. 7:12 AM
Hello,

Did you manage to download the file?
lazardj in reply to jahanzeb.gul1Jul 5, 2011. 9:42 AM
just rename it to something.sch and it will work :)
vijirvy says: Aug 31, 2011. 9:15 AM
in ic3 in1(oc) is not connected but all other ic's pin1 is connected
sfbaynate says: Aug 20, 2011. 9:28 AM
Hey Guys, what viewer/program is used to view these .sch files?
ajugen in reply to sfbaynateAug 22, 2011. 10:33 PM
Eagle CAD!
sfbaynate in reply to ajugenAug 23, 2011. 6:42 AM
Thank you!
TechNotes says: Jul 18, 2011. 5:43 AM
Hey guys, I am new to this and I have a pretty dumb question. If you multiplexing 11 IO lines in to 64 anode lines, how can you still control each LED?
paler31 in reply to TechNotesAug 18, 2011. 5:40 AM
There are 64 led's in each lair of the cube, but each layer is also conected to one of the ports on the at mega. So you have 8 address lines one going to each layer. Therefore if you wanted to switch on say the led at possition 0,0 in the second layer you just switch on the second layer and supply a voltage to 0,0 anode. I think it works something like that. hope that is clear.

John
TechNotes in reply to TechNotesAug 12, 2011. 1:18 PM
Can anyone answer this question? Sorry to comment on it again but its been almost a month since i posted.
yww336600 says: Aug 7, 2011. 5:09 AM
hello!!! i am a chinese guy .i can not download the file :multiplex-theoretical.sch. I need the circuit diagram .Clould you send the file to me ?
Think you!!!
my e-mail :461421228!qq.com or yww336600@163.com
fostersfriend says: May 25, 2011. 9:26 PM
Im just going to matrix 4 by 4 equals sixteen then use four more io pins to matrix that to 64 io pins then just use audio transistors to run the LEDs on external power
hemmikarl says: May 23, 2011. 8:34 PM
I am working on a cube based on 8 8x8 LED matrix stacked on top of each other and toggled between with a IC called 4017 this enables me to use only 17 output pins of my micocontroller
I hope to make it usb compatable and yet still beeing able to run without a computer
hatschel says: Apr 24, 2011. 2:12 PM
I t means the 74HC164 instead of the ACT138
hatschel says: Apr 14, 2011. 4:02 PM
hey I use a similar circuit
it´s still the same but uses the shiftregister 74HC164
would it work with the software?
asdff123 says: Mar 28, 2011. 12:35 PM
what software do you use to edit your sch files
hatschel in reply to asdff123Apr 14, 2011. 3:59 PM
I think eagle
StarGazerBob says: Feb 12, 2011. 8:22 PM
(removed by author or community request)
pintecan says: Jan 23, 2011. 1:10 AM
where the scheme??
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!