This article presents an interesting approach for sound activated display system. This system displays two different messages for odd and even number of sounds. When the sound is produced for the first time the first message is displayed on the LCD. At the second sound, a second message is displayed. The first message reappears at the third sound. Thus alternate messages are displayed every time a sound, say clap, is detected by the system. The project is build around the 8051 microcontroller (AT89C51) along with LCD and a condenser microphone.
The circuit consists of four major modules, namely, a sound sensor, an amplifying circuit, a control circuit and a display module. A switching circuit is also employed after the amplifier.
Any sound, say clap, is detected by a microphone (condenser mic) which acts as the sound sensor. This mic is connected to a two stage transistor amplifier. The mic output is thus amplified to a suitable level so that it can be detected at the TTL logic.
The output of the amplifier is coupled with a transistor switch. Whenever a high voltage output is received from the amplifier, it generates a pulse. The transistor switching circuit also ensures that a high TTL logic is not received at the microcontroller due to noise signals.
The pulses, from the switching circuit, are fed to the microcontroller’s pin which is programmed to detect the pulses. Whenever a high pulse is generated, it is received at the input pin of the microcontroller and is counted. The first message, ‘HELLO WORLD’, is sent to a 16×2 LCD on odd counts of the input. The second message, ‘WELCOME TO EARTH’ is displayed for even counts. Thus the messages are repeated whenever a high pulse (due to clap sound) is received by the microcontroller.
The data pins of the LCD are connected to port P2 of microcontroller AT89C51 while the control pins (RS, R/W & EN) are connected to pins 1-3 of port P1, respectively. The microcontroller receives sound pulses through the first pin of port P0.
Project Source Code
###
// Program to display two consequtive messages one after the other with the sound of a clap #include<reg51.h> #define port P1 #define dataport P2 //Data port for LCD #define sec 1000 sbit rs = port^0; //Control pins for LCD sbit rw = port^1; sbit e = port^2; sbit sensor_input=P0^0; void delay(unsigned int msec) // Time delay function { int i,j ; for(i=0;i<msec;i++) for(j=0;j<1275;j++); } void lcd_cmd(unsigned char item) //Program to send command to LCD { dataport = item; rs= 0; rw=0; e=1; delay(1); e=0; return; } void lcd_data(unsigned char item) // Program to send data to LCD { dataport = item; rs= 1; rw=0; e=1; delay(1); e=0; return; } void lcd_data_string(unsigned char *str) // Program to send string to LCD { int i=0; while(str[i]!='