loading

I am Daniëlle V. and I build this Arduino project for If This Than That.

This is basically a game where you have to stand a meter away from the microphone and scream or talk as loud as you can, and see which colour level you make it to.

Step 1: Buying the Right Things

For this project you'll need a microphone ( I used 'big sound') and a ledstrip with a minimum of 30 LED's/ neopixels ( I bought this one: https://www.floris.cc/shop/en/neopixel/770-adafruit-neopixel-digital-rgb-led-weatherproof-strip-30-led-1m-white.html ) You'll also need an external adapter for the LEDstrip (apart from the Arduino, the computer needs energy too)

Step 2: Understand the Idea and the Code

You'll be making a rainbow LEDstrip that reacts to volume of sound.

I used this code:

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

#include

// Which pin on the Arduino is connected to the NeoPixels? // On a Trinket or Gemma we suggest changing this to 1 #define PIN 6

// How many NeoPixels are attached to the Arduino? #define NUMPIXELS 30

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals. // Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest // example for more information on possible values. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 0; // delay for half a second int holdval = 10; // hold time led bar value int gnd = 7 ; // ground for LED int VU; int dim; int rood; int groen; int blauw;

void setup() { //Serial.begin(9600); //set baud rate pixels.begin(); // This initializes the NeoPixel library. pinMode (gnd, OUTPUT) ;// ground for output digitalWrite (gnd, LOW); }

void loop(){ VU=analogRead(0); //set VU as value of pin A0 reading //Serial.println(VU); //glow the LEDs depending on the ammount of sound detected by the electret if (VU>510&&VU<520) // mediaan is 515 { dim = 30; } else if (VU>505&&VU<525) // 5 { dim = 27; } else if (VU>500&&VU<530) // 5 { dim = 24; } else if (VU>495&&VU<535) // 5 { dim = 21; } else if (VU>485&&VU<545) // 10 { dim = 18; } else if (VU>475&&VU<555) // 10 { dim = 15; } else if (VU>460&&VU<570) // 15 { dim = 12; } else if (VU>440&&VU<590) // 20 { dim = 9; } else if (VU>400&&VU<630) // 40 { dim = 6; } else if (VU>350&&VU<680) // 50 { dim = 3; } else if (VU<350||VU>680) // endvalue 330 top-top (max 180-850) { dim = 0; }

// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

for(int i=0;i

// pixels.Color defined for level of sound if (i<1) { rood = 150; groen = 0; blauw = 150; }

else if (i>=2&&i<3) { rood = 50; groen = 0; blauw = 150; } else if (i>=3&&i<5) { rood = 0; groen = 0; blauw = 150; } else if (i>=5&&i<8) { rood = 0; groen = 150; blauw = 50; } else if (i>=8&&i<10) { rood = 0; groen = 150; blauw = 0; }

else if (i>=10&&i<15) { rood = 100; groen = 150; blauw = 0; } else if (i>=15&&i<20) { rood = 150; groen = 150; blauw = 0; }

else if (i>=20&&i<25) { rood = 150; groen = 40; blauw = 0; } else if (i>=25&&i<29) { rood = 150; groen = 0; blauw = 0; }

else if (i>=29) { rood = 50; groen = 50; blauw = 50; } pixels.setPixelColor(i, pixels.Color(rood,groen,blauw)); // 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). } // Reset to off routine delay(holdval); // Hold the led bar value for a period of time (in milliseconds). for(int i=NUMPIXELS-dim;i>0;i--){ pixels.setPixelColor(i, pixels.Color(0,0,0)); pixels.show(); // This sends the updated pixel color to the hardware. } }

Step 3: Build It

<p>This could make for a fun carnival game.</p>

About This Instructable

1,029views

28favorites

License:

More by Nekai8:Sound Visualizer / Scream Game / Anger Outlet 
Add instructable to: