Lesson 20 Sound Sensor Module
Lesson 20 Sound Sensor Module
DESCRIPTION:
It’s a high sensitivity sound detection module, which has two output signal pin. one digital
pin(D0), When it detect some sound up to certain threshold, it can output High or Low level.
One analog pin(A0), it can real-time output voltage signal of the microphone.
Specification:
● Voltage:5V/3.3V
● Electret microphone
● Weight: 4g
● Impedance:2.2K ohm
● Sensitivity:48~66dB
● polar pattern:Universal
1/3
● Operating humidity: <90%
PIN CONFIGURATION:
1、 “A0”: Analog
2、 “G” : GND
3、 “+” : +5V
4、 “D0”: digital output
Example :
In this example we try to combine digital pin and analog pin together to control two
LED lights, connection and code as below.
Code:
int Led=13;
int ledPin=12;
int buttonpin=7; // define D0 Sensor Interface
2/3
int sensorPin = A0;
int sensorValue = 0;
int val;
void setup()
{
Serial.begin(9600);
pinMode(Led,OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(buttonpin,INPUT);
}
void loop()
{
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
Serial.println(sensorValue, DEC);
val=digitalRead(buttonpin);
if(val==HIGH)
{
digitalWrite(Led,HIGH);
}
else
{
digitalWrite(Led,LOW);
}
}
3/3