fritzing Sound Detector Module User guide

Page 1

Sound Detector Module

This module has a microphone for detecting sounds and has two outputs:

AO: analog output, real-time output voltage signal of the microphone.

DO: digital output, when the sound intensity reaches a certain threshold, the
output high and low signal. The threshold-sensitivity can be adjusted via
potentiometer on the sensor.

Pinout and Connection to Arduino

Page 2
Arduino Example Sketch
The following Arduino Sketch will light the LED when a sound is detected using the digital output.
int Led = 13 ;// define LED int buttonpin = 3; // define D0 Sensor int val = 0; // define numeric variables val
void setup ()
{ pinMode (Led, OUTPUT) ; // define LED as output pinMode (buttonpin, INPUT) ; // output D0 is defined sensor }
void loop ()
{ val = digitalRead(buttonpin); // read pin 3 to val if (val == HIGH) // When sound is detected, LED flashes { digitalWrite (Led, HIGH); } else { digitalWrite (Led, LOW); } }
The following Arduino Sketch will output the value from the analog output via serial monitor and blink the LED according to the detected sound level.
int sensorPin = A5; // select the input pin for A0 int ledPin = 13; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor
void setup ()
{ pinMode (ledPin, OUTPUT); Serial.begin (9600); }
void loop ()
{ sensorValue = analogRead (sensorPin); digitalWrite (ledPin, HIGH); delay (sensorValue); digitalWrite (ledPin, LOW); delay (sensorValue); Serial.println (sensorValue, DEC); }
Loading...