In our last tutorial, we have seen how to interface the Bluetooth module with 8051. This tutorial is all about Sound Sensor Interfacing with 8051.
Prerequisites
Before starting this tutorial we should know the below topics. If you know already, please go further.
Components Required
- 8051 Development Board
- Sound Sensor (Clap detecting sensor)
- LCD Module (To print the Sensor output)
Introduction
The sound detection sensor module detects whether the sound has exceeded a threshold value. Sound is detected via microphone and fed into an LM393 op-amp. The sound level setpoint is adjusted via an onboard potentiometer. When the sound level exceeds the setpoint, an LED on the module is illuminated and the output is sent low.
Product Description
- Main chip: LM393, electret microphone
- Working voltage: DC 4 ~ 6V
- Has the signal output instructions
- Single signal output.
- Effective signal output for low level.
- Output low level and the signal light will on when there is a sound.
- Can be used for the sonic lamp, with photosensitive sensors act as sound and light alarm, also can be used in the occasion of voice control and sound detection.
- Circuit boards output switch value.
Note: This sensor only recognizes the availability of sound can not identify the size of the sound or the specific frequencies of sound.
Sound Sensor Interfacing with 8051 – Clap detecting sensor
Connection
Sound Sensor
- Vcc – 5v
- GND – Ground
- Vout – P1.0
LCD
- RS – P2.0
- RW – P2.1
- EN – P2.2
- Data Lines – P3.0 – P3.7
Source Code
If this sensor detects any sound, LCD will display “Sound Detected”. You can also vary the threshold level by adjusting the Potentiometer in that sensor module.
#include<reg51.h> #define lcd P3 sbit SOUND=P1^0; sbit rs=P2^0; //register select sbit rw=P2^1; //RW sbit en=P2^2; //enable void lcd_init(); void cmd(unsigned char); void dat(unsigned char); void delay(); void lcd_string(char *s); void main() { lcd_init(); lcd_string(" EmbeTronicX "); while(1) { if(SOUND == 0) { cmd(0xc0); lcd_string("Sound Detected"); delay(); } else { cmd(0xc0); lcd_string(" "); } } } void lcd_init() { cmd(0x38); cmd(0x0e); cmd(0x06); cmd(0x01); cmd(0x80); } void cmd(unsigned char a) { lcd=a; rs=0; rw=0; en=1; delay(); en=0; } void dat(unsigned char b) { lcd=b; rs=1; rw=0; en=1; delay(); en=0; } void lcd_string(char *s) { while(*s) { dat(*s++); } } void delay() { unsigned int i; for(i=0;i<20000;i++); }
Applications
SECURITY SYSTEM FOR HOME/OFFICE
The system can be used for home /office security purposes. When a thief or robber tries to enter the home or office, some sort of sound will be generated. It may be voice or any other sort of sound. The microphone takes the sound and sends messages instantly.
CLAPPING SWITCH
The system can be used as a clapping switch. If we add the LED with a relay or BJT, the system acts as a switch. When we clapped, the microphone takes the sound, and the comparator output goes high. As a result, BJT or relay turns on. If we connect this BJT or relay with light, fan or any electrical / electronic instruments, the system can be operated as a clapping switch.
In our next tutorial, we will see a Touch sensor interfacing with 8051.
You can also read the below tutorials.

Embedded Software | Firmware | Linux Devic Deriver | RTOS
Hi, I’m SLR. I am a tech blogger and an Embedded Engineer. I am always eager to learn and explore tech-related concepts. And also, I wanted to share my knowledge with everyone in a more straightforward way with easy practical examples. I strongly believe that learning by doing is more powerful than just learning by reading. I love to do experiments. If you want to help or support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!