This sensor emits a signal if the front microphone of the sensor perceives a noise. Sensitivity of the sensor can be adjusted by means of a controller.

Digital output: Via the potentiometer, a limit value for the received sound can be set, at which the digital output should switch.

Analog output: Direct microphone signal as voltage level

LED1 : Indicates that the sensor is powered

LED2 : Indicates that a noise has been detected

Function of the sensor

This sensor has three functional components on its board. This is the sensor unit at the front of the module, which physically measures the current environment and outputs it as an analog signal to the second unit, the amplifier. This amplifies the signal depending on the resistor set on the rotational potentiometer and directs it to the analog output of the module.

Please note that: The signal is inverted; if a high value is measured, this results in a lower voltage value at the analog output.

The third unit is a comparator that switches the digital output and the LED when the signal falls below a certain value. By means of the rotary potentiometer, the sensitivity can be adjusted, as shown in the following picture:

This sensor therefore does not output absolute values (e.g. precisely measured temperature in °C or magnetic field strength in mT), but is a relative measurement: A limit value relative to the given normal environmental situation is defined and a signal is output which can be processed further if this limit value is exceeded or if a different state has occurred.

This behavior is excellent for temperature monitoring (KY-028), proximity switches (KY-024, KY-025, KY-036), alarm monitors (KY-037, KY-038), or encoders (KY-026).

Pin assignment

Code example Arduino

Connection assignment Arduino

Arduino Sensor
5V +V
ground GND
Pin 3 Digital Signal
Pin A0 Analog Signal

The program reads the current voltage value, which can be measured at the analog output, and outputs it on the serial port.

In addition, the status of the digital pin in the console is also indicated, which means whether the limit has been exceeded or not.

// Declaration and initialization of input pins
int Analog_Input = A0; // Analog output of the sensor
int Digital_Input = 3; // Digital output of the sensor
void setup  ( )
  pinMode (Analog_In, INPUT);
  pinMode (Digital_Inbox, INPUT);
  Serial.begin (9600)  ;  //  Serial output with 9600 bps
//  The program reads the current values of the input pins
// and output it on the serial output
void loop  ( )
  float Analog;
  int Digital;
  //Actual values are read out, converted to the voltage value...
  Analog =  analogRead (Analog_In)   *   (5.0 / 1023.0); 
  Digital = digitalRead (Digital_Inbox)  ;
  //...  and issued at this point
  Serial.print  ("Analog voltage value:");  Serial.print (Analog,  4)  ;   Serial.print   (“V, “);
  Serial.print (“Limit:”)  ;
  if (Digital==1)
      Serial.println (“reached”);
      Serial.println (“not reached yet”);
  Serial.println  ( " ----------------------------------------------------------------") ;
  delay (200)  ;

Sample program Download

Code example Raspberry Pi

Connection assignment Raspberry Pi

Raspberry Pi Sensor
GPIO 24 [Pin 18] Digital Signal
3.3V [Pin 1 ] +V
Mass [ Pin 6 ] GND
KY-053 A0 Analogue signal
Sensor KY-053
Analogue signal A0
+V 3,3V [Pin 1 ]
GND Mass [ Pin 6 ]
Raspberry Pi KY-053
GPIO 3 [ Pin 5 ] SCL
Gpio 2 [Pin 3 ] SDA

Analogue sensor, therefore the following must be observed

In contrast to the Arduino, the Raspberry Pi has no analog inputs or there is no ADC (analogue digital converter) integrated in the chip of the Raspberry Pi. This restricts the Raspberry Pi when you want to use sensors where no digital values are output [Voltage value exceeded -> digital ON | Voltage value below -> digital OFF | Example: button pressed [ A] Button released [OFF]], but this should be a continuous variable value (example: potentiometer -> Other position = Other voltage value)

To avoid this problem, our sensor kit X40 with the KY-053 has a module with 16 bit accurate ADC, which you can use on the Raspberry to be able to add 4 analog inputs. This is connected via I2C to the Raspberry Pi, takes over the analog measurement and passes the value digitally to the Raspberry Pi.

Therefore, we recommend to switch the KY-053 module with the said ADC in between for analog sensors of this set. Further information can be found on the [KY-053] information page ( Analog Digital Converter

The program uses the corresponding ADS1x15 and I2C Python libraries from Adafruit to control the ADS1115 ADC. These have been published at the following link under the MIT license. The required libraries are not included in the download package below.

The program reads the current values of the input pins and outputs them in the console as a value in [mV].

Please note that you need to enable I2C on your Raspberry Pi before using this example.

# coding=utf-8

import time
import board
import busio
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import RPi.GPIO as GPIO
# Create the I2C bus
i2c = busio.I2C(board.SCL, board.SDA)

# Create the ADC object using the I2C bus
ads = ADS.ADS1115(i2c)

# Create single-ended input on channels
chan0 = AnalogIn(ads, ADS.P0)
chan1 = AnalogIn(ads, ADS.P1)
chan2 = AnalogIn(ads, ADS.P2)
chan3 = AnalogIn(ads, ADS.P3)

delayTime = 1
Digital_PIN = 24

GPIO.setup(Digital_PIN, GPIO.IN, pull_up_down = GPIO.PUD_OFF)

while True:
    analog = '%.2f' % chan0.voltage
    # output to console
    if GPIO.input(Digital_PIN) == False:
        print ("Analog voltage value:", analog, "V, ", "Limit: not yet reached")
        print ("Analog voltage value:", analog, "V, ", "Limit: reached")
    print ("---------------------------------------")
    # reset + delay
    button_pressed = False

Sample program download

To start with the command:

sudo python3

Code example Micro:Bit

Pin assignment Micro : Bit:

Micro: Bit Sensor
Pin 0 A0
Pin 1 D0
3V +V
Mass GND

This is a MakeCode example for Micro: Bit which essentially does the same as the examples of the other two variants. However, this example is closer to the Raspberry Pi example than the Arduino example.

Sample program download