Clap Counter

download Clap Counter

If you can't read please download the document

description

Clap Counter

Transcript of Clap Counter

Clap counter using 8051 microcontroller (AT89C51) Summary Description Circuit Diagram Code Components SummaryThis article explains the concept behind interfacing a sound sensor with the 8051 microcontroller (T8!C51"# This pro$ect increases the count by one e%ery time a sound is produced# &t wor's well with the sound of a clap# The number of claps is displayed on an (CD module# The circuit consists of four modules) namely) a sound sensor) an amplifying circuit) a control circuit and a display module# The code for interfacing the sound sensor with the *C+ is written in C language#Description The connections of different modules are shown in the circuit diagram# The data pins of the (CD are connected to port ,-) while the control pins (.S) ./0 1 23" are connected to pins 145 of port ,1of T8!C51) respecti%ely# The microcontroller recei%es sound pulses through the first pin of port ,0# condenser microphone is used to sense the sound produced by the clap# This mic is connected to a two stage transistor amplifier# The mic output is thus amplified to a suitable le%el so that it can be detected at the TT( logic#switching circuit made from a single transistor is also employed after the amplifier# The purpose of this circuit is to con%ert the analog signals into discrete digital signals) which are used as input for the *C+#The output of the amplifier is coupled with a transistor switch# 0hene%er a high %oltage output is recei%ed from the amplifier) it generates a pulse# The transistor switching circuitalso ensures that a high TT( logic is not recei%ed at the microcontroller due to noise signals#The pulse) from the switching circuit) is fed to the microcontroller) which is programmed to detect the pulses# 2%ery time a pulse in detected) the count %alue is increased by one#The output is displayed on a 16x- (CD screen# Thesensiti%ityofthesoundsensorcanbeincreasedbyimpro%ingthecircuit ofthe amplifying unit# n op4amp can be used to increase the sensiti%ity# Circuit DiagramCode// Program to count the number of clap#include#define port P1#define dataport P2//Data Port for LCD#define sec 1sbit rs ! port"#sbit r$ ! port"1#sbit e ! port"2#sbit sensor%input!P"#unsigned char str&'1(!)* *+* *+* *+* *+* *+* *+* *+* *+* *+* *,#-oid dela./unsigned int msec0 // 1ime dela. function)int i+2 #for/i!#i0)str&'i(!/num;103