Small Sound Detection Module (KY-038) [S053]



https://www.youtube.com/watch?v=WFB0QkhGm20


* GitHub : https://github.com/rdiot/rdiot-s053.git


* Specs

Dimensions: 1.38 in x 0.59 in x 0.51 in (3.5 cm x 1.5 cm x 1.3 cm)

Weight: 0.11 oz (3 g)

Main chip: LM393

Electret condenser microphone

Working voltage: DC 4-6V

Interface definition:

AO: analog output sensor

GND: ground

VCC: Power supply input range: 3V-24V.

DO: Digital Output (comparator output)

Two red LED indication: POWER and SENSOR. POWER: Power is off.

SENSOR: When the microphone senses sound reaches a certain value, this LED light.


Single channel signal output

Low level output signal used for sound control light

Great module for sound alarm system

LM393 main chip

Electric condenser microphone


* Contents

- Connect

A0 ----- A0

G ----- GND

+ ----- 5V

D0 ----- X


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


int threshold = 30; 


int led1 = 2;

int led2 = 3;

int led3 = 4;

int led4 = 5;

int led5 = 6;


int pin = A0;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(pin,INPUT);


  pinMode(led1,OUTPUT);

  pinMode(led2,OUTPUT);

  pinMode(led3,OUTPUT);

  pinMode(led4,OUTPUT);

  pinMode(led5,OUTPUT);


  delay(1000);


  lcd.clear();

}


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("S052:SoundDetect");


  int val = analogRead(pin);


  lcd.setCursor(0,1);

  lcd.print("val=" + (String)val + "  ");


  if(val <= threshold)

  { 

    lcd.setCursor(0,2);

    lcd.print("                    ");

  }

  else

  {

    lcd.setCursor(0,2);

    lcd.print("Small Sound Detected");

    delay(100);  

  }


  digitalWrite(led1, LOW); 

  digitalWrite(led2, LOW); 

  digitalWrite(led3, LOW); 

  digitalWrite(led4, LOW); 

  digitalWrite(led5, LOW); 

 

  if(val > 30) { digitalWrite(led1, HIGH); }

  if(val > 31) { digitalWrite(led2, HIGH); }

  if(val > 32) { digitalWrite(led3, HIGH); }

  if(val > 35) { digitalWrite(led4, HIGH); }

  if(val > 40) { digitalWrite(led5, HIGH); }


  delay(50);

}

Posted by RDIoT
|