Sound Frequency Detection

Introduction

This experiment demonstrates how to detect sound frequency using a microphone sensor.

Sound Frequency Sensor

Components Needed

Circuit Setup

  1. Connect the VCC pin of the microphone sensor to 5V on the Arduino.
  2. Connect the analog output pin of the microphone to an analog input pin (e.g., A0) on the Arduino.

The microphone will capture the sound, and the Arduino will process the frequency.

Sound Frequency Circuit Setup

Code for Sound Frequency Detection

Upload the following code to your Arduino to detect sound frequency:


const int soundPin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int soundValue = analogRead(soundPin);
  Serial.print("Sound Frequency: ");
  Serial.println(soundValue);
  delay(100);
}
            

Explanation

The microphone sensor converts sound into an analog voltage that the Arduino reads and outputs as a frequency value on the Serial Monitor.

Troubleshooting