Introduction: Controlling LED S Using Microphones Tutorial

Picture of Controlling LED S Using Microphones Tutorial

Hi, my name is Leor Oved and today I will teach you how to wire and code my new cool instructable. In this lesson you will learn how to control an LED using a microphone. As you speak in the microphone, the light would turn on and it would turn off if you stop speaking in the microphone.

To begin, follow all the steps provided below.

Feel free to comment.

Good Luck!!

Step 1: Materials

Picture of Materials

For this project, you will need:

1. An Arduino with a USB cable

2. A Breadboard

3. A Microphone

4. Male Jumper Wires

5. An LED

6. A Brown/Black/Orange/Gold resistor (You can use other resistors but this one is most preferred)

Step 2: Setup

Picture of Setup

The following shows how to wire your materials together

If the microphone is not working, try to turn it around

If you have any questions please feel free to leave a comment below

Step 3: Code

int led = 13 ; // set point D13 as LED
int microphone = A0; // set point A0 as microphone
int val = 0; // define numeric variables val for microphone 
void setup (){
 Serial.begin(9600);  //activate serial monitor
 pinMode (led, OUTPUT) ; // define LED as an output  
pinMode (microphone, INPUT) ; //define microphone as an input
} 
void loop (){ 
 val = analogRead(microphone); // reading microphone and storing it as val
 Serial.println(val);  //print val 
 if (val >= 1){   //if the microphone is receiving sounds
digitalWrite (led, HIGH); //turn LED on
} else {    //if the microphone is not receiving sounds
digitalWrite (led, LOW);  //turn LED off
} 
}

Comments

About This Instructable

302views

8favorites

License:

More by leoroved :Controlling LED S Using Microphones TutorialPush Button Controlling Servo Motors
Add instructable to: