Microphone Lights LED

638

8

3

Intro: Microphone Lights LED

In our modern day world, sound and light are what makes up society. Everywhere you go light and sound are present, whether in Times Square or at a concert both are there. In an attempt to combine the two, a code was made where LEDs were turned on based on sound frequencies.

Step 1: Parts

1. Arduino

2. Wires

3. Microphone

4. 7 LEDs

5. Breadboard

6. Resistor

*pictures are in order of parts

Step 2: Coding

After the idea of lighting LEDs based on sound was agreed on, a code was needed. In order to make sure each light was independently accounted for a code, we needed to give each light a code as to when they should light up.

Based on the sound the microphone measures the lights would respond accordingly. The sound range of our lights varies from 5-1000. This means that every light would light at a certain point between 5-1000. Each light was programmed to their own 'off and on' code.
The code goes as such:


void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
int val = analogRead(A0);
Serial.println(val);


if (val > 750) {
digitalWrite(6, HIGH);
}
if (val < 750) {
digitalWrite(6, LOW);
}
if (val > 850){
digitalWrite(5, HIGH);
}
if (val < 850) {
digitalWrite(5, LOW);
}
if (val > 900) {
digitalWrite(7, HIGH);
}
if (val < 900) {
digitalWrite(7, LOW);
}
if (val > 1000) {
digitalWrite(3, HIGH);
}
if (val < 1000) {
digitalWrite(3, LOW);
}
if (val > 5) {
digitalWrite(2, HIGH);
}
if (val < 5) {
digitalWrite(2, LOW);
}
if (val > 100) {
digitalWrite(1, HIGH);
}
if (val < 100) {
digitalWrite(1, LOW);
}
if (val > 200) {
digitalWrite(3, HIGH);
}
if (val < 200) {
digitalWrite(3, LOW);
}
if (val > 600) {
digitalWrite(4, HIGH);
}
if (val < 600) {
digitalWrite(4, LOW);
}
}

Step 3: Building

In order to make sure the code and board function perfectly together, it must be built accordingly.

*referring to picture 1
Explanation: Each wire must correspond one LED and the Arduino.

*referring to picture 2
Explanation: Be sure to include a resistor

*referring to pictures 3 and 4
Each wire goes to a specific place on the Arduino so make sure it is followed exactly as the picture shows

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Plastics Contest

      Plastics Contest
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge

    3 Discussions

    0
    None
    gm280

    10 months ago

    Interesting project. I'd like to see a video of it in operation. And once you accomplish this, advance it with a voice processor option so your program can recognize other words and do things accordingly. That is how programming works. You expand on a small program to make new projects.

    0
    None
    Swansong

    10 months ago

    Thanks for sharing :)