Arduino(3): Microphone Sound Sensing Module LM393

I have seen a device that allows a light switch to be clap. It should have a device that detects sound and activates the switch. There is a sound sensor that can detect the sound size. The microphone sound sensor can detect the sound. This is a demonstration of how to use the sound sensor to control the brightness of the LED.


The sound detection sensor mainly relies on whether a miniature microphone receives sound, but this module can only detect whether there is sound, and cannot recognize the size of the sound or the specific frequency. Sensitivity You can use a screwdriver to adjust the small cross knob resistance on the sensor. If the sensitivity is too high, the light will always blink in the light and dark, and the sensitivity will be too low, so that even the clapper can not detect it. In the process of implementation, since the sound sensor itself has a time difference of transmission, it is sometimes necessary to take a second time to normally extinguish or illuminate the light.

[LM393 Sound Detection Module Features]

  • Sensitivity can be adjusted (blue digital potentiometer adjustment in the figure)
  • Working voltage 3.3V-5V
  • The output is represented by 0 and 1 (high or low)
  • Small board PCB size: 3.2 cm * 1.7cm

[material]

  • Arduino Uno x 1
  • Microphone sound sensor x 1
  • Breadboard x 1
  • LED x 1
  • 220 ohm resistor x 1
  • Cable x 4

[Wiring and circuit diagram]

Arduino
LM393
5V (VCC)
VCC
GND
GND
Pin 7
OUT


[Code]

int ledPin = 13;
int sensorPin = 7;
boolean val = 0;
boolean ledOn =0;

void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(sensorPin, INPUT);
  Serial.begin (9600);
}
  
void loop (){
  val =digitalRead(sensorPin);
     Serial.println (val);

  
  if (val==HIGH) {

    if (!ledOn) { 
       digitalWrite(ledPin, HIGH);
       ledOn = 1;
    }
    else {
       digitalWrite(ledPin, LOW);
       ledOn = 0;
    }
  }
}

[Result]

Adjust the cross knob on the sensor to get a better sensing condition.


[Reference]

• Randomnerdtutorials : Guide for Microphone Sound Sensor with Arduino

Post a Comment

Previous Post Next Post