60% found this document useful (5 votes)
7K views4 pages

Clap Counter Using 8051 Microcontroller (AT89C51) : Description Circuit Diagram Code Components

This document summarizes a project that uses an 8051 microcontroller to count claps detected by a sound sensor and display the count on an LCD screen. A condenser microphone senses sound and an amplifier circuit amplifies the signal. The microcontroller is programmed to detect pulses from the amplifier and increase the count displayed on the LCD with each pulse.

Uploaded by

Karthik Dm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
60% found this document useful (5 votes)
7K views4 pages

Clap Counter Using 8051 Microcontroller (AT89C51) : Description Circuit Diagram Code Components

This document summarizes a project that uses an 8051 microcontroller to count claps detected by a sound sensor and display the count on an LCD screen. A condenser microphone senses sound and an amplifier circuit amplifies the signal. The microcontroller is programmed to detect pulses from the amplifier and increase the count displayed on the LCD with each pulse.

Uploaded by

Karthik Dm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Clap counter using 8051 microcontroller (AT89C51)

Summary
Description
Circuit Diagram
Code
Components
Summary
This 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 circuit
also 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#
The sensiti%ity of the sound sensor can be increased by impro%ing the circuit of the
amplifying unit# n op4amp can be used to increase the sensiti%ity#


Circuit Diagram
Code
// Program to count the number of clap
#include<reg51.h>
#define port P1
#define dataport P2 //Data Port for LCD
#define sec 1
sbit 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!#i<msec#i330
for/2!#2<1245#2330#
,
-oid lcd%cmd/unsigned char item0 // 5unction to send command
)
dataport ! item#
rs! #
r$!#
e!1#
dela./10#
e!#
return#
,
-oid lcd%data/unsigned char item0 // 5unction to send data
)
dataport ! item#
rs! 1#
r$!#
e!1#
dela./10#
e!#
return#
,
-oid lcd%data%string/unsigned char 6str0 // 5unction to send string
)
int i!#
$hile/str'i(7!*8*0
)
i33#
,
$hile/i>!0
)
lcd%data/str'i(0#
i99#
dela./10#
,
return#
,
-oid con-ert/int num0 // 5unction to e:tract digits and send to LCD
)
int i!#
$hile/num>0
)
str&'i(!/num;103<=#
num!num/1#
i33#
,
str&'i(!*8*#
,

-oid main/0
)
int count!#
sensor%input!1#
sensor%input!#
lcd%cmd/:&=0#
lcd%cmd/:e0#
lcd%cmd/:10#
$hile/10
)
sensor%input!#
$hile/sensor%input!!0#
if/sensor%input!!10
)
lcd%cmd/:10#
count33#
con-ert/count0#
lcd%cmd/:=20#
lcd%data%string/str&0#
,
,
,

Components
Condenser *icrophone
(CD
*icrocontroller T8!C51
,reset
Transistor 7C589
Transistor 7C588
-51 reads

You might also like