TE-2 (E&TC




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.


TE-2 (E&TC)


Nowadays, conventional energy sources are on the verge of extinction. So it is the need of the hour to save these conventional energy sources for future use. This can be done by the efficient utilization of these resources.


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


1.The 8051 microcontroller and embedded system : Pearson Education By-Mazidi

2. Electronic Devices By ± Floyd


TE-2 (E&TC)



1.Power supply:
From single phase 230V,50 Hz supply available from the mains we have designed 4

com) as a voltage converter. Since the RS232 is not compatible with today¶s microprocessor¶s we have used MAX232 voltage converter to convert the RS232 signals to TTL voltage level that will be acceptable to the microcontroller. 3. 500mA dc power supply using a step down transformer. PC: PC is used to give a command to the microcontroller for the operation of the appliances through Hyper Terminal using serial communication. These commands are operated under the control of software which are stored in ROM .TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE +5V. There are such 2 lines. 2.Keyboard: We are using 4*4 matrix keyboard. 6.Voltage Converter: In our project we have used MAX232 from the Maxim Corporation (www.500mA DC power 5 . 5. 4.Microcontroller continuously monitors the commands which are coming from Hyper Terminal and according to that it takes action. Microcontroller: This is the basic block in the system which controls functions of each block. We are using 16*2 LCD which displays 16 characters in one line. This keyboard is interfaced with microcontroller.AVR at mega 16 microcontroller receives the commands from Hyper Terminal. It works on +5v. LCD(Liquid Crystal Display): LCD displays numbers as well as characters. We can also observe the status of the appliances on the monitor whether they are on or off and thereby control them.maxim_ic.

6 . TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 7. The APR9600 device offers true singlechip voice recording. The device supports both random and sequential access of multiple messages.TE-2 (E&TC) supply. and playback capability for 40 to 60 seconds. non-volatile storage.Speech Circuit: We are using APR9600 as speech circuit.


The respective status of the appliance will be displayed on the monitor. When the microcontroller receives the command through the Hyper Terminal or the push buttons. We are using serial communication for giving command through Hyper Terminal. 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. The secondary voltage is rectified to get pulsating dc which is filtered to get smooth dc (unregulated dc voltage). therefore it requires a line driver such as the MAX232 chip to convert RS232 voltage levels to TTL levels and vice versa.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE WORKING OF CIRCUIT DIAGRAM: First of all the mains voltage is step down by step down transformer. Clock for microcontroller is generated by crystal oscillator (8 MHz) which is in_built in microcontroller. 8 . the relays will be toggled through the relay driver circuitry and the respective appliance will turn on or off. The RS232 standard is not TTL compatible .



EA will be internally latched on Reset. If security bit 1 is programmed. This pin also receives the 5 V / 12 V programming supply voltage (VPP) during Flash programming.2(INTO) and P3.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 6. please refer datasheet attached to this report at the end.5. Pin no P0.P0.1 Micro-Controller As mentioned earlier microcontroller is the heart of this circuit. Pin no 31 ± EA/Vpp ± External access Enable .3(INT1) is I I connected to RS232. In our circuit . MODULEWISE DESIGN OF CIRCUIT 6. The microcontroller used in this project is IC 89V51RD2 of Philips.1.one serial port and four ports(each 8bits wide) all on a single chip. This microcontroller contains 1kbytes of RAM.0(RxD) and p3. Pin 12 and 11 of MAX232 is connected to p3.we have kept it high because an external memory is not connected to the microcontroller. It is from 8051 family.externally held low to enable the device to fetch code from external program memory locations 0000H to FFFFH. TTL.and CMOS-compatible logic levels .1(TxD) respectively which is used to voltage conversion.4. If EA is held high. For more details about the port.ISP mode. except that two PSEN activations are skipped during each access to external data memory.1. Port 3 is used for serial communication. When the device is executing code from the external program memory.P0.0952Mhz. XTAL1 and XTAL2 are connected to a crystal of frequency 11.e to switch to run mode or program mode whenever required). In out circuit a jumper is used to Gnd or to give Vcc whenever required( i. 64K bytes of on-chip flash program memory .P0. P3.2 are connected to Relays and P0. Pin no 30 is connected to Vcc using a resistor of 8. Oscillator Circuit : - 11 . PSEN is activated twice each machine cycle. PSEN is not activated during fetches from internal program memory.6 and connected to push buttons. the device executes from internal program memory.2k PSEN ± Pin no 29 .The read strobe to external program memory.P0.

The crystal frequency is the basic internal frequency of the micro controller. for the suppression or do we can say deletion of this the two capacitor are used for stable frequency C * 12d T= _________ Crystal Freq.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. We have preferred to use Quartz crystal because it is inexpensive and readily available. in the condition where there is high noise and humidity as in the case of factories. 12 .e. 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. PIN 18(XTAL1) PIN 19 ( XTAL2) 12MHz CRY STAL C1 22pF C2 22pF Fig. and Tourmaline etc. Due to this the oscillator frequency can alter. C1 and C2 are between 10pF to 40 pF.Oscillator Circuit In AT 89C51 two pins viz. C2 are used for stable frequency operation i. A quartz crystal is used with ceramic capacitors as shown in above circuit diagram. The capacitors C1.pin no 18 &19 ( XTAL1 & XTAL2 ) are provided for connecting a resonant network to form an oscillator.

We have used simple RC circuit. The value of the resistor is assumed as 8.2ms The value of the capacitor used is calculated using following steps. Vc = Vcc (1-e ±t/RC) 13 . which voltage(Vcc) to the reset pin until the capacitor begins to charge .2 kŸ * 10µf = 8. Capacitor voltage during discharging is Vc = Vcc * e ±t/RC And during discharging is.The time kept high depends on the RC time constant of the reset circuit.2K and the value of the capacitor is calculated using following formula. provide system for which the reset pin is Recommended time =1 ms Reset time=RC time constant = 8. The reset input must go high for two machine cycles when power is first applied and then sink low.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE Reset Circuit: The 8051 uses an active high reset pin.

8-3.NumInput Unit Loads {Low} * IIL] ) RPull-Up (max) = ( [Vcc {min} .45)/(26mA-50µA) =182.2 Relay Driver Circuit: 14 .75)/(0.2-0. y I IL ± The current flowing out of an input when a specified low voltage is applied . y IIH _ The current flowing into an input when a specified high volage is applied .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 y VOL-The maximum voltage at an output terminal sinking the maximum specified load current IOL y IOL ±The current flowing into an output which is in the low state y IOH ± The leakage current flowing into a turned off open collector output with a specified high output voltage applied .up(min)=(5.32Ÿ R pull-up(max)=(4.2mA-800µA) =10.For devices with pull up circuit IOH is the current flowing out of an output which is in the high state . R pull.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE Pull-up Resistor: Formulae: RPull-Up {min} = ( [Vcc {max} .VOL] / [IOL .005 Ÿ =10kŸ 6. y NumOutput Unit Loads ±Number of output unit loads to be applied .

6KŸ ~ 10KŸ Rb=10KŸ 15 . Ic=coil voltge/coil current Ic=5V/66. Therefore when relay toggles microcontroller sink more current and get damaged therefore we are using transistor as a switch for proper working of relay.7)/0.5mA By applying KVL to above circuit. Ic Relay coil Ib Resister(Rb) C B E From datasheet =150 Ic is collector current .5*10^-3 =8. Vcc-IbRb-Vbe=0 Rb=(5-0. in our circuit it is the current flowing through coil of relay.5Ÿ =75mA But Ic= *Ib Ib=Ic/ Ib=0.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE We require relay driver ckt because current sinking capacity of microcontroller is very low and to toggle the relay we require more current.

8V/10mA=380Ÿ~470Ÿ R=470Ÿ. R=V/I =5V-1.2v drop across LED Therefore. 6. the voltage applied should be of 7V. 16 .2V/10mA=3.5 Power Supply Component Design 1)Transformer Design: We require 5V at the o/p of the regulator. The drop out voltage of the regulator is 2V(As per the data sheet) Vdc = 5+2 = 7V So at the regulator input .3For LED driver circuit: LED has limit 10mA to 25mA so we require register to drive the LED Here we take greater than10mA current flowing through LED and there is 1.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 6.

14)/2 = 10.14/2 = 628mA.99V During one cycle.7V Drop out voltage of two diode = 1.76V So we select transformer of 9V.99+1.76V Vrms = 8.39V Vim=12. 17 .39V Vrms = Vim/sqrt(2) = 12.4 = 12. TOKEN NUMBER DISPLAY SYSTEM WITH VOICE Vdc = 2Vm/Pi Assuming there is no ripple Capacitor from Vm= Vdc .39/sqrt(2) = 8.TE-2 (E&TC) According to the formula. Similarly Im=Idc x pi/2 Im=400m x 3.4V Vim = Vm+ 1. Drop out voltage of one diode = 0.pi/2 = (7 x 3.4V = 10.99V Vm= 10. two diodes are conducting .

Considering the above transformer rating.78V 18 . we select the bridge IC of 1Ampere rating.06mA Irms = 444.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE Irms= Im/sqrt(2) = 628mA/sqrt(2) = 444. We take the transformer of 0-9V/500mA TRANSFORMER ± 0-9V/500mA Stepdown transformer. 2) Recitifier Design: PIV of diode = Vm = 12.39V Im= 628mA BRIDGE RECTIFIER -So.39 ± 7) = 10.5Ohms. 3) Filter Capacitor Design: R = Vdc/Idc = 7 / 400m = 17.06mA So we select the transformer of current rating 500mA. Vr = 2(Vim ± Vdc) = 2(12.

TE-2 (E&TC) C = Vdc/ (FxRxVr) = 7/ (100x17. 7.78) = 371. Declare LED¶s at port 0 lower bits. Configure keys as input pins. d) Make timer 2 on. b) Load 50H in SBUF. 2. Start. Display ³ Hotel Power Management ³. SOFTWARE PART 7. c) Assign highest priority to serial interrupt. 9. C3 = 220uF/25V Electrolytic Capacitor. Declare variables. 5. So the power supply made from the above mentioned components gives the output of 5V. 19 .1uF Ceramic Capacitor. 8 bit auto reload mode. Initialize timer 0.1 ALGORITHM: 1. 8.05uF TOKEN NUMBER DISPLAY SYSTEM WITH VOICE So for Safe working we select capacitor of 1000uF C = 1000uF / 35V C1= 1000uF/35V Electrolytic Capacitor. 6. Declare the keys at port 0 lower bits.C4 = 0.5x10. 7. Disable serial interrupt. 3. 4. Call uart initialization function: a) Set serial communication format. C2.

Empty any character in SBUF to assure that no garbage is transmitted or received. 15. Check for key press. LED¶s at port 0 lower bits Display ³ Hotel Power Management ³ Declare variables Configure keys as input pins 20 Initialize timer 0 .33H respectively) then: a) Clear SBUF. Give some delay to check for de-bouncing. 17. c) Clear RI for the reception of next key press.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 10. If a particular key press is detected then: a) Disable that key. if any. 12. Give some delay using for loop. 11. b) Toggle the status of LED. Stop. If no key press then go to step 12. FLOWCHART START Declare keys at port 0 upper bits.32H. 13. 14. 16. If RI=1 and SBUF contains ASCII values of 1.2 or 3 (31H. b) Toggle the corresponding LED status.



int c=1. int f=1.keycode. unsigned char p.g=0.y=0.K=0.'4'}.h> #include<util/delay.value. int try1=0. unsigned char x=0.h> unsigned char j=0.h> int password[]={'1'.3 CODE #include<avr/io.l=0. 23 .h=0.C=0.'3'.'2'.ms=0. unsigned char i.o=0.TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 7. #define RS PB0 #define EN PB2 #include <compat/deprecated.

_delay_ms(20).EN). _delay_ms(20). } void LCD_String ( unsigned char *string) 24 . cbi(PORTB.//entry mode wrcomm(0x01). } void wrcomm(unsigned char Command) { cbi(PORTB.// PORTC = Command. //Display on. 5x7 matrix 00111000 wrcomm(0x06).TE-2 (E&TC) void LCD_init(void) { TOKEN NUMBER DISPLAY SYSTEM WITH VOICE wrcomm(0x38).EN). } void wrdata(unsigned char Data) { sbi(PORTB.EN).RS). //initialize LCD 2 lines. PORTC = Data. _delay_ms(20). Cursor Blinking //wrcomm(0x08). sbi(PORTB. _delay_ms(20). sbi(PORTB. cbi(PORTB.//Clear LCD wrcomm(0x80). //fist line first column wrcomm(0x0C).EN).RS).

_delay_ms(50).k=0. } unsigned char a[10]. } unsigned char TOKEN_STANDBY() { for(p=0. wrdata(' ').TE-2 (E&TC) { while (*string) wrdata(*string++). TOKEN NUMBER DISPLAY SYSTEM WITH VOICE store_value(unsigned char value) { a[k]=value. else wrdata('*'). k++.p<4. keycode=PINA. 25 . if(h==0) wrdata(value). wrcomm(0x10). switch(keycode) { case(0b11010111):{ if(K==1) { wrcomm(0x10). wrcomm(0xc0+k).p++) { PORTA=(0b11101111<<p) | 0x0f.

K=1. } } break. LCD_String("Playing Token No."). //# case(0b11011101): { if(g==1) {wrcomm(0x01). //0 case(0b10111011): { if(K==1){store_value('0'). //D case(0b11011110):{ wrcomm(0x01). wrcomm(0xC0). wrcomm(0x80).h=0. LCD_String("Enter *TOKEN* No").k=0.}} break. } if(l==1) { TOKEN NUMBER DISPLAY SYSTEM WITH VOICE l=0. 26 .}} break.TE-2 (E&TC) k--.

cbi(PORTD. } else if(a[i]=='4') { wrdata(a[i]). sbi(PORTD.PD1). _delay_ms(500). 27 . sbi(PORTD. _delay_ms(500). //goto out.PD3). _delay_ms(500). if(a[0]=='1') { wrdata(a[i]). cbi(PORTD.PD2).PD0).PD1).PD2).PD0).TE-2 (E&TC) DDRD=255. cbi(PORTD. cbi(PORTD. //goto out. _delay_ms(500). //goto out. } else if(a[i]=='3') { wrdata(a[i]). } TOKEN NUMBER DISPLAY SYSTEM WITH VOICE else if(a[i]=='2') { wrdata(a[i]). sbi(PORTD.

//goto out.PD3). _delay_ms(500). //goto out. } else if(a[i]=='6') { wrdata(a[i]). //goto out.PD5).PD6). cbi(PORTD. sbi(PORTD. cbi(PORTD. //goto out. } else if(a[i]=='6') { wrdata(a[i]). sbi(PORTD.PD4). _delay_ms(500). cbi(PORTD. } else if(a[i]=='5') { wrdata(a[i]).PD4). sbi(PORTD. _delay_ms(500).PD5). } TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 28 .PD6).TE-2 (E&TC) sbi(PORTD.

TE-2 (E&TC) } break. wrcomm(0x80). wrcomm(0xc0). wrcomm(0x01). LCD_String("Checking ur PASSWORD "). LCD_String("ENTER UR PASSWORD"). while(n<4) {_delay_ms(1000). if(a[n]!=password[n]) { try1++. 29 . wrcomm(0xC0). LCD_String("PASSWORD Mismatch"). LCD_String("try again"). wrcomm(0x80). wrcomm(0x01). K=1. //**************************************************************************** **** unsigned char n=0. TOKEN NUMBER DISPLAY SYSTEM WITH VOICE //*********************************************************** //C case(0b11011011): { wrcomm(0x01).k=0. wrcomm(0x80).

"). return 0.. LCD_String("system locked").. } break.. wrcomm(0x80). } if(n==3) { wrcomm(0x01).TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE if(try1==3) { wrcomm(0x01).. _delay_ms(500). wrcomm(0x80). wrcomm(0xC0).PD7).. LCD_String("UNAUTHORIZED ACESS").. 30 . LCD_String("beep. wrcomm(0x01). o=5..PD7). sbi(PORTD. cbi(PORTD.

}} break. LCD_String("YOU R WELCOME"). //**************************************************************************** ******** //7 case(0b01111101):{ if(C==1){wrcomm(0x01).TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE } n++. } } break.C=0.}if(K==1){store_value('7'). wrcomm(0xc0). _delay_ms(1000).}if(K==1){store_value('8').}} 31 . goto out. g=1.C=0. } while(o==5) { LCD_String("PASSWORD MATCHED "). //8 case(0b11101011):{ if(C==1){wrcomm(0x01). return 1.

}} break.TE-2 (E&TC) break.}if(K==1){store_value('5').}if(K==1){store_value('4'). //4 case(0b01111011):{ if(C==1){wrcomm(0x01). TOKEN NUMBER DISPLAY SYSTEM WITH VOICE //9 case(0b11100111):{ if(C==1){wrcomm(0x01).}} break. //C //C //1 case(0b10110111):{ if(C==1){wrcomm(0x01). //5 case(0b01110111):{ if(C==1){wrcomm(0x01).}} break. }if(K==1){store_value('1').C=0.}} break.}} break.C=0.} if(K==1){store_value('2'). 32 .C=0.}if(K==1){store_value('9').C=0. //2 case(0b10111110):{ if(C==1){wrcomm(0x01). //6 case(0b01111110):{ if(C==1){wrcomm(0x01).C=0.}if(K==1){store_value('6').C=0.}} break.

K=1. } void main() { DDRA=0XF0. PORTD=255. 33 . } break. LCD_String ( "Enter Your Password" ).h=1.k=0. DDRB=0XFF. return 1.C=0.c=1.} if(K==1){store_value('3').TE-2 (E&TC) //3 TOKEN NUMBER DISPLAY SYSTEM WITH VOICE case(0b10111101):{if(C==1){wrcomm(0x01). //A case(0b11101110):{ wrcomm(0x01).}} break. DDRD=255. } } out:. LCD_init(). DDRC=0XFF. PORTB=255. } if(p==4) { p=0.

while(f==1) { f= TOKEN_STANDBY().TESTING . DEBUGGING & PERFORMANCE ANALYSIS Testing: y 34 We have initially tested our circuit by mounting it on a bread board. //wrcomm(0x01). . } } 8..TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE //_delay_ms(1000).

.TE-2 (E&TC) y TOKEN NUMBER DISPLAY SYSTEM WITH VOICE All pin to pin connections and connectivity is checked using DMM. Then we gave only 10. was getting supply of 10.99V as well as of 5V . Performance analysis: The 12V relay. 35 . The microcontroller receives the command from the PC and successfully it toggled the status of LED. due to which it was it continuously on and we could not detect which LED was on. Debugging: Complete code has been simulated on studio4 software.99V supply After debugging we checked the working of complete project .



1 DPDT) MECHANICAL SPECIFICATIONS: 1.500mA 2 pin AC mains cord 9 pin RS232 cable 4 Relays(3 SPDT.25 sq.50Hz TOKEN NUMBER DISPLAY SYSTEM WITH VOICE Step down transformer: 9 V.5cm*7.PCB size:14.Relay PCB size:9cm*10cm=90 sq.BILLING OF MATERIAL 1.FOR POWER SUPPLY: 38 .TE-2 (E&TC) y y y y y AC mains: 230V.5cm=94.3cm 11.cm 2.cm 3.5cm*6.Mechanical box: 33cm*14.

2K Crystal 11. 16. PART NAME TOKEN NUMBER DISPLAY SYSTEM WITH VOICE QUANTITY AMOUNT 1 9-0 Step down Transformer/500Ma Bridge IC (1Amp)-Round 7805 Electrolitic Capacitor 1000uF/35V Electrolitic Capacitor 220uF/25V 0. 12.TE-2 (E&TC) NO. 6. 15. 17.1uF Ceramic Capacitor Relemate -2-pin 1 1 1 1 2 2 90 20 8 2 2 4 2 2. 2. 13. 11. 5.0592Mhz 22pF Ceramic Capacitor 4-PinRelemate-serial MAX232 1uF/35V IC base 16 pin Two core wire with two pin for mains BC547 capacitor 10µf resistor 10k Resistor 470Ÿ Relay(5V) Relay(12V) QUANTITY 1 1 1 1 1 1 2 1 1 5 1 AMOUNT 180 10 4 2 1 16 2 2 30 10 8 3 1 3 6 2 1 6 2 3 6 100 200 39 . 7. 8. PART NAME 1. 4.MICROCONLLER CARD: NO. 18. 1. 14. 2 3. 6. 7. 4. 9. 10. 3. 5. Microcontroller P89V51RD2 40 Pin Base Resistance Network 9 pin/10K 10uf/63V Electrolitic Capaccitor Resistance-8.

TE-2 (E&TC) 19. 22. Push Button LED Wiring cost RS232 TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 3 6 6 3 20 1 2 100 278 1117 PCB with layout designing TOTAL \ 40 . 21. 20. 23.

TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 12. Relay is cheaper than MCB and hence relays can replace MCB¶s.ADVANTEGES AND DISADVANTAGES ADVANTAGES: 1. gardens. 41 . Devices can be controlled automatically through the Hyper Terminal. The project can not only be implemented in the rooms of the hotel but also can be implemented in the corridors. 2. 4. kitchens. DISADVANTAGES: 1. Our project saves the unnecessary use of electricity. This system completely relies on PC. Wiring complexity is increased. 3. 2.

TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 13.FUTURE EXPANSION Our project can be implemented using wireless system. Hence the disadvantage of increased wiring complexity can be overcome. 42 .

TE-2 (E&TC) TOKEN NUMBER DISPLAY SYSTEM WITH VOICE 14.CONCLUSION Thus basically our project ³HOTEL POWER MANAGEMENT´ is designed for saving electricity. 43 .

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.