Introduction: Parrot-silencer

For this project I made a sound reactive LED-strip, without the actual strip (just the LED's). It basically reacts to any sound surrounding the sensor and the amount of LED's that will light up depends on the intensity of the sound. I use this device to shut my cockatoo up when he screams. Whenever he sees the LED's light up, he either gets fascinated by them or he just gets scared (which stops him from screaming his lungs out).

Step 1: What Do You Need?

Here's the list of things you need to build this:

- Arduino UNO

- LED's

- Breadboard

- Wires

- Resistors

- Sound sensor

Step 2: Schematics

This is how you connect the sound sensor to the Arduino. On here you can also see that there's only 4 LED's plugged in, but for my personal use I plugged in 8 LED's.

Step 3: Code

Below you can see the code for this concept:


int MicPin = A0; //pin that mic is attached to
int MicValue1 = 0; int MicValue2 = 0; //the mic value

int led1 = 2; int led2 = 4; int led3 = 6; int led4 = 8; int led5 = 10; int led6 = 11; int led7 = 12; int led8 = 13;

void setup() { pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(led5, OUTPUT); pinMode(led6, OUTPUT); pinMode(led7, OUTPUT); pinMode(led8, OUTPUT); Serial.begin(9600); //for test the input value initialize serial }

void loop(){

MicValue1 = analogRead(MicPin); Serial.println(MicValue1); delay(1); MicValue2 = analogRead(MicPin); Serial.println(MicValue2);

if (MicValue1-MicValue2 == 1) { digitalWrite(led1, HIGH); //turn lights on delay(100); } else { digitalWrite(led1, LOW); } if (MicValue1-MicValue2 == 2) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); } if (MicValue1-MicValue2 == 3) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); } if (MicValue1-MicValue2 == 4) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); } if (MicValue1-MicValue2 == 5) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH); digitalWrite(led5, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); } if (MicValue1-MicValue2 == 6) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH); digitalWrite(led5, HIGH); digitalWrite(led6, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); digitalWrite(led6, LOW); } if (MicValue1-MicValue2 == 7) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH); digitalWrite(led5, HIGH); digitalWrite(led6, HIGH); digitalWrite(led7, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); digitalWrite(led6, LOW); digitalWrite(led7, LOW); } if (MicValue1-MicValue2 > 7) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH); digitalWrite(led5, HIGH); digitalWrite(led6, HIGH); digitalWrite(led7, HIGH); digitalWrite(led8, HIGH); delay(100); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); digitalWrite(led6, LOW); digitalWrite(led7, LOW); digitalWrite(led8, LOW); } }

Comments

author
DIY Hacks and How Tos made it! (author)2017-01-22

This is brilliant. I wish I had something like this when I was keeping birds.

About This Instructable

1,370views

12favorites

License:

More by Shona97:Parrot-silencer
Add instructable to: