Final Report
Final Report
2.PROJECT SPECIFICATION
Our project ”TOKEN NUMBER DISPLAY SYSTEM WITH VOICE” basically displays
the number and speaks out that number.
In this system we have used password system for security purpose.If a wrong password
is entered for more than three times, system gets locked and it gets displayed on LCD.
We have used APR9600 recordable and playable IC which works for 60 seconds. Our
project requires a power supply of 5V , 500mA.
1
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
3. LITERATURE SURVEY
2
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Our project deals with saving electricity ,which is one form of conventional
energy source in the hotels. This project can also be implemented in the industries, chemical
laboratories etc.
Reference:1.http://www.esskayinstitute.com/hotelpmpc.html
2.http://www.datasheet4u.com/html/p/8/9/p89v51rd2-philipssemiconductors.pdf.html
3.http://www.kpsec.freeuk.com/components/relay.html
Books: 1.The 8051 microcontroller and embedded system : Pearson Education By-Mazidi
3
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
1.Power supply:
From single phase 230V,50 Hz supply available from the mains we have designed
4
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
This is the basic block in the system which controls functions of each
block.AVR at mega 16 microcontroller receives the commands from Hyper Terminal. These
commands are operated under the control of software which are stored in ROM
.Microcontroller continuously monitors the commands which are coming from Hyper
Terminal and according to that it takes action.
5.Keyboard:
LCD displays numbers as well as characters. We are using 16*2 LCD which
displays 16 characters in one line. There are such 2 lines. It works on +5v,500mA DC power
5
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
supply.
7.Speech Circuit:
We are using APR9600 as speech circuit. The APR9600 device offers true single-
chip voice recording, non-volatile storage, and playback capability for 40 to 60 seconds. The
device supports both random and sequential access of multiple messages.
6
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
7
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
First of all the mains voltage is step down by step down transformer. The
secondary voltage is rectified to get pulsating dc which is filtered to get smooth dc
(unregulated dc voltage). Microcontroller requires stable 5V dc supply for proper functioning
which is achieved by use of 5V regulator.
Microcontroller gets reset pulses for every power on which ensures proper
running of software avoiding unnecessary hang-ups of software. Clock for microcontroller is
generated by crystal oscillator (8 MHz) which is in_built in microcontroller.
When the microcontroller receives the command through the Hyper Terminal
or the push buttons, the relays will be toggled through the relay driver circuitry and the
respective appliance will turn on or off. The respective status of the appliance will be
displayed on the monitor.
8
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
9
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
10
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
6.1 Micro-Controller
As mentioned earlier microcontroller is the heart of this circuit. The microcontroller used in this
project is IC 89V51RD2 of Philips. It is from 8051 family. This microcontroller contains 1kbytes
of RAM, 64K bytes of on-chip flash program memory ,ISP mode, TTL- and CMOS-compatible
logic levels ,one serial port and four ports(each 8bits wide) all on a single chip.
Pin no P0.1,P0.1,P0.2 are connected to Relays and P0.4,P0.5,P0.6 and connected to push buttons.
Port 3 is used for serial communication. Pin 12 and 11 of MAX232 is connected to p3.0(RxD)
and p3.1(TxD) respectively which is used to voltage conversion. P3.2(INTO
INTO) and P3.3(INT1
INT1) is
connected to RS232.
XTAL1 and XTAL2 are connected to a crystal of frequency 11.0952Mhz.
Pin no 31 – EA/Vpp – External access Enable - externally held low to enable the device to fetch
code from external program memory locations 0000H to FFFFH. If EA is held high, the device
executes from internal program memory. This pin also receives the 5 V / 12 V programming
supply voltage (VPP) during Flash programming. If security bit 1 is programmed, EA will be
internally latched on Reset.
In our circuit ,we have kept it high because an external memory is not connected to the
microcontroller.
Pin no 30 is connected to Vcc using a resistor of 8.2k
PSEN – Pin no 29 - The read strobe to external program memory. When the device is executing
code from the external program memory, PSEN is activated twice each machine cycle, except
that two PSEN activations are skipped during each access to external data memory. PSEN is not
activated during fetches from internal program memory.
In out circuit a jumper is used to Gnd or to give Vcc whenever required( i.e to switch to run
mode or program mode whenever required).
For more details about the port, please refer datasheet attached to this report at the end.
Oscillator Circuit : -
11
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Any micro controller requires circuitry that generates the clock pulses by which
all internal operations are synchronized.
PIN 18(XTAL1)
PIN 19 ( XTAL2)
12MHz
C R Y STAL
C 1 22pF C 2 22pF
F i g .O s c i l l a t o r Circuit
In AT 89C51 two pins viz.pin no 18 &19 ( XTAL1 & XTAL2 ) are provided for connecting
a resonant network to form an oscillator. A quartz crystal is used with ceramic capacitors as
shown in above circuit diagram. The crystal frequency is the basic internal frequency of the
micro controller. The range of the crystal that can be connected to the micro controller is
1Mhz to 16 Mhz. Different crystals are available such as the Quartz, Rochelle salts, and
Tourmaline etc. We have preferred to use Quartz crystal because it is inexpensive and readily
available.
C1 and C2 are between 10pF to 40 pF. The capacitors C1, C2 are used for stable frequency
operation i.e. in the condition where there is high noise and humidity as in the case of
factories. Due to this the oscillator frequency can alter, for the suppression or do we can say
deletion of this the two capacitor are used for stable frequency
C * 12d
T= _________
Crystal Freq.
12
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Reset Circuit:
The 8051 uses an active high reset pin. The reset input must go high for two machine cycles
when power is first applied and then sink low. We have used simple RC circuit, which
provide system voltage(Vcc) to the reset pin until the capacitor begins to charge .The time
for which the reset pin is kept high depends on the RC time constant of the reset circuit.
Recommended time =1 ms
Reset time=RC time constant = 8.2 kΩ * 10µf = 8.2ms
13
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Pull-up Resistor:
Formulae:
RPull-Up {min} = ( [Vcc {max} - VOL] / [IOL - NumInput Unit Loads {Low} * IIL] )
RPull-Up (max) = ( [Vcc {min} - VOH] / [IOH * NumOutput Unit Loads + NumInput Unit
Loads {High} * IIH] )
NumInput Unit Loads {Low} = the number of input devices connected to the wired-OR
NumOutput Unit Loads = the number of Open Collector devices connected together
R pull- up(min)=(5.2-0.45)/(26mA-50µA)
=182.32Ω
R pull-up(max)=(4.8-3.75)/(0.2mA-800µA)
=10,005 Ω
=10kΩ
14
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Ic
Relay coil
Ib C
B
Resister(Rb)
E
Rb=(5-0.7)/0.5*10^-3
=8.6KΩ ~ 10KΩ
Rb=10KΩ
15
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
1)Transformer Design:
Vdc = 5+2 = 7V
So at the regulator input , the voltage applied should be of 7V.
16
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Vdc = 2Vm/Pi
Assuming there is no ripple Capacitor from
Vm= Vdc .pi/2
= (7 x 3.14)/2
= 10.99V
Vm= 10.99V
Vim=12.39V
Vrms = Vim/sqrt(2)
= 12.39/sqrt(2)
= 8.76V
Vrms = 8.76V
So we select transformer of 9V.
17
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Irms= Im/sqrt(2)
= 628mA/sqrt(2)
= 444.06mA
Irms = 444.06mA
So we select the transformer of current rating 500mA.
R = Vdc/Idc
= 7 / 400m
= 17.5Ohms.
Vr = 2(Vim – Vdc)
= 2(12.39 – 7)
= 10.78V
18
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
C = Vdc/ (FxRxVr)
= 7/ (100x17.5x10.78)
= 371.05uF
So for Safe working we select capacitor of 1000uF
C = 1000uF / 35V
C1= 1000uF/35V Electrolytic Capacitor.
C2,C4 = 0.1uF Ceramic Capacitor.
C3 = 220uF/25V Electrolytic Capacitor.
So the power supply made from the above mentioned components gives the output of 5V.
7. SOFTWARE PART
7.1 ALGORITHM:
1. Start.
2. Declare the keys at port 0 lower bits.
3. Declare LED’s at port 0 lower bits.
4. Display “ Hotel Power Management “.
5. Declare variables.
6. Configure keys as input pins.
7. Initialize timer 0.
8. Call uart initialization function:
a) Set serial communication format.
b) Load 50H in SBUF, 8 bit auto reload mode.
c) Assign highest priority to serial interrupt.
d) Make timer 2 on.
9. Disable serial interrupt.
19
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
10. Empty any character in SBUF to assure that no garbage is transmitted or received.
11. Give some delay using for loop.
12. Check for key press, if any.
13. Give some delay to check for de-bouncing.
14. If a particular key press is detected then:
a) Disable that key.
b) Toggle the corresponding LED status.
15. If RI=1 and SBUF contains ASCII values of 1,2 or 3 (31H,32H,33H respectively) then:
a) Clear SBUF.
b) Toggle the status of LED.
c) Clear RI for the reception of next key press.
16. If no key press then go to step 12.
17. Stop.
FLOWCHART
START
Declare variables
20
Initialize timer 0
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
21
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
22
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
7.3 CODE
#include<avr/io.h>
#include<util/delay.h>
unsigned char j=0,l=0;
unsigned char x=0,y=0,ms=0;
unsigned char i,value;
unsigned char p,keycode,C=0,K=0;
#define RS PB0
#define EN PB2
#include <compat/deprecated.h>
int password[]={'1','2','3','4'};
int try1=0,o=0;
int f=1,g=0,h=0;
int c=1;
void LCD_init(void)
23
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
{
wrcomm(0x38); //initialize LCD 2 lines, 5x7 matrix 00111000
wrcomm(0x06);//entry mode
wrcomm(0x01);//Clear LCD
wrcomm(0x80); //fist line first column
wrcomm(0x0C); //Display on, Cursor Blinking
//wrcomm(0x08);
}
{
cbi(PORTB,RS);//
PORTC = Command;
sbi(PORTB,EN);
_delay_ms(20);
cbi(PORTB,EN);
_delay_ms(20);
}
void wrdata(unsigned char Data)
{
sbi(PORTB,RS);
PORTC = Data;
sbi(PORTB,EN);
_delay_ms(20);
cbi(PORTB,EN);
_delay_ms(20);
}
24
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
while (*string)
wrdata(*string++);
}
unsigned char a[10],k=0;
25
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
}
if(l==1)
{
l=0;
}
}
break;
//0
case(0b10111011): { if(K==1){store_value('0');}}
break;
//#
case(0b11011101):
{
if(g==1)
{wrcomm(0x01); LCD_String("Enter *TOKEN* No");K=1;k=0,h=0;}}
break;
//D
case(0b11011110):{
wrcomm(0x01);
wrcomm(0x80);
LCD_String("Playing Token No.");
wrcomm(0xC0);
DDRD=255;
26
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
if(a[0]=='1')
{
wrdata(a[i]);
cbi(PORTD,PD0);
_delay_ms(500);
sbi(PORTD,PD0);
//goto out;
}
else if(a[i]=='2')
{
wrdata(a[i]);
cbi(PORTD,PD1);
_delay_ms(500);
sbi(PORTD,PD1);
//goto out;
}
else if(a[i]=='3')
{
wrdata(a[i]);
cbi(PORTD,PD2);
_delay_ms(500);
sbi(PORTD,PD2);
//goto out;
}
else if(a[i]=='4')
{
wrdata(a[i]);
cbi(PORTD,PD3);
_delay_ms(500);
sbi(PORTD,PD3);
27
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
//goto out;
}
else if(a[i]=='5')
{
wrdata(a[i]);
cbi(PORTD,PD4);
_delay_ms(500);
sbi(PORTD,PD4);
//goto out;
}
else if(a[i]=='6')
{
wrdata(a[i]);
cbi(PORTD,PD5);
_delay_ms(500);
sbi(PORTD,PD5);
//goto out;
}
else if(a[i]=='6')
{
wrdata(a[i]);
cbi(PORTD,PD6);
_delay_ms(500);
sbi(PORTD,PD6);
//goto out;
}
28
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
break;
//***********************************************************
//C
case(0b11011011):
{
wrcomm(0x01);
wrcomm(0x80);
LCD_String("Checking ur PASSWORD ");
wrcomm(0xC0);
//****************************************************************************
****
unsigned char n=0;
while(n<4)
{_delay_ms(1000);
if(a[n]!=password[n])
{
try1++;
wrcomm(0x01);
wrcomm(0x80);
LCD_String("PASSWORD Mismatch");
wrcomm(0xc0);
LCD_String("try again");
K=1;k=0;
wrcomm(0x01);
wrcomm(0x80);
LCD_String("ENTER UR PASSWORD");
29
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
if(try1==3)
{
wrcomm(0x01);
wrcomm(0x80);
LCD_String("system locked");
wrcomm(0xC0);
LCD_String("beep........");
wrcomm(0x01);
wrcomm(0x80);
LCD_String("UNAUTHORIZED ACESS");
cbi(PORTD,PD7);
_delay_ms(500);
sbi(PORTD,PD7);
return 0;
}
break;
}
if(n==3)
{
wrcomm(0x01);
o=5;
30
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
}
n++;
}
while(o==5)
{
LCD_String("PASSWORD MATCHED ");
wrcomm(0xc0);
LCD_String("YOU R WELCOME");
_delay_ms(1000);
g=1;
return 1;
goto out;
}
}
break;
//****************************************************************************
********
//7
case(0b01111101):{ if(C==1){wrcomm(0x01);C=0;}if(K==1){store_value('7');}}
break;
//8
case(0b11101011):{ if(C==1){wrcomm(0x01);C=0;}if(K==1){store_value('8');}}
break;
31
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
//9
case(0b11100111):{ if(C==1){wrcomm(0x01);C=0;}if(K==1){store_value('9');}}
break;
//4
case(0b01111011):{ if(C==1){wrcomm(0x01);C=0;}if(K==1){store_value('4');}}
break;
//5
case(0b01110111):{ if(C==1){wrcomm(0x01);C=0;}if(K==1){store_value('5');}}
break;
//6
case(0b01111110):{ if(C==1){wrcomm(0x01);C=0;}if(K==1){store_value('6');}}
break;
//C
//C
//1
case(0b10110111):{ if(C==1){wrcomm(0x01);C=0; }if(K==1){store_value('1');}}
break;
//2
case(0b10111110):{ if(C==1){wrcomm(0x01);C=0;} if(K==1){store_value('2');}}
break;
//3
case(0b10111101):{if(C==1){wrcomm(0x01);C=0;} if(K==1){store_value('3');}}
32
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
break;
//A
case(0b11101110):{ wrcomm(0x01); }
break;
}
if(p==4)
{
p=0;
}
}
out:;
return 1;
}
void main()
{
DDRA=0XF0;
DDRB=0XFF;
DDRC=0XFF;
PORTB=255;
DDRD=255;
PORTD=255;
LCD_init();
LCD_String ( "Enter Your Password" );
K=1;k=0,h=1,c=1;
//_delay_ms(1000);
33
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
//wrcomm(0x01);
while(f==1)
{
f= TOKEN_STANDBY();
}
}
34
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
Debugging:
Complete code has been simulated on studio4 software.
Performance analysis:
The 12V relay, was getting supply of 10.99V as well as of 5V , due to which it was it
continuously on and we could not detect which LED was on. Then we gave only 10.99V supply
After debugging we checked the working of complete project .
The microcontroller receives the command from the PC and successfully it toggled the status of
LED.
35
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
36
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
10.SPECIFICATIONS
ELECTRICAL SPECIFICATIONS:
AC mains: 230V,50Hz
37
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
MECHANICAL SPECIFICATIONS:
1.PCB size:14.5cm*6.5cm=94.25 sq.cm
11.BILLING OF MATERIAL
1.FOR POWER SUPPLY:
38
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
1.
2 Bridge IC (1Amp)-Round 1 20
3. 7805 1 8
4. Electrolitic Capacitor 1000uF/35V 1 2
5. 1 2
Electrolitic Capacitor 220uF/25V
6. 0.1uF Ceramic Capacitor 2 4
7. Relemate -2-pin 2 2
2.MICROCONLLER CARD:
NO. PART NAME QUANTITY AMOUNT
1. Microcontroller P89V51RD2 1 180
2. 40 Pin Base 1 10
3. Resistance Network 9 pin/10K 1 4
4. 1 2
10uf/63V Electrolitic Capaccitor
5. Resistance-8.2K 1 1
6. Crystal 11.0592Mhz 1 16
7. 22pF Ceramic Capacitor 2 2
8. 4-PinRelemate-serial 1 2
9. MAX232 1 30
10. 1uF/35V 5 10
11. IC base 16 pin 1 8
12. Two core wire with two pin for mains
13. BC547 3 6
14. capacitor 10µf 1 2
15. resistor 10k 3 3
16. Resistor 470Ω 6 6
17. Relay(5V) 2 100
18. Relay(12V) 1 200
TOTAL 1117
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
ADVANTAGES:
1. Our project saves the unnecessary use of electricity.
2. Devices can be controlled automatically through the Hyper Terminal.
3. The project can not only be implemented in the rooms of the hotel but also can be
implemented in the corridors, kitchens, gardens.
40
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
4. Relay is cheaper than MCB and hence relays can replace MCB’s.
DISADVANTAGES:
1. Wiring complexity is increased.
2. This system completely relies on PC.
13.FUTURE EXPANSION
Our project can be implemented using wireless system. Hence the disadvantage of
increased wiring complexity can be overcome.
41
TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE
14.CONCLUSION
Thus basically our project “HOTEL POWER MANAGEMENT” is designed for saving
electricity.
42