Hello everyone! I followed this instructable to build a 5x5x5 LED Cube:
www.instructables.com/id/LED-CUBE-Arduino-5x5x5/
I used 5 SN74HC595N shift registers wired to the anode columns (aka "rows" in the picture) and 1 extra Shift Register (the 6th one) to control the cathode layers (aka floors) - see picture below:
So this is the simplified schematic for the first Shift Register.
I use Arduino Due (3.3V) to control 25 anodes (rows) and 5 cathodes (layers) through NPN transistors.
The LEDs voltage drop on 3.3V supply is ~2.8V => with 100 Ohm resistor ~ 5mA / LED
Arduino Due connections:
Data Pin: 11
Latch Pin: 8
Clock Pin: 13
3.3V Vcc to the Registers
GND to Registers + NPN Emitters
For the LEDs I used 25x100 Ohm resistors and for the layers I put 2KOhm resistors in the base of a 2n2222a NPN transistor. The collector is connected to the LEDs cathode and their emitters are connected to GND.
The problem comes with the code. It does upload on my Due but I can't manage to make it work. No LEDs light up, none at all.
I tried other codes as well (4x4x4 pattern) and they worked but the patterns were not displaying correctly of course. Can you offer me some help in order to understand how to make a code to light up one LED from 1 to 25 on the first layer and then go to the second layer (led 26 to 50) and so on get to light up every LED from the cube in the end.
In my opinion it should be something like this
B10000 00000 00000 00000 00000 B10000
B01000 00000 00000 00000 00000 B10000
B00100 00000 00000 00000 00000 B10000
B00010 00000 00000 00000 00000 B10000
B00001 00000 00000 00000 00000 B10000
B00000 10000 00000 00000 00000 B10000
B00000 01000 00000 00000 00000 B10000
B00000 00100 00000 00000 00000 B10000
B00000 00010 00000 00000 00000 B10000
B00000 00001 00000 00000 00000 B10000
etc...
where the last Byte (6th shift register) is the T1 lightning up the first layer. But I might be wrong, that's why I need someone to clarify this for me.
I've read the forum rules about posting the code...but because the code is a bit long I can't post it inside. So it's attached below. Any help from you guys to make the code work would be amazing.
Thank you in advance!
original_code_555.ino (28.1 KB)