Example Code for Arduino-Sound Intensity Reading

Last revision 2026/01/15

Read the analog sound intensity value from the DFR0034 Analog Sound Sensor and print it to the serial monitor.

Wiring Diagram

DFR0034

Other Preparation Work

Connect the DFR0034 Analog Sound Sensor to the Analog 0 pin of the Arduino board.

Sample Code

void setup()
{
  Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}
void loop()
{
      int val;
      val=analogRead(0);   //connect mic sensor to Analog 0
      Serial.println(val,DEC);//print the sound value to serial
      delay(100);
}

Result

Open the Serial monitor, Baud rate: 9600.
Result_DFR0034_new.png

Was this article helpful?

TOP