Project tutorial
4x4x4 LED cube with Arduino Uno and 1sheeld

4x4x4 LED cube with Arduino Uno and 1sheeld © GPL3+

Using the microphone of your mobile phone to control the led cube according to the loudness (decibels).

  • 31,375 views
  • 7 comments
  • 61 respects

Components and supplies

About this project

This is an amazing 4x4x4 LED cube connected to your smartphone using the 1sheeld and arduino uno. Let the music control ...


How to construct the LED cube:

Follow this instructable to construct the LED cube. You only need step 3, step 4 and step 5. You need to have some basic soldering knowledge.

http://www.instructables.com/id/LED-Cube-4x4x4/

**You will not need the components in the instructable. for the needed components refer to the components list below.


Theory of operation:

Running a wire to the anode of each led is obviously impractical.
One possible solution is to split the cube into 4 layers, each layer consists of 16 LEDs.
All the LEDs in a vertical column share a common anode (+).
All the LEDs on a horizontal layer share a common cathode (-).
In order to light up a specific LED, just supply GND (-) to the layer which contains that LED and then supply 5V (+) to the column which contains that LED. 


Wiring:

After constructing the cube, you should have 16 pins to control the columns and 4 pins to control the layers.

Ω-Connect each column control pin to a 220Ω resistor in series, the other terminal of the resistor is connected to the 1sheeld mounted over the arduino board.

*** I tried connecting the wires directly to the 1sheeld & arduino without resistors and it actually worked, but it is not recommended. 

*The column control pins are connected in order to digital pins from 13 to 0 and analog pins A4 & A5. (Refer to the diagram)

*Each pin control thee LEDs in that column, so you are free to connect the columns with any combination.

-Connect the layer control pins to analog pins A0, A1, A2 & A3.

*According to my code, the lower layer is connected to pin A0, then the next layer is connected to pin A1, then the next layer is connected to pin A2 and the highest layer is connected to pin A3. (Refer to the diagram)

-After connecting the wires to the 1sheeld and arduino, you can now upload the code and then connect your smart phone to the 1sheeld.

*If you are not familiar with 1sheeld you can follow this tutorial first.

http://1sheeld.com/tutorials/getting-started/







Code

Untitled fileArduino
/*

This code uses 1Sheeld and an arduino Uno board to control a 4x4x4 LED matrix using 
  the microphone of your smart phone.
 
 The circuit:
 * 64 LEDs form a 4x4x4 cube connected with the 1Sheeld and arduino board  
 * The coloumns control pins are connected to digital pins  0 to 13 and analogue pins 
     A4 and A5
 * The layers control pins are connected to analouge pins  A0 to A3.   
 
 
 by Hassan Ibrahim

*/
  
   
#define CUSTOM_SETTINGS
#define INCLUDE_PUSH_BUTTON_SHIELD
#define INCLUDE_MIC_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>
 

// Define the pin connections of the LED matrix (columns and layer).
// Refer to the tutorial for more illustration.
int coloumn13 = 13;     // coloumn13 means the coloumn connected to pin 13 on the arduino board 
int coloumn12 = 12;
int coloumn11 = 11;
int coloumn10 = 10;
int coloumn9 = 9;
int coloumn8 = 8;
int coloumn7 = 7;
int coloumn6 = 6;
int coloumn5 = 5;
int coloumn4 = 4;
int coloumn3 = 3;
int coloumn2 = 2;
int coloumn1 = 1;
int coloumn0 = 0;
int coloumnA4 = A4;
int coloumnA5 = A5;

int layerA0 = A0;      // layerA0 means the layer connected to analogue pin A0 on the arduino (The lowest layer in this example)
int layerA1 = A1;      // * The names are chosen this way in order to ease modification
int layerA2 = A2;
int layerA3 = A3;

int counter;   // used to make variations in the coloumns

// the setup routine runs once when you press reset:
void setup() {                
  // Start communication. 
    OneSheeld.begin();
    Serial.begin(115200);
 // initialize each pin as an output. 
    pinMode(coloumn0, OUTPUT);
    pinMode(coloumn1, OUTPUT);
    pinMode(coloumn2, OUTPUT);
    pinMode(coloumn3, OUTPUT);
    pinMode(coloumn4, OUTPUT);
    pinMode(coloumn5, OUTPUT);
    pinMode(coloumn6, OUTPUT);
    pinMode(coloumn7, OUTPUT);
    pinMode(coloumn8, OUTPUT);
    pinMode(coloumn9, OUTPUT);
    pinMode(coloumn10, OUTPUT);
    pinMode(coloumn11, OUTPUT);
    pinMode(coloumn12, OUTPUT);
    pinMode(coloumn13, OUTPUT);
    pinMode(coloumnA4, OUTPUT);
    pinMode(coloumnA5, OUTPUT);
    pinMode(layerA0, OUTPUT);
    pinMode(layerA1, OUTPUT);
    pinMode(layerA2, OUTPUT);
    pinMode(layerA3, OUTPUT);
}   // end of setup



// the loop routine runs over and over again forever:
void loop() {
  
  // all coloumns are connected to 5v (high).
    digitalWrite(coloumn0,HIGH);
    digitalWrite(coloumn1,HIGH);
    digitalWrite(coloumn2,HIGH);
    digitalWrite(coloumn3,HIGH);
    digitalWrite(coloumn4,HIGH);
    digitalWrite(coloumn5,HIGH);
    digitalWrite(coloumn6,HIGH);
    digitalWrite(coloumn7,HIGH);
    digitalWrite(coloumn8,HIGH);
    digitalWrite(coloumn9,HIGH);
    digitalWrite(coloumn10,HIGH);
    digitalWrite(coloumn11,HIGH);
    digitalWrite(coloumn12,HIGH);
    digitalWrite(coloumn13,HIGH);
    digitalWrite(coloumnA4,HIGH);
    digitalWrite(coloumnA5,HIGH);
    delay(30);

    
    // Get the noise level from the mic and control which layers to be connected to 0v (low).
    // Each if-else block controls one layer.
    // The values should be calibrated according to your mobile phone.
    /* 
         To calibrate, play any sort of music near your smart phone and watch the            readings of the Mic shield and choose appropriate values.
    */
    // In this example, steps of 6 give good results
     
     if( Mic.getValue() > 70 )  // first layer control
      { 
          digitalWrite(layerA0, LOW);
            delay(50);                 // To make the display clearer. It could be modified to make if faster or slower.
      }
      else 
      {
        digitalWrite(layerA0, HIGH);
      }
       
      if( Mic.getValue() > 76 )   // second layer control
      { 
          digitalWrite(layerA1, LOW);
            delay(50);
      }
      else 
      {
        digitalWrite(layerA1, HIGH);
      }
      
       if(   Mic.getValue() > 82 )   // third layer control
      { 
          digitalWrite(layerA2, LOW);
            delay(50);
      }
      else 
      {
        digitalWrite(layerA2, HIGH);
      }
      
       if(   Mic.getValue() > 88 )   // fourth layer control
      { 
          digitalWrite(layerA3, LOW);
            delay(50);
      }
      else 
      {
        digitalWrite(layerA3, HIGH);
      }
    
  
  } // end of loop
  
 
    
LED cube with 1sheeld (Mic shield)

Schematics

Follow the colors
This image doesn't contain the resistors.
Led%20cube

Comments

Similar projects you might like

Controlled Board Eraser using Arduino and 1Sheeld

Project in progress by Mahmoud Ayad

  • 7,659 views
  • 3 comments
  • 32 respects

LED Cube

Project tutorial by Praditha Alwis

  • 5,050 views
  • 0 comments
  • 12 respects

Control a RGB Led using Arduino and a smartphone's camera

Project tutorial by Mr robot Maker

  • 2,649 views
  • 0 comments
  • 8 respects

Interactive 4x4x4 LED cube

Project tutorial by Tong Xin Hua

  • 1,954 views
  • 0 comments
  • 0 respects

Led fading using 1Sheeld

Project tutorial by Nado Hollow

  • 722 views
  • 1 comment
  • 2 respects

Control your light system with your voice

Project tutorial by Maha Raafat

  • 35,648 views
  • 22 comments
  • 155 respects
Add projectSign up / Login