Introduction: 4x4x4 Interactive LED-cube With Arduino

Picture of 4x4x4 Interactive LED-cube With Arduino
To explain my 4x4x4 interactive LED-cube published before, a bit more clear, I will try to make my first step by step instructable.

This 4x4x4 cube is interactive by using the top four corner LEDs both as LEDs and as sensors that will react on light. Depending on what LED gets the least light, the cube will run a different show.

Step 1: You Will Need:

Picture of You Will Need:

TOOLS
soldering iron
pliers
small screwdriver
some drillbits
drill
solder
piece of wood
pencil
ruler
computer with Arduino software
USB-cable
snips
sharpie
breadboard (optional)

PARTS
64 led's
4 resistors that go with the LED's (yes just 4)
1 Photocube
1 Arduino
some wire
some small COAX wire (isolated wire)
16 headerpins



Step 2: Making the Rig

Picture of Making the Rig

Draw on a piece of wood a grid with the lines 12,5 mm apart. (12 or 13 or whatever will also do, but I did 12,5) Draw at least 4 lines horizontally and 4 lines vertically. (I did more, because you'll never know what plans I will have in the future) You will now have 16 crossings. Drill some 5 mm holes (if your LEDs are 5 mm) at the crossings of the lines. If you first drill small holes, the location of your holes will probably be more exact.
This plank with 16 holes will be the rig for your soldering.

Step 3: Bending the Legs of the LEDs

Picture of Bending the Legs of the LEDs
First I bended the legs of 16 LED's. Hold the led upside-down diagonally, with the short leg in the upper left and the long leg in the lower right. Bend the cathode (short leg) to the left and the anode (long leg) down. So the flat part on the side of the LED wil be in the upper-left corner (the film and pictures will make this more clear I hope).





You can also bend 32 LEDs already if you are on a roll.

Step 4: Placing the LEDs in the Rig

Picture of Placing the LEDs in the Rig
When at least 16 LEDs have bended legs (leads), you can place them in your rig. You will have 4 rows of long legs (anode) touching each other and 4 rows of short legs (cathode) touching. On some places, the anodes will also touch the cathodes when they cross each other. That is not a problem. We will solve that later.

Step 5: Soldering the First Grid

Picture of Soldering the First Grid
Where the anode from one LED touches the anode from an other LED we will solder them together. Make sure that you don't solder an anode to an cathode.


At the places where the anodes are crossing the cathodes, we want to make sure that the legs aren'd touching. (they probably are touching now) We do this by forcing some room between the anodes and cathodes with the use of a small screwdriver. Be sure that you make enough room, but also be careful enough not to break anything.

Step 6: Start Playing

Picture of Start Playing

Sure you can work on until you are all the way finished, but isn't it much more fun to first start playing with your just creates 4x4 LED-grid?!
So place your anodes in a breadboard an run some resistors from each of your cathode-rows to some free lanes in your breadboard. (they must be the value that you will need to light one LED from the 5V of your Arduino. This could be something like 560 ohm)
Next run 4 wires from the anodes in your breadboard to ports 4 till 7 on the Arduino and 4 wires from the resistors in your breadboard to ports 0 till 3 on the Arduino. To make this already interactive you will place a LED with the anode (long leg) in analog-port 0 and the cathode in GND of the Arduino.

Next you run the following code (sketch) on the Arduino and when you go with your hand over the LED in the analog-port of the Arduino, you will see the lights of your LED-grid light up.

If it worked: yeah, you just multiplexed 16 LEDs. This means that you lighted up 16 LEDs individually by just using 8 Arduino ports, just by gritting them. We made just 4 anodes and 4 cathodes and with these 8 wires we can address 16 locations on the grid.

  

int basis = 0;
int sens = 0;
int x = 0;
int y = 0;
int totaal = 0;
int totaal1 = 0;

int led0 = 0;
int led1 = 1;
int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int tijd = 300;



void setup() {

pinMode(led0, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);

}


void loop()
{
for(x =0; x < 50; x++)
{
sens = analogRead(0);
totaal = totaal1 + sens;
totaal1 = totaal;
}
sens = totaal/x;
totaal = 0;
totaal1 = 0;
basis = sens-20; // instellen van de gevoeligheid
for(y=0;y<1000;y++){
for(x =0; x < 50; x++)
{
sens = analogRead(0);
totaal = totaal1 + sens;
totaal1 = totaal;
delay(10);
}
sens = totaal/x;
if (sens<basis)
splash1();

totaal = 0;
totaal1 = 0;

delay(10);
}

}

void splash1(){

test();
a();
b();
c();
d();
e();
f();
g();
h();
i();
j();
k();
l();
m();
n();
o();
p();
uit();
}

void uit(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void a(){
digitalWrite(led0, LOW);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void b(){
digitalWrite(led0, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void c(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);

digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void d(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);

digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void e(){
digitalWrite(led0, LOW);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void f(){
digitalWrite(led0, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void g(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void h(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);

digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd);
}

void i(){
digitalWrite(led0, LOW);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
digitalWrite(led7, LOW);
delay (tijd);
}

void j(){
digitalWrite(led0, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
digitalWrite(led7, LOW);
delay (tijd);
}

void k(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
digitalWrite(led7, LOW);
delay (tijd);
}

void l(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
digitalWrite(led7, LOW);
delay (tijd);
}

void m(){
digitalWrite(led0, LOW);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
delay (tijd);
}

void n(){
digitalWrite(led0, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
delay (tijd);
}

void o(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
delay (tijd);
}

void p(){
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
delay (tijd);
}

void test(){
digitalWrite(led0, LOW);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);

digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
delay (1000);
}               

Step 7: The Next Layer

Picture of The Next Layer

The leg bending
The next layer is the same as the first but not exactly! You will have to bend the legs of the LEDs the other way around. This means that you need to hold the LEDs with the flat side in the under-righthand corner. The anode will now be on the upper-lefthand corner and has to be bend to the left. The cathode in the under-righthand corner will have to be bended down.

Next follows the soldering.
First we solder the grid like we did with the first one.
Now you bend the anodes (long leads) of the first grid upwards and the cathodes of the first grid downwards. The anodes and the cathodes of the second grid will be bended downwards. Solder the four anodes from the first grid to the four cathodes of the second grid. The anodes of the second grid must just reach the bends in the cathodes of the first grid and have to be soldered there.

Charlyplexing
By connecting the anodes to the cathodes we are charlyplexing. By using charlyplexing, we can connect and control 16 more LEDs with the same 8 ports on the Arduino.
LEDs are diodes (the D from LED stands for Diode), this means that current can only go through it in one direction, what means that if you connect the anode of one LED to the cathode of an other LED and the cathode of that first LED to the anode of the second, only one LED will light up when you put current trough it, but the other one will light up when you put the current the other way around through it. This is exactly what we are going to use here. (I hope my sketches make it a little bit more clear)

Step 8: Lets Play Again!

Picture of Lets Play Again!
We are only halfway, but I think it is time to play again! So put the downwards facing leads in a breadboard and connect some resistors between the upwards facing leads and the breadboard. Connect them with the Arduino like before and run the following sketch. The extra LED is probably still in the analog port of the Arduino (if not, put it back in)



int basis = 0;
int sens = 0;
int x = 0;
int y = 0;
int totaal = 0;
int totaal1 = 0;

int led0 = 0;
int led1 = 1;
int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int tijd = 100;



void setup() {

pinMode(led0, INPUT);
pinMode(led1, INPUT);
pinMode(led2, INPUT);
pinMode(led3, INPUT);
pinMode(led4, INPUT);
pinMode(led5, INPUT);
pinMode(led6, INPUT);
pinMode(led7, INPUT);

}


void loop()
{
for(x =0; x < 50; x++)
{
sens = analogRead(0);
totaal = totaal1 + sens;
totaal1 = totaal;
}
sens = totaal/x;
totaal = 0;
totaal1 = 0;
basis = sens-20; // instellen van de gevoeligheid
for(y=0;y<1000;y++){
for(x =0; x < 50; x++)
{
sens = analogRead(0);
totaal = totaal1 + sens;
totaal1 = totaal;
delay(10);
}
sens = totaal/x;
if (sens<basis)
splash1();

totaal = 0;
totaal1 = 0;

delay(10);
}

}

void splash1(){

test();
a1(); b1(); c1(); d1(); e1(); f1(); g1(); h1(); i1(); j1(); k1(); l1(); m1(); n1(); o1(); p1();
p2(); o2(); n2(); m2(); l2(); k2(); j2(); i2(); h2(); g2(); f2(); e2(); d2(); c2(); b2(); a2();
uit();
delay (tijd);
}

void uit(){
pinMode(led0, INPUT);
pinMode(led1, INPUT);
pinMode(led2, INPUT);
pinMode(led3, INPUT);
pinMode(led4, INPUT);
pinMode(led5, INPUT);
pinMode(led6, INPUT);
pinMode(led7, INPUT);
}

void a1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void b1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void c1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void d1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void e1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void f1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void g1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void h1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void i1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void j1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void k1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void l1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void m1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void n1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void o1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void p1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void a2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void b2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void c2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void d2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void e2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void f2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void g2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void h2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void i2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void j2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void k2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void l2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void m2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void n2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void o2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void p2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}


void test(){
pinMode(led0, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
digitalWrite(led0, LOW);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);

digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
delay (1000);
digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (1000);
uit();
}               

Step 9: More Leds

Picture of More Leds

Third layer
The Third layer will be exactly the same as the second layer, only the inner two cathodes (short leads) need to be bended upwards. The anodes will be soldered to the bends of the cathodes of the second layer. You might want to ad a peace of blank wire to support this connection. This means that the third layer will be turned 90 degrees counterclockwise from the second layer. The two outer cathodes need to be clear of the second layer. 

The final layer
The fourth grid is a little bit different. It is mostly the same as the first grid, only you leave out the four corner LEDs. So you solder the grid exactly the same way together as the first layer, leaving out the four corner LEDs.
All the leads will be bended down and soldered to the third layer. The two anodes called F and G on my drawing will be soldered to the upwards bended cathode-leads on the third layer. This means that the fourth layer is 90 degrees turned counterclockwise from the bottom layer. Where the rest of the leads go will speak for themselves now; The leads will be soldered where they touch the third layer. This means that the cathodes from the fourth layer will be soldered to the anodes of the third layer and the anodes of the fourth layer to the cathodes of the third layer.

Extra wires
Solder four wires on the four cathodes from the third layer (two of them still hanging lose somewhere). These wires have to run down but not touch the first and second layer.

Fritzing file
I added a Fritzing file to give you a high-res schematic. Just watch the schematic-view in Fritzing. The other views are rubbish. (Fritzing is open source software to design schematics and PCBs from your breadboard-experiments. See www.fritzing.org)

Step 10: The Housing

Picture of The Housing

To house your LED-cube you can be as creative as you like. I found an old-fashioned photo-cube. With a sharpie I mark where the wires need to go trough the bottom of the photo-cube. Four holes for the four wires coming from the upper two layers. Four holes for the four anodes coming from the first layer. Four holes under the four cathodes going up from the first layer to the second layer.
After I drilled the holes, I can stick the eight wires trough them.

Wiring the cube
From the anodes coming from the first layer I run wires to four headers that will go to port 8-9-10-11 of the Arduino. From the wires coming from the top two layers, wires will go to headers for port 4-5-6-7. 
Trough the four remaining holes I stick the four resistors that will be soldered to the cathodes from the first layer. (Be careful not to melt the plastic with your soldering iron, like I did) These resistors will go to four headers entering ports 0-1-2-3 on the Arduino.

Step 11: The Sensor-LEDs

Picture of The Sensor-LEDs

Preparing the wire
I didn't like the looks of the black COAX cables. (this is slim COAX, not the thick one you use for your TV) The cable was to thick and to black, so I stripped off the outer plastic layer. I took four peaces and stripped the last 5 mm till the inner wire.
The leads on the four remaining LED's will be bended to one side so that they are not touching each other. 5 mm from the LED they are bended down again.
The anode is welded to the inner wire of the COAX and snipped of short enough that it doesn't touch the outer cable of the COAX. The cathode is soldered to the outer cable of the COAX.

Drilling the holes
Somewhere in the outer four squares of the grid, four holes are drilled that are just big enough for the COAX to go trough. (see the pictures)

Installing the sensor-LEDs
From the top down you can put the COAX-wires with the LEDs on them trough the holes. After you fiddled them in the correct location you connect the top of the four outer COAX-cables with pieces of wire all around. (see picture) This wires will support the sensor-LEDs and it will also connect the cathodes of the four LEDs.
The inner wires of the four COAX-wires will go to four headers going to analog-port 0-1-2-3 of the Arduino and one of the outer cables of the COAX-wires goes to the GND of the Arduino. (All the cathodes are already connected, so we have to take only one ground here)
Be sure that the COAX is not touching some of the other wires, ore use isolation-tape or hot glue or something to prevent this from happening.

Step 12: Finishing Up

Picture of Finishing Up
Finally we are going to finish this cube! We can close the photo cube. One last check to make sure that no wires are touching that are not supposed to touch and than put the headers in the ports of the Arduino!

Upload the following sketch (code) and start experimenting with it.

I hope you will make manny changes and improvements on it and invite you to post them in the comments.



int tijd = 50; // set the speed
int tijdx = 0;

int basis1 = 0;
int basis2 = 0;
int basis3 = 0;
int basis4 = 0;
int sens1 = 0;
int sens2 = 0;
int sens3 = 0;
int sens4 = 0;
int x = 0;
int y = 0;
int totaal1 = 0;
int totaal2 = 0;
int totaal3 = 0;
int totaal4 = 0;

int map1 = 0;
int map2 = 0;
int map3 = 0;
int map4 = 0;

int led0 = 8;
int led1 = 9;
int led2 = 10;
int led3 = 11;
int led4 = 0; // nul
int led5 = 1; // nul
int led6 = 2; // nul
int led7 = 3; // nul
int led8 = 4;
int led9 = 5;
int led10 = 6;
int led11 = 7;


void setup()
{
pinMode(led0, INPUT);
pinMode(led1, INPUT);
pinMode(led2, INPUT);
pinMode(led3, INPUT);
pinMode(led4, INPUT);
pinMode(led5, INPUT);
pinMode(led6, INPUT);
pinMode(led7, INPUT);
pinMode(led8, INPUT);
pinMode(led9, INPUT);
pinMode(led10, INPUT);
pinMode(led11, INPUT);

// Serial.begin(9600);
}


void loop()
{
for(x =0; x < 50; x++)
{
sens1 = analogRead(0);
totaal1 = totaal1 + sens1;
sens2 = analogRead(1);
totaal2 = totaal2 + sens2;
sens3 = analogRead(2);
totaal3 = totaal3 + sens3;
sens4 = analogRead(3);
totaal4 = totaal4 + sens4;
}
sens1 = totaal1/x;
totaal1 = 0;
basis1 = sens1-20; // instellen van de gevoeligheid
sens2 = totaal2/x;
totaal2 = 0;
basis2 = sens2-20;
sens3 = totaal3/x;
totaal3 = 0;
basis3 = sens3-20;
sens4 = totaal4/x;
totaal4 = 0;
basis4 = sens4-20;


for(y=0;y<2000;y++){
for(x =0; x < 30; x++)
{
sens1 = analogRead(0);
sens2 = analogRead(1);
sens3 = analogRead(2);
sens4 = analogRead(3);

totaal1 = totaal1 + sens1;
totaal2 = totaal2 + sens2;
totaal3 = totaal3 + sens3;
totaal4 = totaal4 + sens4;
// delay(10);
}
sens1 = totaal1/x;
sens2 = totaal2/x;
sens3 = totaal3/x;
sens4 = totaal4/x;

if (sens1<basis1){
if (sens1 < ((sens2 + sens3 + sens4)/3))
splash1();
}

if (sens2<basis2){
if (sens2 < ((sens1 + sens3 + sens4)/3))
splash2();
}

if (sens3<basis3){
if (sens3 < ((sens1 + sens2 + sens4)/3))
splash3();
}

if (sens4<basis4){
if (sens4 < ((sens1 + sens3 + sens2)/3))
splash4();
}

totaal1 = 0;
totaal2 = 0;
totaal3 = 0;
totaal4 = 0;
delay(5);

/*
Serial.print(sens1, DEC); Serial.print(" - "); Serial.print(basis1, DEC);
Serial.println();
Serial.print(sens2, DEC); Serial.print(" - "); Serial.print(basis2, DEC);
Serial.println();
Serial.print(sens3, DEC); Serial.print(" - "); Serial.print(basis3, DEC);
Serial.println();
Serial.print(sens4, DEC); Serial.print(" - "); Serial.print(basis4, DEC);
Serial.println(); Serial.println();
*/
}


}

void splash1()
{
a4(); b4(); c4(); d4(); h4(); l4(); p4(); o4(); n4(); m4(); i4(); e4(); f4(); g4(); k4(); j4();
j3(); f3(); g3(); k3(); o3(); n3(); m3(); i3(); e3(); a3(); b3(); c3(); d3(); h3(); l3(); p3();
p2(); o2(); n2(); m2(); i2(); e2(); a2(); b2(); c2(); d2(); h2(); l2(); k2(); j2(); f2(); g2();
g1(); k1(); j1(); f1(); b1(); c1(); d1(); h1(); l1(); p1(); o1(); n1(); m1(); i1(); e1(); a1();
}

void splash2()
{
p4(); o4(); n4(); m4(); l4(); k4(); j4(); i4(); h4(); g4(); f4(); e4(); d4(); c4(); b4(); a4();
a3(); b3(); c3(); d3(); e3(); f3(); g3(); h3(); i3(); j3(); k3(); l3(); m3(); n3(); o3(); p3();
p2(); o2(); n2(); m2(); l2(); k2(); j2(); i2(); h2(); g2(); f2(); e2(); d2(); c2(); b2(); a2();
a1(); b1(); c1(); d1(); e1(); f1(); g1(); h1(); i1(); j1(); k1(); l1(); m1(); n1(); o1(); p1();
uit();
}

void splash3()
{
tijdx = tijd;
tijd = 0;
for (y = 0; y < 5 ; y++)
{
for (x = 0; x < tijdx/4 ; x++)
{
a1(); a2(); a3(); a4(); f1(); f2(); f3(); f4();
}
for (x = 0; x < tijdx/4 ; x++)
{
b1(); b2(); b3(); b4(); f1(); f2(); f3(); f4();
}
for (x = 0; x < tijdx/4 ; x++)
{
c1(); c2(); c3(); c4(); g1(); g2(); g3(); g4();
}
for (x = 0; x < tijdx/4 ; x++)
{
d1(); d2(); d3(); d4(); g1(); g2(); g3(); g4();
}
for (x = 0; x < tijdx/4 ; x++)
{
h1(); h2(); h3(); h4(); g1(); g2(); g3(); g4();
}
for (x = 0; x < tijdx/4 ; x++)
{
l1(); l2(); l3(); l4(); k1(); k2(); k3(); k4();
}
for (x = 0; x < tijdx/4 ; x++)
{
p1(); p2(); p3(); p4(); k1(); k2(); k3(); k4();
}
for (x = 0; x < tijdx/4 ; x++)
{
o1(); o2(); o3(); o4(); k1(); k2(); k3(); k4();
}
for (x = 0; x < tijdx/4 ; x++)
{
n1(); n2(); n3(); n4(); j1(); j2(); j3(); j4();
}
for (x = 0; x < tijdx/4 ; x++)
{
m1(); m2(); m3(); m4(); j1(); j2(); j3(); j4();
}
for (x = 0; x < tijdx/4 ; x++)
{
i1(); i2(); i3(); i4(); j1(); j2(); j3(); j4();
}
for (x = 0; x < tijdx/4 ; x++)
{
e1(); e2(); e3(); e4(); f1(); f2(); f3(); f4();
}
}
tijd = tijdx;
}

void splash4()
{
test();
}

void uit(){
pinMode(led0, INPUT);
pinMode(led1, INPUT);
pinMode(led2, INPUT);
pinMode(led3, INPUT);
pinMode(led4, INPUT);
pinMode(led5, INPUT);
pinMode(led6, INPUT);
pinMode(led7, INPUT);
pinMode(led8, INPUT);
pinMode(led9, INPUT);
pinMode(led10, INPUT);
pinMode(led11, INPUT);
pinMode(14, INPUT);
digitalWrite(14, LOW);
pinMode(15, INPUT);
digitalWrite(15, LOW);
pinMode(16, INPUT);
digitalWrite(16, LOW);
pinMode(17, INPUT);
digitalWrite(17, LOW);
}

void a1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void b1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void c1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void d1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void e1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void f1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void g1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void h1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void i1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void j1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void k1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void l1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void m1(){
pinMode(led0, OUTPUT);
digitalWrite(led0, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void n1(){
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void o1(){
pinMode(led2, OUTPUT);
digitalWrite(led2, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void p1(){
pinMode(led3, OUTPUT);
digitalWrite(led3, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void a2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void b2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void c2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void d2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void e2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void f2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void g2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void h2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void i2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void j2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void k2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void l2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void m2(){
pinMode(led0, OUTPUT);
digitalWrite(led0, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void n2(){
pinMode(led1, OUTPUT);
digitalWrite(led1, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void o2(){
pinMode(led2, OUTPUT);
digitalWrite(led2, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void p2(){
pinMode(led3, OUTPUT);
digitalWrite(led3, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void a3(){
pinMode(led8, OUTPUT);
digitalWrite(led8, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void b3(){
pinMode(led9, OUTPUT);
digitalWrite(led9, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void c3(){
pinMode(led10, OUTPUT);
digitalWrite(led10, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void d3(){
pinMode(led11, OUTPUT);
digitalWrite(led11, LOW);
pinMode(led4, OUTPUT);
digitalWrite(led4, HIGH);
delay (tijd);
uit();
}

void e3(){
pinMode(led8, OUTPUT);
digitalWrite(led8, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void f3(){
pinMode(led9, OUTPUT);
digitalWrite(led9, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void g3(){
pinMode(led10, OUTPUT);
digitalWrite(led10, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void h3(){
pinMode(led11, OUTPUT);
digitalWrite(led11, LOW);
pinMode(led5, OUTPUT);
digitalWrite(led5, HIGH);
delay (tijd);
uit();
}

void i3(){
pinMode(led8, OUTPUT);
digitalWrite(led8, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void j3(){
pinMode(led9, OUTPUT);
digitalWrite(led9, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void k3(){
pinMode(led10, OUTPUT);
digitalWrite(led10, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void l3(){
pinMode(led11, OUTPUT);
digitalWrite(led11, LOW);
pinMode(led6, OUTPUT);
digitalWrite(led6, HIGH);
delay (tijd);
uit();
}

void m3(){
pinMode(led8, OUTPUT);
digitalWrite(led8, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void n3(){
pinMode(led9, OUTPUT);
digitalWrite(led9, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void o3(){
pinMode(led10, OUTPUT);
digitalWrite(led10, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);
delay (tijd);
uit();
}

void p3(){
pinMode(led11, OUTPUT);
digitalWrite(led11, LOW);
pinMode(led7, OUTPUT);
digitalWrite(led7, HIGH);

uit();
}

void a4(){
digitalWrite(14, HIGH);
pinMode(14, OUTPUT);
digitalWrite(14, HIGH);
delay (tijd);
uit();

}

void b4(){
pinMode(led9, OUTPUT);
digitalWrite(led9, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void c4(){
pinMode(led10, OUTPUT);
digitalWrite(led10, HIGH);
pinMode(led4, OUTPUT);
digitalWrite(led4, LOW);
delay (tijd);
uit();
}

void d4(){
digitalWrite(15, HIGH);
pinMode(15, OUTPUT);
digitalWrite(15, HIGH);
delay (tijd);
uit();
}

void e4(){
pinMode(led8, OUTPUT);
digitalWrite(led8, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void f4(){
pinMode(led9, OUTPUT);
digitalWrite(led9, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void g4(){
pinMode(led10, OUTPUT);
digitalWrite(led10, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void h4(){
pinMode(led11, OUTPUT);
digitalWrite(led11, HIGH);
pinMode(led5, OUTPUT);
digitalWrite(led5, LOW);
delay (tijd);
uit();
}

void i4(){
pinMode(led8, OUTPUT);
digitalWrite(led8, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void j4(){
pinMode(led9, OUTPUT);
digitalWrite(led9, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void k4(){
pinMode(led10, OUTPUT);
digitalWrite(led10, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void l4(){
pinMode(led11, OUTPUT);
digitalWrite(led11, HIGH);
pinMode(led6, OUTPUT);
digitalWrite(led6, LOW);
delay (tijd);
uit();
}

void m4(){
digitalWrite(17, HIGH);
pinMode(17, OUTPUT);
digitalWrite(17, HIGH);
delay (tijd);
uit();
}

void n4(){
pinMode(led9, OUTPUT);
digitalWrite(led9, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void o4(){
pinMode(led10, OUTPUT);
digitalWrite(led10, HIGH);
pinMode(led7, OUTPUT);
digitalWrite(led7, LOW);
delay (tijd);
uit();
}

void p4(){
digitalWrite(16, HIGH);
pinMode(16, OUTPUT);
digitalWrite(16, HIGH);
delay (tijd);
uit();
}



void test(){
pinMode(led0, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, INPUT);
pinMode(led9, INPUT);
pinMode(led10, INPUT);
pinMode(led11, INPUT);

digitalWrite(led0, LOW);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);

digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
delay (tijd*4);

digitalWrite(led0, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd*4);

pinMode(led0, INPUT);
pinMode(led1, INPUT);
pinMode(led2, INPUT);
pinMode(led3, INPUT);
pinMode(led8, OUTPUT);
pinMode(led9, OUTPUT);
pinMode(led10, OUTPUT);
pinMode(led11, OUTPUT);

digitalWrite(led8, LOW);
digitalWrite(led9, LOW);
digitalWrite(led10, LOW);
digitalWrite(led11, LOW);

digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
delay (tijd*4);

digitalWrite(led8, HIGH);
digitalWrite(led9, HIGH);
digitalWrite(led10, HIGH);
digitalWrite(led11, HIGH);

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
delay (tijd*4);
uit();

}  

Step 13: Tinkering the Code

This appendix is some explanation about the code, so just read this part if you want to change (or understand) the code.

I broke the code up in lots of parts. These parts are called "void" and you can call them from the loop (who is also a void).
In this way I hoped to make the code easy to play with. So on every sensor, the code goes to an other "void".
If sensor 1 is the darkest the loop goes to a void called: "splash1". With sensor 2 to splash2, 3 to splash3 and 4 to splash4.

These void tells the cube that LEDs to light up.
To make it even easier, I gave each and every LED its own void. Now I don't need to write the piece of program to light a LED every time I need to light one, I can just call the void that does that and than wait a little while and turn it off again.

To make it a little bit understandable, I tried to put some logic in the names of the voids that light the LEDs.
All the LEDs on the first layer end with 1, the second layer ends with 2, third with 3 and fourth with 4. They all start with a letter, from a to p. (16 for every layer)

Lets see some code:

void splash1()
   {
   a4(); b4(); c4(); d4(); h4(); l4(); p4(); o4(); n4(); m4(); i4(); e4(); f4(); g4(); k4(); j4();
   j3(); f3(); g3(); k3(); o3(); n3(); m3(); i3(); e3(); a3(); b3(); c3(); d3(); h3(); l3(); p3();
   p2(); o2(); n2(); m2(); i2(); e2(); a2(); b2(); c2(); d2(); h2(); l2(); k2(); j2(); f2(); g2();
   g1(); k1(); j1(); f1(); b1(); c1(); d1(); h1(); l1(); p1(); o1(); n1(); m1(); i1(); e1(); a1();
   }

It is very clear to see here that it lights first all the LEDs on the fourth layer, one by one, next the third, the second and the first.
To understand the order of the LEDs, you need to know what each letter is:

  a  b  c  d
  e  f  g  h
  i  j  k  l
  m  n  o  p

I think this makes it a lot clearer. I think you can see what "splash" this is if you see the video.

So if you want that if you put your hand above sensor one, just the top left LED lights up, than the void would look like this:

void splash1()
   {
   a4(); 
   }

I hope this clarifies the code a little.

Comments

dtidbeaux (author)2014-01-20

i think i may have soldered the third layer down to the second layer incorrectly. i soldered the anodes of the third layer to the cathodes of the second. That meant i had to turn the third layer 90 degrees clockwise instead of counter clockwise as your instructions say. I'm not sure what i did wrong

kenyer (author)dtidbeaux2014-01-20

That could mess up the patterns a little (what you could fix in the sketch) but they should still light up correctly. So there must be something else...

dtidbeaux (author)2014-01-20

I double checked polarity. Everything seems correct. double checked resisters. Using 100 ohm as per led calculator for 3v@20mah leds at 5v+. Every led is functioning at some point. i can't seem to figure it out:/

dtidbeaux (author)2014-01-19

Very informative instructable. I'm trying to duplicate your work here. I've finished the cube as far as i can tell, but the top 2 layers only light up to half of the brightness and do not seem to follow the rest of the patterns of the first 2 layers. I've double checked everything i can think of (anode touching cathode, wire disconnected, short... ) im still new to arduino so any help would be appreciated

kenyer (author)dtidbeaux2014-01-19

I can't think of any reason that would happen except the things you already checked. You could check the values of your resistors and the polarity of the LED's although I don't really think that would be it. When I think of something smarter I will let you know.
Sorry I can't be of better assistance at this moment.

pgautam1 (author)2013-09-01

sir ,i am just starting the project so please help about which arduino should i buy (which type,name,code)or any.
plzz reply

kenyer (author)pgautam12013-09-01

Any Arduino board would work, but to start with I would choose the UNO or leonardo. The (old) Duemilanove would also work fine.
I would advise you to start with some simple playing with LED's and sensors before you try this more complex LED-cube. Adafruit (http://www.adafruit.com) and Oomlout (http://www.oomlout.com) have some great tutorials.
If you have already some electronics experience and you understand what multiplexing and charlyplexing is about, this project will not be a problem for you.
Have fun!

pgautam1 (author)kenyer2013-09-13

ya i have done some led project in clg,so m trying this one.
I m not understanding the concept of top corner four sensors led n how are its connection so plz help me out with it and m using blue led for 1st &4th layer and green for 2nd &3rd layer let me know weather its ok or not.
n thanks for previous reply

kenyer (author)pgautam12013-09-13

The color you use is up to you. Just be sure to use the right resistors to go with your LED's.
It might help to look at this ible to understand the tot corner LED's: https://www.instructables.com/id/LED-as-lightsensor-on-the-arduino/
This YouTube clip might also be helpful:
http://www.youtube.com/watch?v=lzh4xMi0l2Y

pgautam1 (author)kenyer2013-09-18

i just completed my cube but the problem is,when the rotational function comes the LED's become very dim n the fourth layer is also not glowing.i used 560ohm resister let me know weather its correct for green n blue led or not.
i under stood the sensor part Thanks for that...

kenyer (author)pgautam12013-09-18

The resistor can be different for every type and brand of LED. If you can find a datasheet with your LED's, this might help. Otherwise just ask your supplier what resistor should go with your LED's for a 5 volt supply.

pgautam1 (author)kenyer2013-09-19

Thanks,I got my fourth layer on but still the rotational function is very dim n not at all clear

pgautam1 (author)pgautam12013-09-20

can u plzz suggest me about my question,i have almost completed the project

kenyer (author)pgautam12013-09-20

The only thing I can think of is that you use the wrong resistor. The LED's will never be in full brightness because they are not burning full time but blinking very fast. (faster then the eye can see) but they should not burn dim.

pgautam1 (author)kenyer2013-09-21

ok...thanks for your suggestion n help throught the working.
comment:keep making and sharing such innovative things ;):)

White-Tea (author)2013-09-18

Hi, thank you very much for your great tutorial. As promised a link to my finished Cube:
http://www.youtube.com/watch?v=ibefYhN5asE

kenyer (author)White-Tea2013-09-18

Super cool!

White-Tea (author)2013-07-27

(I'm also having problems with the captcha and replying, sorry)

I finished it now, but the problem with the LEDs in the second row always lightly burning still exists... If you have any idea about that I'll be gratefull.

I also had to change the portnumbers and some other things in the code because I think I did things slightly different.

Now I'm working on 3D snake code :) I'll post a video link when it's done.

Thanks very much for your instructions

White-Tea (author)2013-07-08

also, "only the inner two cathodes (short leads) need to be bended upwards" isn't very clear to me. Which inner two?

Thanks in advance

kenyer (author)White-Tea2013-07-27

Where are you in the build? What step?

Userr12345 (author)2013-01-14

No it's not , want me to post a picture?
Ps: sorry but for some reason it won't let me reply

kenyer (author)Userr123452013-01-14

Yes, a picture might be helpful.

Userr12345 (author)2013-01-10

also i have another question, i dont know if you are going to know this but with my arduino uno came a nother board that mounts on top of the arduino with the arduino ports. do you know what that board is for or if i should even use it? i tried serching for it on the internet but couldnt find anything

kenyer (author)Userr123452013-01-10

Could it be a protoshield? http://arduino.cc/en/Main/ArduinoProtoShield

Userr12345 (author)2013-01-08

i did the first two layers succesfull, but im having trouble with the 3rd and 4th.
i dont quite understand what you mean by the corner LED's.
on mine i didnt finish reading the instructions so i did the 4th layer like i did the first one. How can i fix this and how to i hook it up properly

kenyer (author)Userr123452013-01-09

When you didn't leave out the top corner led's, you will end up with a normal 4x4x4 LED-cube without the interactivity aspect of it. If you do want the interactivity, you will need to desolder the corner led's and resume as instructed. The four top corner led's need to be totally separate from the rest of the cube.

stringstretcher (author)2012-11-15

Hmmm... I have a 3x3x3, but this looks so good I may have to make one! Great instructions. Thanks!

fallenheart (author)2012-11-03

is there something besides COAX wire you can use? something like maybe speaker/lead wire?

kenyer (author)fallenheart2012-11-04

The wire needs to be shielded in some way to work. The signal from the LED is very weak and easily disturbed.

jimdsouza (author)2012-10-26

Could you tell me the music you used in your final video?

kenyer (author)jimdsouza2012-10-26

I just used one of the tunes Youtube provides.

fallenheart (author)2012-10-15

What are the dimensions of just the led cube part?

kenyer (author)fallenheart2012-10-16

The distance between the LED's is 12,5 mm, so the cube is approximately 40 x 40 x 60 mm.

fallenheart (author)kenyer2012-10-16

oh that's perfect thanks!

zealroy (author)2012-08-06

thanks a lot kenyer. I am now half-way on finishing the project. your work really appreciated specially the codes.

Questions: If i want to replace the 4 LED sensor and replace it by a switch, how would i write the code. I mean where would i start?...

kenyer (author)zealroy2012-08-09

Hi Zealroy,

If you leave out the sensors, it will make your code much easier. You can delete everything in the void loop() and replace it by code that will test your button(s) and then calls one of the four splash voids.

I hope this was helpful for you

mrwicked (author)2012-06-27

Alright here is the finished product, as promised.

kenyer (author)mrwicked2012-06-27

WOW really nice! I like the nice box for the electronics.

mrwicked (author)kenyer2012-06-28

Thank you, I bought the wood at micheals and built, sanded and stained it.
I am impressed with the finished product, now I need to attempt a larger cube!

mrwicked (author)2012-06-23

So I just completed this cube and I did it without the sensors,
I did layer one as described, layer two charlieplexed with layer 1, layer 3 i have the anodes of layer 3 bent down and soldered with the cathodes of layer 2, and i have the cathodes of layer 3 soldered to the anodes of layer 4.


I have the code uploaded to the arduino, and it seems to be working, well the bottom two layers work fine, the top 2 layers, are half working? the leds are very dim and dont seem to follow the pattern expected. I may have mis soldered layer 2-3 im not sure any idea?

mrwicked (author)mrwicked2012-06-23

Turns out the pin zero on my arduino is shorted, i moved them all over one pin and made the adjustments and it works great!

kenyer (author)mrwicked2012-06-24

Cool to hear that it works. I'm curious how it turned out. Can you post a picture?

gibsoncrazed14 (author)2012-04-14

I'm brand new with arduino and i was curious to how you would upload the code on to it? any help will be appreciated. Also great work.
- Thanks

kenyer (author)gibsoncrazed142012-04-14

Hi,
That is really easy. You just need to download the free software from www.arduino.cc (for windows, mac or linux) and you can write your code in this program and push "play" to send it trough a USB-cable to your Arduino.

gibsoncrazed14 (author)kenyer2012-04-18

Thank you so much. i know this was a simple question but like i said i'm brand new with arduino
-Thanks

cvenko (author)2012-04-10

Question...
If i want to remove "sensors" LEDs and make normal LED cube, what would i have to change? Would it work if i just solder 4 corner LEDs like the others are and then solder them to third layer as the rest are? And then i do little reprograming?
BTW i already build first 3 layers and it works like a charm...:D

Thanks

kenyer (author)cvenko2012-04-10

Hi Cvenko,

Yes if you just solder the corners in like the rest, you will have a "normal" 4x4x4 LED-cube.
Will you show the result?

Peter

cvenko (author)kenyer2012-04-10

waw... Thanks for quick reply...

For now only layers 1 and 2 are working correctly... the 3 and 4 are behaving wierd... I will need to check if soldering was done correctly... But tomorrow;)

I will show result when the project is finished...

Thanks again

argentinoloco87 (author)2012-02-28

hey. i am trying to finish the first layer, but i cant seem to get the wiring right to go to the arduino. is there any way you could post a picture?
thanks

ch2s (author)2011-12-07

Hi Kenyer,
Can you explain why the void setup - PinMode have to set to INPUT?? Thanks :)

About This Instructable

82,125views

158favorites

License:

Bio: I'm a social-worker, working with 12 - 23 year-olds. I used to be a printer and I worked voluntarily in Romania for a couple of ... More »
More by kenyer:Fidget Spinner Box PuckEthereum Mining RigStop Motion Puppet Armature
Add instructable to: