Be the spectacle at this summer's music festival with these sound activated rave goggles!

BOM:

 

Why?

The shape of the NeoPixel rings used in this project inspired me to create goggles because how many PCBs can you actually look through? With all the crazy festivals coming up, I figured what better than sound-activated rave goggles? The louder the music, the crazier the light show. Though, I think I maybe could have found something better than swimming goggles...

 

My Rave Goggles without power

 

How?

The mic/amp breakout uses Maxim Integrated's Max4466 to amplify sound detected by the electret microphone. When powered properly, the breakout circuit outputs an analog voltage directly related to the incoming audio signal picked up by the microphone. We can use this signal to our advantage by attaching it to an analog input on our microcontroller.

Changes in volume are detected by comparing the analog-to-digital converter's (ADC) result to a threshold value that we include in our program. With some test signal, we can analogRead() the varying signal level on our analog input pin. Using thresholds, we set three different volume categories and adjust the NeoPixel's color accordingly. 

 

The Max4466 breakout board

 

NeoPixels are Adafruit's brand of individually addressable, 5V RGB pixels that communicate over single wiring communication. Minimal wiring makes them perfect for concise projects like ours here. NeoPixels, however, wouldn't be as simple to use if it wasn't for Lady Ada's handy NeoPixel library. Utilizing some example code, we can get things running pretty easily and reacting to our audio signal.

It is important to read Adafruit's page on proper NeoPixel care because they are sensitive components. A 300-550 ohm resistor is usually recommended in the data line but luckily, our NeoPixel rings include this for us in the PCB already.

For the Rave Goggles, I used the wiring diagram from a similar project of theirs, which uses a different MCU and power supply, though the NeoPixel wiring remains the same. 

 

NeoPixel wiring from Adafruit's Project

 

To power my Nano, I used a micro USB cable and cut off the opposing end, stripping back the red and black wires which are positive and negative power, respectively. These wires were connected to my quadruple AA battery pack. I later realized it is best practice to use only three AA batteries, which yields 4.5V rather than 6V, though it did not affect performance for this project.

The colors and animation can be adjusted using relatively simple commands found within the example projects. To make the pixels react to sound, I created three different volume categories using threshold ranges. If the analog voltage value is within a certain range, it adjusts the pixels color or animation accordingly. When the sound is the loudest, it makes the pixels go crazy! The threshold code and color settings can be found below, respectively.

 

Ready for the next festival!

 

                    sound = analogRead(A0);
  delay(100);

  if (sound < 400) {
    green();
  }

  if (sound >= 401 & sound <= 699) {
    yellow();
  }

  if (sound >= 700) {
      rainbow(20);
  }
                  

                    void green() {

  for (int i = 0; i < NUMPIXELS; i++) {

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0, 150, 0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).

  }
}

void yellow() {

  for (int i = 0; i < NUMPIXELS; i++) {

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(255, 100, 0)); // Yellow color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).

  }
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i < strip.numPixels(); i++) { //fade through all colors
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show(); // This sends the updated pixel color to the hardware.
    delay(wait);
  }
}
                  

  Rave Goggles Code  


Ultimately, this is a pretty simple project so wire everything up and get out on the dance floor! Remember to poke nose holes in your swimming goggles for best breathing!

 

Other MIT-i Innovations:

 

Comments

1 Comment


  • kenjkoubek 2017-09-08

    Hello, I may have missed something, but where did the MAX4466 get wired in on the wiring diagram?