Graphical Programming Tutorial for Arduino – Sound Detection Sensor


Graphical Programming Tutorial for Arduino – Sound Detection Sensor


The Sound Detection Sensor is a small board that combines a microphone and some processing circuitry, it has the ability to detect different sizes of sound. This sensor can be used to for a variety of uses from industrial to simple hobby or playing around.

In this lesson we will guide you through hooking up and using the Sound Detector. It will examine how the circuit works, explain some details about getting the best performance from the Sound Sensor, then present some projects that demonstrate how to use it.



  • Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
  • Sound Detection Sensor x 1
  • Breadboard x 1
  • Jumpers
  • USB Cable x 1
  • PC x 1

About Sound Detection Sensor


The Sound Detection sensor module has a built-in capacitive electret microphone which is highly sensitive to sound. Sound waves cause the thin film of the electret to vibrate and then the capacitance changes, thus producing the corresponding changed voltage, so it can detect the sound intensity in ambient environment. Since the change is extremely weak, it needs to be amplified. We use a LM393 as the power amplifier here. You can adjust the sensitivity with by adjusting the Potentiometer. When the sound level exceeds the set point, an LED on the sensor module is illuminated and the output is sent low.

Note: This sound sensor is used to detect whether there’s sound surround or not, it cannot recognize the frequence or volum, please don’t use the module to collect sound signal.


The image and table below detail the controls, pin outs, and other key components.

When referring sensititivity, well. I mean:

  • When less sensitive, it takes more sound to trigger the device
  • When more sensitive, it takes less sound to trigger the device

Parameter Value
+ 5 V DC from your Arduino
G GND from your Arduino
D0 Connect to Digital Input Pin
A0 Connect to Analog Input Pin
Power LED Illuminates when power is applied
Sound Detect LED Illuminates when sound is detected
Potentiometer CW = More Sensitive
CCW = Less Sensitive

It has four pins that needs to be connected to your Arduino. The top one(if you look at the image above), is AO. This should be connected to the analog input 0 on the Arduino(A0). The one beside that is GND, which is connected to ground, the VCC is connected to +5V, and the last one is DO – which is the digital output of the module, and should be connected to digital pin 2 on the Arduino.

On the top of the sound sensor is a little flathead screw you can turn to adjust the sensitivity and analog output of the sound sensor. To calibrate the sound sensor you can make some noise and keep turning it until you start seeing the sensor-LED on the module starts blinking with the rhythm.


Given that this device measures whether or not sound has exceeded a threshold, you’re basically left with determining what it is you want to do. What I mean by this is that you can do something when it is quiet and/or you can do something when it is loud. For example:

  • You could detect whether or not a motor is running.
  • You could set a threshold on pump sound so that you know whether or not there is cavitation.
  • In the presence of no sound, you might want to create an ambiance by turning on music.
  • In the presence of no sound and no motion, you may go into an energy savings mode and turn off the lights.



In this example, we will show how to use the analog pin to detect the sound. The microphone sensor will detect the sound intensity of your surroundings and will light up an LED(we use the on-board LED here) if the sound intensity is above a certain threshold.


Overhere we use the A0 as the analog pin to connect with the sound sensor, build the circuit as below:


After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.Open the Graphical Programming software Mixly and follow the next operations:

Click Save aftogramming is done. Select the board type and serial port before uploading. For instause a Uno board, just select Arduino/Genuino Uno: if you use a Mega2560, select Arduino/Genuino Mega or Mega2560.

Select the serial device of the Arduino board from the COM menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

Next,upload the code. If the uploading fails, check and correct the code according to the prompts

Finally, the staus will change to ‘Upload success!’.

Running Result

After uploading this code, when the volume reaches to a certain value, the LED attached to pin 13 on the Uno board will light up. If the sound does not sense very well, try changing the threshold value or changing the sensor sensitivity by rotating the potentiometer.

You can open the Serial Monitor by going to Tools > Serial Monitor or pressing the magnifying glass-button in the Arduino software window.

What prints out is the analog and digital values of from the sound sensor module. The analog value should spike up when a noise occurs and stabilize when it gets quiet again.

Now in the code there is an “AnalogRead(A0) > 600” line that needs to be changed to something very close but higher than the value you get from the Serial Monitor when it is quiet around you. For instance if you see an analog value of 600, then threshold should be changed to perhaps 603 or 605. When a sound occurs, the analog value will rise and go above the threshold value. When that happens your LEDs will turn on. When it gets quiet again the analog value will go back to 603 and the LEDs go dark again.

About the Author

amber administrator

You must be logged in to post a comment