Building an 8x8x8 LED Cube – The Driving Circuit

LED Cube Driver Circuit - Complete Board - Front 04

In this article we are going to take a detailed look at how to build the driving circuit for the 8x8x8 LED cube. In other words we are going to design and analyze the circuit which translates the signals coming from the Arduino to appropriate currents passing through each of the LEDs, so that the desired animations can be created. We will go through the schematic, check the needed parts and we are going to see how to build the circuit exactly. If you haven’t read the introduction part yet, which talks about what we are trying to achieve in general, it’s probably a good idea to read it before we dive into the details of the driving circuit.


Power consumption

A very important thing to consider when designing a driving circuit for an LED cube is the maximum possible power consumption of the system, because the components and the power supply need to be chosen accordingly. The components that will drain most of the current are obviously the LEDs. Our cube is going to be one that is used with multiplexing (but we will do the multiplexing from the software, so we don’t need to worry about hardware multiplexing). This means that at any given time only one horizontal layer (plane) can be lit. In other words we need to plan for a maximum of N*N LEDs consuming power. In the 8x8x8 cube this means that we’ll have to take into account the power consumption of 64 LEDs, but if you are building a cube of a different size, you’ll need to adjust the calculations accordingly.

So how much current can an LED drain? Well, that depends on the value of the current limiting resistors that we use for each one of them. But the standard 3 mm (or 5 mm) LEDs of today are usually rated at 20 mA. We will design the circuit to be able to handle 20 mA of current per LED because there is a wide selection of LEDs out there and you might need to really give them 20 mA to shine brightly. However, I have found that most LEDs need much less current in order to shine brightly. For my own LED cube I have used standard 3 mm bright blue LEDs. For these the optimal brightness is obtained at 1.5 mA, which is obviously much less than their 20 mA rating. I’d like to emphasize here that figuring out the optimal brightness of you LEDs before you start building the cube’s driving circuit is very important. If your LEDs won’t be bright enough, the cube will look pale and that’s not something that we want. On the other hand, if the LEDs will be too bright, they will shine through the LED which is above them in the cube and it will seem that the above LED is also lit. This is even worse than a pale cube. So experiment with  your LEDs, in darkness and in daylight and determine how much current they need to shine with the exact brightness that is needed. Note that the value of the used current limiting resistors will also depend on the color of the LEDs because LEDs of different colors have different voltage drops. Here is a quick reference of the LED forward voltage values by color.

Getting back to the circuit design, we will plan for a maximum current of 20 mA per LED and a maximum of 64 LEDs being lit simultaneously. That means a total consumption of 1.28 A. That’s quite a lot and we’ll need a power supply rated at least at 1.5 A, preferably at 2 A. Should you decide to feed your LEDs with less current, a smaller power supply will suffice. In my circuit I have given them about 1.5 mA, so for 64 LEDs that’s a total of only 92 mA and yet the brightness is good enough. For 3 mm or 5 mm white or blue LEDs most likely the same current values can be used. For other colors you might need to give them a bit more current or even if the same amount of current will be enough, you’ll need resistors of different value.

Let’s also keep in mind that the LEDs are not the only components in the circuit which consume power. The other components (like MOSFETS and shift registers) also use up some current, but that is close to a negligible value. There is however something else. The multiplexed cube needs to switch between the layers very fast, in a matter of a few milliseconds or even less than one millisecond. Some of the components, like the MOSFETs which switch the layers, need time to shut off. I have found that some resistors are needed between the anode layers and the ground and the cathode columns and the positive voltage in order to help some currents go away after switching layers, otherwise they will go away through the LEDs and that will result in ghosting (when a layer is switched on, the previous layer is also dimly lit, which looks very bad). So, to get rid of this ghosting, I have added a 1K resistor between each anode layer and the ground and a 10K resistor between each cathode column and the positive voltage. In a 8x8x8 LED cube we have 8 anode layers and 64 cathode columns. Given the fact that the whole circuit functions at 5V, this means that the resistors between the anode layers and the ground will generate a total current consumption of 8*5 mA = 40 mA. The resistors between the cathode columns and the positive voltage will generate a total of 64*0.5 = 32 mA current consumption. That’s 72 mA overall. Unfortunately this is a passive power consumption, meaning that the cube will consume at least this this much, even if all the LEDs are off.

Finally, let’s not forget the power consumption of the Arduino which powers the cube. You will most likely want to power it from the same supply unit, so it too adds to the consumption. This will depend on the exact model that you use but even the most power hungry ones will not eat up more than 200 mA. Unfortunately it’s likely that we’ll need a model which uses quite some current (but not more than 200 mA) because the code that generates the animations will need a few kilobytes of memory, so a more powerful microcontroller (with enough memory) is needed for it.



So, without further ado, allow me to present the schematic of the driving circuit. Please note that it was designed by Robert Patterson, also known as CrossRoads at the official Arduino forum. It’s he who we have to thank for this wonderful design. To check out more of his great circuits, visit his website at

LED Cube Driver Circuit - Schematic


Serial communication between the Arduino and the shift registers

As explained earlier, in the introduction, we are going to use serial-in, parallel-out shift registers in our LED cube driving circuit, so that we can minimize the connections between the Arduino and the circuit. The data between the Arduino and the shift registers will be transferred via serial communication, through SPI. The Arduino will have the role of the master and the shift registers will be the slaves. The shift registers can be chained, meaning that the output of the first one can be fed into the second one, the output of the second one can be fed into the third one, and so on. This allows us to minimize the communication lines between the Arduino and the driving circuit because the Arduino only needs to send data to the first shift register in the chain and this first shift register will pass on the data, until it reaches the very last one. To understand how shift register work, check out this great video by Kevin Darrah:

In a circuit which drives an LED cube made of N*N*N LEDs, the number of shift registers needed is N+1 (this is true if N<=8). One is needed to switch on/off the anode planes and the rest of N shift registers are needed to switch the cathode columns. The TPIC6B595 shift registers that we use have 8 outputs, meaning that each shift register can drive up to 8 anode layers or 8 cathode columns. The first shift register in the chain is assigned to the anode layers because switching these is the most important and data from the Arduino reaches this shift register first. If you consult the datasheet of the TPIC6B595 shift register, you will see that the data is propagated from one shift register to the next very fast, in a matter of a few nanoseconds, so if the Arduino needs to send some data even to the last shift register in the chain, it can just push it through the whole chain quite fast, until it reaches the last one.

The most important thing to understand is that whenever the Arduino wants to change the state of any LED in the cube, it will actually update all the shift registers in the chain (with (N+1)*8 bits of data in total). It will first send the 8 bits of data which need to be in the last shift register and these first 8 bits will go into the first shift register first, but when it  will send the next 8 bits of data, the first shift register will make room for these next 8 bits by flushing out the first 8 bits, into the next shift register. The third transfer of 8 bits will push the data from the second shift register into the third one and from the first shift register into the second one. This way, after N+1 transfers of 8 bits, the first 8 bits will arrive into the last shift register in the chain, the second 8 bits will arrive into the one before the last and so on. The 8 bits which are sent out last will remain in the first shift register in the chain.  This means that the state of the cube changes all the time during the communication between the Arduino and the shift registers, but this happens so fast (in a few hundred milliseconds at most) that the human eye will not see any of it happening. Quite a nifty trick.

Unlike most LED cube driving circuits out there, which use the popular and ridiculously cheap 74HC595 shift register, ours has TPIC6B595 shift registers in it. This is because we plan for relatively high currents (if we really plan to give a maximum of 20 mA to the LEDs) and we need to sync the current, not source it, because of our anode layer and cathode column design. But the TPIC6B595 is also cheap enough and it switches fast enough (in a few nanoseconds).

As shown on the schematic, only 3 pins are needed for the serial communication between the Arduino and the first shift register: master out, slave in (MOSI), clock (SLCK) and slave select (SS). The MOSI pin of the Arduino is connected to the SER IN pin of the first shift register in the chain, than the SER OUT pin of the first shift register goes to the SER IN of the second one and so on. This is how the shift registers are chained (this is how data goes from one to the next). The SCK (SCLK) Arduino pin is connected to the SRCK pin of all shift registers. The SS Arduino pin is also connected to all the shift registers, to their RCK pin.

Switching the anode layers with MOSFETS

While only a maximum of 20 mA can travel through each cathode column (which means that the cathode column can be connected directly to an output pin of a TPI6B595 shift register), the situation of the anode layers is different. They can have up to N*N LEDs lit up at once, so in an 8*8*8 LED cube up to 1.28 A of current can go into an anode layer. This can obviously not be handled by the output of the shift register which controls the anode layers, so we need something that decouples these large currents from the anode layers’ shift register. The solution is to use NDP6020P MOSFETS. It’s important to note that not only can they handle the maximum possible current that goes through the anode layers, but also they switch on/off fast enough (in a matter of a few hundred nanoseconds in the worst case). This is crucial because of the multiplexing used in our cube (switching between layers very fast to trick the human eye and make it think that all the layers are on, while in reality only one is). The ability of the NDP6020P MOSFETS to switch very fast is explained by their low Rds(on) value (seen in their datasheet). This is what sets them apart from many similar components that exist.

Each output of the first shift register (which handles the anode layers) is connected to an NDP6020P MOSFET’s gate through a 220 Ohm resistor. The source pin of the MOSFETS is connected to the 5V power, from where it directs the current to the appropriate anode layer of the cube (through the drain pin) when the shift register switches it on. When the appropriate output pin of the TPIC6B595 is switched on, the output pin acts as low, switching the MOSFET on. When the shift register’s output pin is switched off, the MOSFET is pulled high through the pull-up resistor between its gate and the 5V positive voltage. For this pull-up resistor 5.6K or 3.3K values are fine.

Limiting the LED currents

The brightness of the LEDs in the cube is determined by how much current we allow to flow through them. This is determined by the current limiting resistors that are connected between the LED cathodes and the outputs of the N shift registers which drive the cathode columns. This means that for a cube consisting of N*N*N LEDs we are going to need N*N current limiting resistors of the same value. The value of these resistors depends on how much current we want to give the LEDs, as discussed earlier. The value of the current further depends on the type and color of the LEDs. However, we know that our circuit works with 5V, but the MOSFETS and the shift registers loose some of that voltage, so the value of the current limiting resistors should be calculated with approximately 4.89V (suing Ohm’s law or the LED resistor calculator).

Eliminating ghosting

Unfortunately the clean design of the driving circuit has to be complicated a bit by adding some resistors between the positive voltage and the cathode columns and between the ground and the anode layers respectively. Their role is to help dissipate some currents which would otherwise go through the LEDs when the LEDs are actually switched off. This would result in some ugly ghosting (some LEDs lighting up in a dim fashion when they are supposed to be completely off). The software also needs to be aware of this and wait for a few microseconds between switching one anode layer off and switching the next one on (think of multiplexing). During these few microseconds these unwanted currents are directed away through the resistors. Between the cathode columns and the positive voltage we will add 10K resistors. Between the anode layers and the ground we need to add 1K resistors.

I have struggled a lot until I have finally managed to figure out this solution for the ghosting issue that existed in my test cube. I wish to thank all the members of the official Arduino forum who have given me a hand with this and also to IQJar’s reader Robert Sukhudyan, who has pointed me in the direction of this article, which also deals with a similar solution to a ghosting problem (see the section entitled “Eliminating ghosting”).

Miscellaneous considerations

Let’s not forget to add small, 0.1 uF ceramic capacitors between the +5V inputs of the shift registers and the ground. Some other higher value (perhaps 10 uF) electrolytic capacitors in parallel are also welcome.

One other thing to keep in mind is to connect the GND of the driving circuit to the GND of the Arduino.

Driving circuit PCB

To make building the driving circuit easier, I have designed a printed circuit board to hold all the components. The board, which is 140*120 mm in size, has all the right connections and can safely be used to create the driver circuit for an LED cube of N*N*N, where N<=8. Of course, it’s possible to build the driving circuit on prototyping boards or with some other methods, but this printed circuit is a much cleaner and safer solution, with no ugly wires hanging around.

This is how the design looks from the front:

LED Cube Driver Circuit - Design - Front

and from the back:

LED Cube Driver Circuit - Design - Back

I have created my own driving circuit based on this design and it works perfectly, so we can consider the design to be tested. My real driving circuit board based on the above design turned out like this when viewed from the front:

LED Cube Driver Circuit - Bare Board (Printed Circuit) - Front

and it looks like this from the back:

LED Cube Driver Circuit - Bare Board (Printed Circuit) - Back

Finally, here are a few images of the finished driving circuit, with all components soldered in:

LED Cube Driver Circuit - Complete Board - Front 01

LED Cube Driver Circuit - Complete Board - Back 01

LED Cube Driver Circuit - Complete Board - Front 03

LED Cube Driver Circuit - Complete Board - Front 05

LED Cube Driver Circuit - Complete Board - Front 02

All the files necessary to manufacture the PCB for the LED cube driving circuit (PDFs, Gerber files, miling files, drill data) are available for download here.

So have fun building the driving circuit! The next article about building the 8x8x8 LED cube is going to explain how to build the cube itself, in detail.


Building an 8x8x8 LED Cube – The Driving Circuit — 68 Comments

    • Very difficult! The whole build process becomes overly complicated because for each LED you’d have 4 wires instead of 2. The circuit is just more shift registers chained together (3x more), so that is not a great deal, although I’m sure that when you chain more together, some problems might arise, like latency (longer chain => slower data transmission). The software becomes also much more complicated. I’d say that making the cube RGB will probably require 10x more work. But, of course, the result is incomparably more awesome. I recommend that you watch Kevin Darrah’s videos on YouTube about making his RGB LED cube. They are very educative. Note that in one of his videos he says that he will never ever start building such a cube again because it’s just too much work 🙂

      Here’s a link to his channel:

  1. Ireally like this layout, it is the cleanest of the ones I’ve seen so far. Where can I find the components list for the board?

  2. I really like this layout, it is the cleanest of the ones I’ve seen so far. Where can I find the components list for the board?

    • I’m afraid I haven’t put together a component list… you’ll have to gather them by looking at the schematic or at the board diagramms.

        • Unfortunately not. I was planning on presenting the software part after the 8x8x8 cube is finished. Unfortunately I cannot find the time to finish it these days. I’m guessing that in the best case it will take a few more months, but maybe even a year or so before I can get to the software part…

          • Bummer! Am I right to say that with this setup, you could turn on multiple LED’s simultaneously in the same layer?

      • Yes, you’re right. But that should not be a problem, should it? In fact, how else would you be able to light up the LEDs in any combination. Because of multiplexing, the principle is that you only light up 1 layer at the same time, but in that layer you can light up any number of LEDs. That’s how it works. That is not a problem. A problem could be lighting up the whole cube (all layers at once). the hardware allows it and if you don’t have a strong enough power source, you might end up with unexpected results or damage. The software is responsible for not letting this happen (multiple layers lit up at once). But if you manage to introduce a serious bug in the code, there’s no guarantee that it won’t happen.

  3. Haha No sorry, just I was sure if the pdf’s of the board were literal size and there may have been a typo! Just being cautious before I make it 🙂 Thanks for the quick reply and the PCB layout!

  4. Hi! I’m really interested to repeat this project, and I like the design of the driver board. I’m only curious if the sample Arduino software code will be published. Thank you!

    • Hi Sergey!
      I’m glad you like it 🙂 The sample software is published, I’m just not advertising it much yet, because I’ve only been able to test it with a 4x4x4 cube so far. Theoretically it’s written in a way which only requires you to change a variable N from value 4 to 8, but, like I said, it hasn’t been tested with 8 yet… If you understand that for 8 it can have bugs (and that there are no animations in it yet, which take advantage of the large cube’s possibilities) and you’re willing to give it a try anyway, you can download it from here:

      • Your code will work for 8*8*8. It works really nicely. I am currently making slight changes and commenting it, the code was a little confusing (at least to me). Over all this project work great I will upload pictures soon.

        • Wow! I’m really happy to hear that it works on 8*8*8 too 🙂 I’m moving into a new house soon and I’m hoping that there I will finally find the time to complete my large (8*8*8) cube, so it’s great news that the code will work “out of the box” 🙂 Obviously for a large cube much more intricate animations can be created and I’m looking forward to do that. I’ll just have to find my patience and time to do all that soldering required for the large cube.

    • Hi,
      I’ve built this exact model and I believe i can answer your question.
      The total number of arduino Pins required is 3. 1 for the clock, 1 for the latch and 1 for the data. other than that you also require + and – for the voltage, so actually 5 if you don’t get an external source.
      As you probably already know, the 64 columns are driven with 8 shift registers. Now on top of that, the 8 layers are also driver with a shift register in series with the other shift registers. The 8 outputs have to be connected with a proper pull-down resistor to drive the gate of the Mosfets/transistors.
      In the software, you will have to write the code so that the 8 layers are written in the code in the front/back/middle of the data (72 bits of data), depending on how you connect it.
      I suggest you take a very long look at the schematic that is somewhere on this site and also brush up your knowledge on shift registers on youtube.

      And may I remind you that Caps are the equivalent to shouting over the internet? Please don’t, thanks.

      Hope i solved your question.

  5. Thx alot Pieter for the good job and thx again for info. u ‘ve provided. it is part of my final year project to do cubic led, so i ll appreciate it if you can help me here. I cant really figure out the schematic well, is there a way u can post a clearer one. Best Regards man

  6. I want to know if i make my cathodes as the columns and anodes as the layer, what is the things that i need to change ?

    • One of the main assumptions of this design is that the cathodes are the columns and the anodes are the layers, which is what you want, if I understand correctly. You cannot change that.

  7. Good morning all,
    I am new to this page,and would just like to say that i find it very interesting with regard to the cube driver board,is the board to scale,ie can i take a print from it,as i am in the middle of trying to complete an 8x8x8 led cube circuit from another site but find the layout of the schematic confusing up to a point,as i haven’t done electronics since i was aged 14, i am now 48,and wanted to make something that i could stand back and appreciate from my efforts,and my son wanted me to build it too,so don’t want to let him down,i don’t get much time to myself over the week because of my work,so try to do as much as i can over the weekends,anyway i just wanted you to know how interesting your site page is.

    kind regards. Dave.

    • Thank you, Dave! LED cubes are indeed extremely interesting and unique. Unfortunately building them requires a tremendous amount of time, so be ready for that. As for the driving circuit design, the credit goes to Robert Patterson (a.k.a. CrossRoads in the official Arduino forum), who helped me immensely while trying to come up with a usable design. I can never thank him enough in all our names, who follow his design!

  8. Hi does anyone know if I can use a different type of transistor as I have some S8050 bipolar npn ones laying around?

  9. Hello to all visitors of the forum! I have finally finished my 8*8*8 LED cube, it works nicely! However, I have a problem, some of the LEDs burn arbitrarily during operation. I have already changed a dozen of LEDs. The limiting resistor values are as specified, so the reason can’t be the over-current. I’m using 3,3V 20 mA blue diffused LEDs. Does anybody have a similar problem?

    • I’m answering my own question. The problem which caused the LEDs to burn was the reverse voltage of Vcc applied to every LED at all times via pull-down resistors of 1K connected to anode layers and pull-up resistors of 10K connected to every cathode column. This was proven by the voltage measurement on the LEDs of the working cube which showed +Vcc on the columns against -Vcc on the layers. Being given that the LED’s max. reverse voltage is 5V, no wonder that a smallest surge of Vcc caused them to burn. I have finally eliminated the 1K pull-down resistors, and I see absolutely no ghosting, as the pull-up resistors are still in place. And all my LEDs are now safe from reverse voltage! Thanks to the author of the site, and good luck to all.

  10. Does anyone have the PDF files for the PCB and could reverse the C1 front copper one so I can print this on transparency and transfer the ink to the PCB for etching please?

  11. Hi again, thanks for the quick response, the link does not contain what I could do with, im after the C1 front copper in mirror image so I can do a ink transfer from ohp film to copper clad board for etching.

    • You can download the code from my site (see the article) and in theory it should work on any Arduino, you only need to change some pins in the code. But I’m afraid that in practice it won’t work on the Uno because it only has 32 KB of memory into which the code and the data and the bootloader must all fit. You’ll need to get a Mega2560 for this to work. It’s just too much code and data to fit into 32 KB.

  12. Thanks for reply mate was wondering if is possible help me out with a smaller size code for arduino uno for i can test it out the cube, im very new to this so any help would be welcome

  13. i got the code your code finaly to work but is only working on 4x4x4 ,having a hard time to figuer out how to set 8x8x8 is only doing 4x4x4 could u please tell me files names that needs to be changed and what needs to be setup to work on 8x8x8, thanks in advanced

    • Hi! I’ve never tried it on a bigger cube than 4x4x4 either, because my 8x8x8 cube is still in the process of soldering. In theory it should work on bigger cubes by changing the N constant from 4 to 8 (or whatever) in defs.h. In practice I’ve never tried it (yet), but one of my readers has and said that ti works. See all the comments to this article and try to contact him. I’ll let you know when my big cube will be ready and when I’ll try it. Good luck!

  14. Hi Everyone.

    I previously had 6 PCB’s made to complete this project (6 was min order).

    If anyone is interested in buying a board i had professionally made in china them please contact me.

    They are extremely good quality and work a treat. Cheers

  15. hi i see the PCB have 4 conections for the arduino Mosi,Latch,clock and gnd e dont see for the 5v does this mean that arduino must be powered from exterior or can it be powered from the PCB circuit?

    • Hi there! Those pins are for the communication between the Arduino and the driving circuit. The Arduino must be powered individually. My approach was to create a barrel jack splitter and to distribute the power from the power supply to the Arduino and to this PCB.

  16. thanks for reply, but could i use the Mosi,Latch,clock and gnd like u have and then just add a extra wire pushing the 5v from PCB circuit to the Vin of ther arduino?

  17. Great on this cube i was wondering what program did u use to do the coding for the cube and if u got any more new effects to add up 🙂

    • Hi! I wrote the code in the standard Arduino IDE, but you could use any text editor and just upload it using the Arduino software. Yes, a lot more effects are planned when the big cube will be ready, because that one can do more spectacular things 🙂

  18. your cube is working great in the 8x8x8, circuit i have redone myself folowing same configuration just diferent look, add to do a litle change on the code i have rename de multiplexer file was having a error on compiler cause is in conflit with Robot_Motor libary some defenitions in libary with same name, has sometimes a litle bug not that mutch and works fine with arduino uno also, unfortunatly my programing not that good to fully understand how to do new effect, looking foward for u add in site some new effects and maybe sometime some interface for it, so this is a great tutorial and fully working 100%, if any help in adding some new effect plz send me a email im very exited about this great project you have done a great project..

    • Thanks, mkty! I’m truly happy to find that it really works on 8x8x8 too. I’m also looking forward to the moment when I’ll be able to finish the soldering of my 8x8x8 cube (it’s about half done now) and finally have the time to start adding new effects! I don’t think it will happen any time soon, but it’s going to be very exciting for me too 🙂 Perhaps this winter.

      If you want to try adding new animations, as far as I remember, you have to add a new derived class of Animation, or in other words, you can just copy the cpp and h file of an existing animation and change its inner workings (the code in the cpp). You will also have to modify Animator.cpp, the Animator::initialize() method to be more exact. you’ll have to add the instance of your new animation to the mAnimations array. And of course you’ll have to create this instance by declaring it at the beginning of Animator.cpp (see how the existing animations are added there).

  19. please tell me , from where i can get this PCB , itz urgent , because i have to submit my college project , please tell me

  20. Hi iqjar,
    I was able to build an 8x8x8 cube according to your driving layout suggestion and your awesome software package in about 40 hours (lots of soldering…). It is working like a charme!
    Thank you very much especially for the software.
    Kind regards from Hamburg, Germany

  21. Hi IQJar, can you please send me the sprint layout files? I want to slightly modify the schema for my needs.

    Thanks in advance,

  22. Hi there

    Currently I am busy building the 8*8*8 3mm led cube but I construct each layer so that the common is + (positive) in other words I soldered all the anode legs of the leds together so for my cube I will have in total 8 Anodes and 64 Cathodes , if I understand it correct will this circuit that you have designed work for what I build?
    I’m asking this question because it seems like in general the 8*8*8 led cubes are build so that it will have 8 Cathodes & 64 Anodes.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.