Sound Sensor

Z2M Part: EMS-00004-A / EMS-00004-C

Control LED brightness based on sound intensity.

Circuit Diagram
Circuit diagram for Sound Sensor
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow → A0 to sensor OUT, Pin 11 to LED
Red → 5V to Sound sensor VCC
Black → GND to Sound sensor, LED cathode

Pin Configuration:

Arduino Analog Pin A0 → Sound sensor analog OUT
Arduino Digital Pin 11 → LED anode (via 220Ω resistor)
Arduino 5V → Sound sensor VCC
Arduino GND → Sound sensor GND, LED cathode
Arduino Code
Edit
const int led = 11;   // LED connected to pin 11
const int sound = A0; // Sound sensor connected to A0

int soundVal = 0;     // Variable to store sound sensor reading
int bright;           // Variable to store calculated brightness

void setup() {
  pinMode(led, OUTPUT);   // Set LED pin as output
  pinMode(sound, INPUT);  // Set sound sensor pin as input
  Serial.begin(9600);     // Initialize Serial Monitor
}

void loop() {
  // Read analog value from sound sensor
  soundVal = analogRead(sound);

  // Print sound value to Serial Monitor
  Serial.print(\"soundVal = \");
  Serial.println(soundVal);

  // Map sound value range (adjust 516 as baseline background noise)
  bright = map(soundVal, 516, 1023, 0, 255);
  bright = max(0, bright); // Prevent negative values

  // Adjust LED brightness based on sound level
  analogWrite(led, bright);

  // Delay for 0.2 seconds
  delay(200);
}

Instruction Details

Wiring: Connect sound sensor VCC to 5V, GND to GND, analog OUT to Analog Pin A0. Connect LED anode to Digital Pin 11 via 220Ω, cathode to GND.
Library: Not required (built-in).
Upload Code: Tools → Board → Arduino Uno. Tools → Port → select your COM port. Click Upload button.
View Output: LED brightness varies with sound intensity. Open Serial Monitor at 9600 baud for sound values. Adjust potentiometer for sensitivity.

How to Use

  1. Connect the required components as per the Pin Configuration above
  2. Open Arduino IDE and create a new sketch
  3. Copy and paste the code above
  4. Select your Arduino board and COM port from Tools menu
  5. Click the Upload button to upload the code to your Arduino
  6. Open Serial Monitor (if applicable) to see the output

Components Required

  • Arduino Uno
  • Sound Sensor Module (analog output)
  • LED
  • 220Ω Resistor
  • Breadboard
  • Jumper Wires

Category: Sensors