Instructables
video Ardunio Controlled Sound Sensor
Building a Arduino Sound Sensor Controller


Tools
-Soldering iron
-7in of wire
-screw driver
-solder
-shrink tube
-needle nose pliers
-cutter pliers


Parts
- a relay   (http://www.mouser.com/Search/ProductDetail.aspx?qs=0cdP5f6kAtG%252b5JijxMWEYQ%3D%3D)
-a sound sensor (https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2159445_-1)
-arduino board
-resistor
-A bread board/solder board
-extension cord
-The CODE

*************************

So to start gather all required tools and parts.

Now lets load the code on our board.

*********************************************************


//SOUND Sensor

int sensorPin = 4;    //Microphone Sensor Pin on analog 4
int YellowLED = 1;
int RedLED = 4;
int sensorValue = 0;

void setup() {
  pinMode(YellowLED, OUTPUT);
pinMode(RedLED, OUTPUT);
Serial.begin(9600);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);

/* If you feel that the sensor values on the serial monitor
are going by too quickly for you to read, you can make it
so that the values only show up on the serial monitor
if you make a noise.  You can replace
Serial.println(sensorValue);
  with:
if (sensorValue < 509){
   Serial.println(sensorValue);
}

*/

  digitalWrite(YellowLED, HIGH);  //Yellow is always on.

  if (sensorValue>25){  //The 'silence' sensor value is 509-511
    digitalWrite(RedLED,HIGH);
    delay(15 );            // The red LEDs stay on for 2 seconds
} else {
    digitalWrite(RedLED,LOW);
}
}

******************************
you can adjust the values under sensorValue for the sensitive.
********************************************************************

So after loading the code we can proceed.

Plave the relay and the resistor on the board, the two parallel pins are going to connect to the arduino and the two off slat pins are being connected to one side of the extension cord.

Solder the resistor to one side of the relay's parallel pins and then solder a wire to it and connect said wire to DIGITAL 4 on the arduino.

Now Solder two more wires to the other parallel pin and these are going to be GND wires. Connect one to the middle pin on the sound sensor ( its black) and the second wire connects to the GND on the DIGITAL row of the arduino board.

Sound Sensor Connections
The red wire pin connects to the 5V pin on the arduino board under POWER.
The blue wire pin connects to the ANALOG 4 pin on the arduino board.

Now cut the extension cord in half and cut one side of the two sided cord in half and this will be connected to the uneven sides of the relay.

Now with everything connected, check for bridging and make sure everything is a solid connection.

Plug the extension cord into a wall outlet and then connect a lamp/ light source to it and then power the arduino board and when you snap your fingers the light should flicker on.
hamishsmth58 months ago

Would it be possible to use two microphones left and right and some code to work out which of the microphones is receiving the most sound and then to turn a servo motor on that would track the sound.