loading
LED-Tower "Hello", Vu-Meter Advanced Sensing Music without IC`s only with Ardurino
and Interfacing with PC Windows Software!  

  
   Hi, Everybody.
  
What makes this project that cool is the fact, that its sensing music, unlike traditional
VU-Meter`s or Equalizer wich indicates the Level of Incoming Sound by Switching LED`s On,
My LED Tower, looks like it knows when the break or drop or what ever in the song is comnming.

The Bigger Lights i build in, only gets on when the music getting more intensiv.
with Serial Monitor i Managed to Write a Windows App, that Controls Ardurino, Needet to use the
hole Tower as Main Light for my Living room.


Check out here :
 
 
What you Need (Full Version):

  - Ardurino Mega(Atmega1280)
  - 24 X Blue LED`s
  - 14 X White LED`s
  -  5 X Multicolor LED`s
  -  2 X Green LED`s
  -  2 X Bi-Color(Red/Blue) LED`s
  -  2 X 40 Watt Lamps
  -  2 X 12 Volt LED-Spot`s LED`s
  -  2 X 5 Volt Relay
  -  1 X SMD Red Matrix
  - 45 X 220 Ohm Resistors
  - Wire
  - 1 X 3,5 Audio Jack
  - 1 X A Styropor or plexiglass body

What you Need (Basic Version):

  - Any Ardurino Mikrocontroller with X Pins!
  - X LED`s
  - X 220 Ohm Resistors
  - Wire
  - 3,5 Audio Jack
  - A Styropor or plexiglass body

Please check out the pictures :

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/01.JPG

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/02.JPG

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/03.JPG

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/04.JPG

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/05.JPG

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/software.JPG

https://dl.dropbox.com/u/3917871/pix/ledtut/Neuer%20Ordner/06.JPG


How it Works ?

If u ever made music yourself you, know about the lengths of standart music pattern, and
thats the key to this, by counting up variables and compering them.(like 16,32,64,128,256,512 etc...)



Step 1 :

- Drill Holes in your Styropor or plexiglass body.
- Place your LEDS Like You Want.


  Step 2 :

- Wire your LEDs with resistors and connect them to any free pin on your ardurino!.
- connect a couple of LEDS with pwm pins
- Test your LEDs with the Basic "Blink-Sketch"


   Step 3 :

- connect a analog pin with the audio jack and your Audio source
  - Test IT with the Basic "AnalogRead-Sketch"


   Step 4 :

   open ardurino software to programm it.

upload this code and edit the Arrays with your pins, and the count of pins to the var. 

  
/*
https://dl.dropbox.com/u/3917871/ardurino/LEDTOWER.exe
*/

// pin that the sensor is attached to   analog 14 in my case                                              
const int sensorPin = A14;  

// the 3 Main Array`s with LED pins
const int ALLLEDS[] =    {
  6,22,8,26,53,24,48,10,5,42,31,32,33,23,25,9,27,7,44,12,50,34};
const int notPWMLEDS[] = {
  22,26,53,24,5,42,31,32,33,23,25,27,50,34}; 
const int pwmLEDS[] =    {
  6,8,5,9,44,10,7,12,48};

// These are the number of LED Attaced to the 3 Array`s
const int pwmCOUNT     = 9;       
const int ALLCOUNT     = 22;  
const int notPWMCOUNT  = 15;   

// These are the Special Highlihts connected with a relay
const int relayCh1    = 14;   // 2 X 40 Watt Lamps
const int relayCh2    = 15;   // 2 X 12 Volt LED-Spot`s LED`s
const int relayCh3    = 17;    //licht 3

// variables:
int incomingByte,jaodernein,schleifeEins,schleifeZwei,schleifeDrei,sensorMax,sensorValue,AudioIn,LANGERdelay,DelayValue,counterNull,counterEins,counterZwei,counterDrei,counterVier,counterFunf,counterSechs,counterSieben,nextLED,updown,thisPin = 0;         // the sensor value
int sensorMin = 1023;        // minimum sensor value

void setup() {
  // Configures the reference voltage used for analog input
  analogReference(INTERNAL1V1);
  Serial.begin(9600);
  Serial.println("LED TOWER 'Hello' BY Mhonolog v: 13.5");

  pinMode(relayCh1, OUTPUT); 
  pinMode(relayCh2, OUTPUT); 
  pinMode(relayCh3, OUTPUT);    
  pinMode(48, OUTPUT); 
  for (thisPin = 0; thisPin < ALLCOUNT; thisPin++){
    pinMode(ALLLEDS[thisPin], OUTPUT);     
  } 
  Serial.println("calibrateing...");
  digitalWrite(7, HIGH);
  while (millis() < 5000) {
    sensorValue = analogRead(sensorPin);
    if (sensorValue > sensorMax) {
      sensorMax = sensorValue;
    }
    if (sensorValue < sensorMin) {
      sensorMin = sensorValue;
    }
  }
  Serial.print("set new min to: ");
  Serial.print(sensorMin);
  Serial.print("\t set new max to: ");
  Serial.println(sensorMax);
  digitalWrite(7, LOW);
}

void loop(){
  startstop();
  if (jaodernein == 1){
    ReadIt();
    MainCounter();
  }
}

// This waits for a Serial Command. You Can Type in your Serial Monitor Console or use my Software
// Commands :
//            A : for Start
//            E : for Stop
//            L : Lights On
//            K : Lights OFF
//
// if you not want to use this replace "void-loop" with :
/*
void loop(){
ReadIt();
MainCounter();
}
*/
void startstop(){
  if (Serial.available() > 0) {
    // read the oldest byte in the //Serial buffer:
    incomingByte = Serial.read();
    if (incomingByte == 'A') { // Anfang
      jaodernein = 1;
      Serial.println("Starte Visualisierung...");  
    }
    if (incomingByte == 'E') {   //  Ende
      AllLedsOFF();
      jaodernein = 0;
      Serial.println("Stoppe Visualisierung..."); 
    }
    if (incomingByte == 'L') {   //  Nur Lampe
      jaodernein = 0;
      digitalWrite(relayCh3, HIGH);

      digitalWrite(relayCh2, HIGH);
      Serial.println("Licht An..."); 
    }
    if (incomingByte == 'K') {   // Keine Lampe
      jaodernein = 0;
      digitalWrite(relayCh3, LOW);
      digitalWrite(relayCh2, LOW);
      Serial.println("Licht Aus...");   
    }
  }
}

void ReadIt(){
  AudioIn = analogRead(sensorPin);
  if (AudioIn > sensorMax) {
    sensorMax = AudioIn;
  }
  if (AudioIn < sensorMin) {
    sensorMin = AudioIn;
  }
  AudioIn = map(AudioIn, sensorMin,1023 , 0, sensorMax);
  sensorValue = map(AudioIn, sensorMin, sensorMax, 0, 255);
  sensorValue = constrain(sensorValue, 0, 255);
  DelayValue = map(AudioIn, sensorMin, sensorMax, (AudioIn*3)/100,(AudioIn*10)/100);
}

void MainCounter(){
  if (AudioIn == 0 || AudioIn < 50){
    AllLedsOFF();
    counterNull--;
    counterEins--;
  }
  else
  {
    if (updown == 0){
      nextLED++;
    }
    if (updown == 1){  
      nextLED--;
    }
    if (AudioIn > 50 & AudioIn < 100){
      counterEins = counterEins+2;
      counterNull--;
      counterZwei++;
      counterDrei++;        
    } 
    if (AudioIn > 100 & AudioIn < 200){
      counterVier++;  
    } 
    if (AudioIn > 200 & AudioIn < 300){
      counterFunf++;
    }           
    if (AudioIn > 400 & AudioIn < 500){
      counterSieben--; 
    }
    if (AudioIn > 500 & AudioIn < 700){
      counterSieben = counterSieben+3;
    }
    if (AudioIn > 707){
      // digitalWrite(48, LOW);
    }


    if (AudioIn < 200 & (counterFunf > counterVier) & (counterSechs < counterFunf) & (counterVier < counterDrei) || (schleifeEins < schleifeZwei & schleifeEins < schleifeDrei)){
      schleifeEins++;
      // digitalWrite(notPWMLEDS[counterFunf], HIGH);  

      //    analogWrite(pwmLEDS[6], sensorValue);
      //  digitalWrite(pwmLEDS[6], HIGH);
      digitalWrite(48, LOW);
      digitalWrite(ALLLEDS[nextLED], HIGH);
      if ((AudioIn > 333) & (counterNull == -64 || counterNull == -32)){
        counterSieben = 0;
        digitalWrite(relayCh2,HIGH);
        counterSieben = 0;
        LANGERdelay = 1;
      }
      else {
        LANGERdelay = 0;
      }

      if (LANGERdelay == 0) {
        // delay(DelayValue*2); 
        delay(DelayValue); 
      }
      else {
        delay(64+DelayValue); 
        LANGERdelay = 0;
      }
    }   


    if ((counterFunf > counterVier || counterFunf < counterVier)  || (schleifeZwei < schleifeEins & schleifeZwei < schleifeDrei)){
      schleifeZwei++;
      //   digitalWrite(notPWMLEDS[counterFunf], HIGH);  
      //      digitalWrite(ALLLEDS[1], HIGH);  
      analogWrite(pwmLEDS[counterSechs], sensorValue);
      for (thisPin = sensorValue; thisPin > 0; thisPin--){ 
        sensorValue = sensorValue-5;   
      }

      if ((AudioIn > 333) & (counterNull == -64 || counterNull == -16)){
        counterSieben = 0;
        digitalWrite(relayCh1,HIGH);
        LANGERdelay = 1;
      }
      else {
        LANGERdelay = 0;
      }

      if (LANGERdelay == 0) {
        delay(DelayValue); 
      }
      else {
        delay(64+DelayValue); 
        LANGERdelay = 0;
      }
    }

    if ((AudioIn > 200) &(counterNull < counterEins) & (counterSechs < counterFunf) & (counterVier < counterDrei)|| (schleifeDrei < schleifeEins & schleifeDrei < schleifeZwei)){
      digitalWrite(notPWMLEDS[counterFunf], HIGH);
      schleifeDrei++; 
      //     digitalWrite(ALLLEDS[2], HIGH);  
      //      digitalWrite(48, HIGH);
      //         digitalWrite(pwmLEDS[6], LOW);
      //      for (thisPin = 0;thisPin       //      digitalWrite(notPWMLEDS[thisPin], HIGH);
      //      delay(DelayValue);
      //      digitalWrite(notPWMLEDS[thisPin], LOW); 

      //     }
      if ((AudioIn > 333) & (counterNull == -64 || counterNull == -8)){
        counterSieben = 0;
        digitalWrite(relayCh3,HIGH);
        LANGERdelay = 1;
      }
      else {
        LANGERdelay = 0;
      }

      if (LANGERdelay == 0) {
        delay(DelayValue); 
      }
      else {
        delay(64+DelayValue); 
        LANGERdelay = 0;
      }
    }

    if (nextLED >= ALLCOUNT){
      updown =1;
    }
    else if (nextLED <= 0){
      updown =0;
    }
    if (counterZwei > 256){
      counterSechs++; 
      counterZwei = 0;
    }
    if (counterDrei > 512){
      counterDrei = 0;
      schleifeEins = 0;
      schleifeZwei = 0;
      schleifeDrei = 0;
      //    digitalWrite(pwmLEDS[6], HIGH);

    }
    if (counterVier > 32){
      counterVier = 0;
      sensorMax = 0;
      //         digitalWrite(48, HIGH);

    }   
    if (counterFunf >= notPWMCOUNT){
      counterFunf = 0;
    }   
    if (counterSechs >= pwmCOUNT){
      counterSechs = 0;
    } 
    if (counterNull >= 64 || counterEins >= 64 || counterNull <= -64 || counterEins <= -64 ){
      counterNull = 0;
      counterEins = 0;
    }   
  }
}
void AllLedsOFF(){ 
  digitalWrite(relayCh1, LOW);  
  digitalWrite(relayCh2, LOW);
  digitalWrite(relayCh3, LOW);

  for (thisPin = 0; thisPin < ALLCOUNT; thisPin++){  // initialize All in one loop
    digitalWrite(ALLLEDS[thisPin], LOW);   
  }
}
How much did the full version cost? <br>Otherwise, if I only have an Arduino Uno, Would the code have to be modified? <br>And whats the maximum I could do with it? <br>But how much did yours cost, and how much do you think one using only an arduino uno cost (without the cost of the arduino)
Hi schumi, <br> <br>the full version is about : <br>15 &acirc;‚&not; for an ardurino mega / or Hongkong Copy @ ebay <br>10 &acirc;‚&not; for a 5 volt relay, <br> <br>thats almost the lowest price if you find everything cheap, the other parts i get from trash stuff. <br> <br>For your Arduino Uno,u have to just to change the pins in the array. <br> <br>find in the code&quot; <br>const int ALLLEDS[] = { <br> 6,22,8,26,53,24,48,10,5,42,31,32,33,23,25,9,27,7,44,12,50,34}; <br>const int notPWMLEDS[] = { <br> 22,26,53,24,5,42,31,32,33,23,25,27,50,34}; <br>const int pwmLEDS[] = { <br> 6,8,5,9,44,10,7,12,48};&quot; <br> <br>for example uno gots 13 digital pins and 5 analog pins. . at least u need 1 analog pin for the soundReading., so there a still 13 digital and 4 analog pins u can use. then the arrays maybe look like this <br> <br>const int ALLLEDS[] = { <br> 0,1,2,3,4,5,6,7,8,9,10,11,12,13,A1,A2,A3,A4 <br>const int notPWMLEDS[] = { <br> 3,5,6,10,11 <br>const int pwmLEDS[] = { <br> 0,1,2,4,7,8,12,13,A1,A2,A3,A4};&quot; <br> <br>const int pwmCOUNT = 13; <br>const int ALLCOUNT = 17; <br>const int notPWMCOUNT = 4; <br> <br>the part with &quot;const int pwmCOUNT = 13; &quot; stands for the count of leds, <br> <br>that's it :) <br> <br>the maximum, is how many pins your ardurino gives you, <br> <br>About the Cost`s i really used almost everything from trash stuff i found somewhere, except the ardurino and the relay. <br> <br>if you need more assistance feel free to write me
thanks!
No, thats also possible but not, usefull, couse its not , autonomous anymore, the computer only starts the visualization. <br> <br>Ardurino Does everything, and its not recommended that a pc starts the vis. if u send the command &quot;A&quot; through Serial Monitor of Ardurino Software. it will also work
really cool! so is the comp doing the fft and the arduino is controlling the leds?

About This Instructable

6,542views

27favorites

License:

More by sfool:Moving a Servo To Sound Signals *updated*LED-Tower "Hello", Vu-Meter Advanced Sensing Music without IC`s only with Ardurino  and Interfacing with PC Windows Software! 
Add instructable to: