Data Conversion

Enter Your Electronics & Design Project for a chance to win a $200 shopping cart!

Submit an EntrySubmit an Entry  Back to homepage
Project14 Home
Monthly Themes
Monthly Theme Poll

 

Video of Light Organ project in action

https://www.youtube.com/watch?v=NHUzB_AjNY0

 

 

input your phone or ipod into the control board with a 1/4 stereo plug. A 1/4 inch output  jack is provided to plug into your stereo system.

your analog audio is converted to illuminated bands of bright colors

.

MSGEq7 graphic equalizer IC

https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf

 

 

The power input is a 12V 10A power supply , the pigtails have unique plug pinouts for each light bar.

The LEDs bars stay outside 100% of the time, but the power supply and Arduino / MSGEQ7 drive board needs to come inside for the winter and bad weather.

The red pushbutton starts a test mode flashing sequence/light show.

The MSGEQ7 chips is clocked and its analog output read by an Arduno Nano. The nano outout turns on for each band that exceeds a preset analog threshold.

 

/*

 

  -> added pot to analog input 1 for threshold adjust on LED trigger

  -> add a PB to D6 to run a test routine that strobes the lights

 

  control interface to MSGEQ7 IC

  strobe control for equalizer bands, read in multiplexed voltage per band, drive outputs LEDs

 

  Arduino D4 wires to MSGEQ7 pin 4 strobe

  Arduino D5 wires to MSGEQ7 pin 7 reset

 

  all ins have pull ups

 

  Arduino D7 = 63Hz LED , LOW = ON

  Arduino D8 = 160Hz LED

  Arduino D9 = 400Hz LED

  Arduino D10 = 1kHz LED

  Arduino D11 = 2.5 kHz LED

  Arduino D12 = 6kHz LED

  Arduino D13 = 16kHz LED

 

  Arduino A0 wires to MSGEQ7 pin 3 Vout

 

*/

int BandMagnitude[8];

int Vin =0 ;

int LEDThreshold = 500;

int strobeBit=1;

int pausetime =1000;

 

 

// the setup function runs once when you press reset or power the board

void setup()

{

  Serial.begin(9600);          //  setup serial

 

  // initialize digital output pins for LEDS.

  pinMode(13, OUTPUT);

  pinMode(12, OUTPUT);

  pinMode(11, OUTPUT);

  pinMode(10, OUTPUT);

  pinMode(9, OUTPUT);

  pinMode(8, OUTPUT);

  pinMode(7, OUTPUT);

 

  // initialize digital output pins for strobe and reset MSGEQ7

    pinMode(5, OUTPUT); //reset MSGEQ7 WHEN HIGH, LOW enables STROBE

    pinMode(4, OUTPUT); //strobe MSGEQ7 output, edge triggered LOW is active state for strobe

 

 

// defines and intehger array for the 7 band values, array location 0 is unused

 

 

   pinMode(6, INPUT_PULLUP); //tie pin D6 to ground to run the strobe LED routine

 

int BandMagnitude[8];

int Vin =0 ;

}

 

 

// the loop function runs over and over again forever

void loop()

 

 

{

  // initialze the strobe and reset after every scan to ensure synchronization

 

    initializeMSGEQ7 ();

    //delay (1);

     delayMicroseconds(100); // minimum delay is 72 usec for strobe reset

     LEDThreshold = analogRead(1) ;

  

    for (int i=1; i <= 7; i++)

     {

       digitalWrite(4, LOW);   // strobe is edge trigger LOW active

        delayMicroseconds(30); // minimum delay is 18 usec for strobe reset

      // delay (1);

       Vin = analogRead(0) ;

      BandMagnitude[i] = Vin ;

       digitalWrite(4, HIGH);   // strobe off,  strobe is edge trigger LOW active

//          Serial.println("BandMagnitude[i] =");             // debug value  

//          Serial.println(BandMagnitude[i]);             // debug value

  //         Serial.println("[i] =");             // debug value 

  //         Serial.println(i);             // debug value

       if (BandMagnitude[i]>LEDThreshold)

          { digitalWrite((6+i), LOW); }

       if (BandMagnitude[i]<LEDThreshold)  {digitalWrite((6+i), HIGH);}

       

           delayMicroseconds(30); // minimum delay is 18 usec for strobe reset

   //    delay (90); // delay time with strobe low for the next read cycle

 

}

strobeBit = digitalRead(6);

if (strobeBit == LOW) { strobe();}

//          Serial.println("BandMagnitude[i] =");             // debug value  

          Serial.println("[strobebit] =");             // debug value 

           Serial.println(strobeBit);

 

 

}

 

 

void initializeMSGEQ7 ()

{

   digitalWrite(5, HIGH);   // make RESET line HIGH

   digitalWrite(4, HIGH);   // turn on strobe bit

  delayMicroseconds(30); // minimum delay is 18 usec for strobe width

  digitalWrite(4, LOW);   // turn off strobe bit

   delayMicroseconds(1); // minimum delay is 100 ns

//   delay(1);   

  digitalWrite(4, HIGH);   // turn off strobe bit

//  delay(1);

   digitalWrite(5, LOW);   // make RESET line LOW to enable the strobe line

delayMicroseconds(100); // minimum delay is 72 usec for strobe reset

// digitalWrite(5, LOW);   // make RESET line LOW to enable the strobe line

// delay (1);

//  digitalWrite(4, HIGH);   // turn off strobe bit (low is active)

// delay(1);

}

 

 

void strobe ()

{ pausetime=500;

   for (int j=1; j <= 15; j++)

   {

      pausetime=(pausetime/2);

       if (pausetime<8){pausetime=8;}

         for (int i=1; i <= 7; i++)

            { digitalWrite((6+i), LOW);

             delay (pausetime);

             digitalWrite((6+i), HIGH);

             delay (5);

            }

         for (int i=0; i <= 7; i++)

           { digitalWrite((12-i), LOW);

             delay (pausetime);

              digitalWrite((12-i), HIGH);

             delay (5);

             }  

      }

   }