3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

LED Cube 8x8x8

Step 8IO port expansion, more multiplexing

IO port expansion, more multiplexing

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.

« Previous StepDownload PDFView All StepsNext Step »
24 comments
Jan 24, 2012. 8:23 PMjtovar93 says:
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
Jan 25, 2012. 4:07 AMtriumphtotty says:
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
Mar 16, 2012. 9:46 AMjtovar93 says:
Thank you.
I do consider myself a beginner but I really want to finish this cube.

Once again thank you
Feb 7, 2012. 4:59 PMaleal3 says:
What should i do with the Output Enable pin???? i have to connectit to my microcontroller?
Feb 8, 2012. 3:59 AMtriumphtotty says:
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.
Feb 5, 2012. 1:40 PMaddhi says:
Hey guys

You can just change the file from *********.tmp to **********.sch and open it in EAGLE CAD. :-)
Feb 3, 2012. 10:24 PMitsgambit says:
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.
Feb 5, 2012. 8:26 AMtriumphtotty says:
The .tmp files just need to be renamed to the correct extension, and then they will open in your program of choice!
Nov 19, 2011. 4:22 AManhthux08 says:
YOU CAN SEND YOUR FILES multiplex_theoretical.sch to mail :nguyenthu1890@gmail.com
Nov 11, 2011. 9:45 AMshiva19192 says:
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.
Sep 4, 2011. 7:14 AM8:J=G52 says:
Hi All,

I am looking for the schematic files. Did someone managed to download them and construct the cube?
Jul 5, 2011. 8:25 AMjahanzeb.gul1 says:
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 !
Sep 4, 2011. 7:12 AM8:J=G52 says:
Hello,

Did you manage to download the file?
Jul 5, 2011. 9:42 AMlazardj says:
just rename it to something.sch and it will work :)
Aug 31, 2011. 9:15 AMvijirvy says:
in ic3 in1(oc) is not connected but all other ic's pin1 is connected
Aug 20, 2011. 9:28 AMsfbaynate says:
Hey Guys, what viewer/program is used to view these .sch files?
Aug 22, 2011. 10:33 PMajugen says:
Eagle CAD!
Aug 23, 2011. 6:42 AMsfbaynate says:
Thank you!
Jul 18, 2011. 5:43 AMTechNotes says:
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?
Aug 18, 2011. 5:40 AMpaler31 says:
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
Aug 12, 2011. 1:18 PMTechNotes says:
Can anyone answer this question? Sorry to comment on it again but its been almost a month since i posted.
Aug 7, 2011. 5:09 AMyww336600 says:
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
May 25, 2011. 9:26 PMfostersfriend says:
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
May 23, 2011. 8:34 PMhemmikarl says:
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
Apr 24, 2011. 2:12 PMhatschel says:
I t means the 74HC164 instead of the ACT138
Apr 14, 2011. 4:02 PMhatschel says:
hey I use a similar circuit
it´s still the same but uses the shiftregister 74HC164
would it work with the software?
Mar 28, 2011. 12:35 PMasdff123 says:
what software do you use to edit your sch files
Apr 14, 2011. 3:59 PMhatschel says:
I think eagle
Feb 12, 2011. 8:22 PMStarGazerBob says:
(removed by author or community request)
Jan 23, 2011. 1:10 AMpintecan says:
where the scheme??
Jan 15, 2011. 12:02 PMakkoe says:
I was wondering what the maximum current is you can get from the 74HC574 IC's. I'm a little bit puzzled with all the figures in the datasheet, but fore sure it's not unlimited.

I seems you people use 6mA per led. is this because of limitations of the latch IC?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
651
Followers
7
Author:chr
I like microcontrollers and LEDs :D