35
TABLE OF CONTENTS CHAPTER 1 .......................................................................................................................................... 2 1. Introduction  ..................................................................................................................... ................ 2 1.1. Scenario.............................................................................................................................. ..... 2 1.2. Background and history of elevator  ........................................................................................ 3 1.3. Aims ........................................................................................................................ ................ 4 1.4. Objectives  ............................................................................................................................... 4 1.5. Concept  ................................................................................................................................... 5 CHAPTER 2 .......................................................................................................................................... 6 2. Pre-lab ............................................................................................................................................. 6 2.1. Hardware design ..................................................................................................................... 6 2.1.1.  AT89C52 ......................................................................................................................... 6 2.1.2.  Crystal oscillator  ............................................................................................................. 8 2.1.3.  Voltage regulator ............................................................................................................. 8 2.1.4.  Capacitor  ......................................................................................................................... 8 2.1.5.  LED ................................................................................................................. ................ 8 2.2. Floors and Delays ................................................................................................................... 9 2.3. Flowchart/alg orithm/state transition diagram  ....................................................................... 10 2.4. Embedded C Coding ............................................................................................................. 12 2.5. Simulation  ............................................................................................................................. 13 CHAPTER 3 ........................................................................................................................................ 17 3. Lab works...................................................................................................................................... 17 3.1. Results  ...................................................................................... Error! Bookmark not defined. 3.2. Results evaluation ................................................................................................................. 20 3.3. Post lab ......................................................................................................... ......................... 21 CHAPTER 4 ........................................................................................................................................ 23 4. Conclusion  .................................................................................................................................... 23 REFERENCES ............................................................................................... ..................................... 24 APPENDIX ............................................................................................................................ .............. 25

elevator system using microcontroller

Embed Size (px)

Citation preview

Page 1: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 1/35

TABLE OF CONTENTS 

CHAPTER 1 .......................................................................................................................................... 2

1.  Introduction ..................................................................................................................................... 2

1.1.  Scenario................................................................................................................................... 2

1.2.  Background and history of elevator  ........................................................................................ 3

1.3.  Aims ........................................................................................................................................ 4

1.4.  Objectives ............................................................................................................................... 4

1.5.  Concept ................................................................................................................................... 5

CHAPTER 2 .......................................................................................................................................... 62.  Pre-lab ............................................................................................................................................. 6

2.1.  Hardware design ..................................................................................................................... 6

2.1.1.  AT89C52 ......................................................................................................................... 6

2.1.2.  Crystal oscillator  ............................................................................................................. 8

2.1.3.  Voltage regulator ............................................................................................................. 8

2.1.4.  Capacitor  ......................................................................................................................... 8

2.1.5.  LED ................................................................................................................................. 8

2.2.  Floors and Delays ................................................................................................................... 9

2.3.  Flowchart/algorithm/state transition diagram ....................................................................... 10

2.4.  Embedded C Coding ............................................................................................................. 12

2.5.  Simulation ............................................................................................................................. 13

CHAPTER 3 ........................................................................................................................................ 17

3.  Lab works...................................................................................................................................... 17

3.1.  Results...................................................................................... Error! Bookmark not defined. 

3.2.  Results evaluation ................................................................................................................. 20

3.3.  Post lab .................................................................................................................................. 21

CHAPTER 4 ........................................................................................................................................ 23

4.  Conclusion .................................................................................................................................... 23

REFERENCES .................................................................................................................................... 24

APPENDIX .......................................................................................................................................... 25

Page 2: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 2/35

EE 2003 Lab 1 (Elevator System) U1060761

2

UEL Semester 3/2012

CHAPTER 1

1.  Introduction

1.1. Scenario

The elevator is a very common system that can be seen in multi-storeys buildings. The

design of such a system is aimed at reducing the effort in climbing up and down the

 building. But there are certain buildings which demand utmost security and indications

when there are intruders. As part of the security, it is proposed to implement a security

system to the elevator of the building. But there are certain buildings which demand

utmost security.

Here, the students are expected to design an elevator system with security settings so as to

alert the security when there are intruders. Assuming that the building is UL1 storied,

there are push switches to trigger the respective operations. Assume that there are three

switches, A, B, C for start, move up and down the elevator and UL1 number of switched

inside the elevator.

Triggering of switch A would turn on the system. This system can be operated only by

the authorized person, hence it should be password protected. Thus when the person

triggers the switch A, it should demand for the password. Wrongly entered password

would trigger an alarm, so the security officer would be alerted.

After the person has entered the correct password the system activates the switches A and

B. Pressing of either of the switches would open the door of the lift. Once the person has

entered, the door closes and now the display would show the floor number he is currently

in. There are UL1 switches inside triggering of any of these switches would indicate the

destination of the passenger. This would turn on the motor so that the elevator would

move upwards or downwards as instructed. Assume that it takes UL2 seconds to move to

the subsequent floor.

If any other person who is on a different floor wants to use the elevator to go upwards or

downwards the elevator should stop at the floor he is currently on and open the door,

 provided he has entered the correct password. If the person has triggered the switch C

Page 3: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 3/35

EE 2003 Lab 1 (Elevator System) U1060761

3

UEL Semester 3/2012

when the elevator is going upwards then it will not stop at that floor, provided some other

 person on the same floor has not triggered B and vice versa. Once the other person has

entered he has to use the switches inside the elevator to select his destination. Every

 person who has to use the elevator has to enter the password. This is ensured by checking

the number of times the password is entered and detecting the number of persons

entering. This may be done with the help of sensors. Here another challenge is to identify

the person who has not entered the password and a sound alarm when he tries to enter the

elevator.

1.2. Background and history of elevator

The electric motor was introduced in elevator construction in 1880 by the German

inventor Werner von Siemens. His car, carrying the motor below, climbed its shaft by

means of revolving pinion gears that engaged racks at the sides of the shaft. An electric

elevator was constructed in Baltimore, Maryland, in 1887, operated by an electric motor

turning a revolving drum on which the hoisting rope was wound (National Elevator

Manufacturing Industry Inc.).

Within the next 12 years, electric elevators with worm gearing connecting the motor and

drum came into general use except in tall buildings. In the drum elevator the length of the

hoisting rope, and therefore the height to which the car can rise, are limited by the size of

the drum. The space limitations and manufacturing difficulties prevented the use of the

drum mechanism in skyscrapers. The advantages of the electric elevator, however,

including efficiency, relatively low installation costs, and virtually constant speed

regardless of the load, spurred inventors to search for a way of using electric motive

 power in skyscrapers. Counterweights creating traction on electrically driven sheaves

solved the problem. Since the introduction of electric motive power for elevators, various

improvements have been made in motors and methods of control. Originally the motor

switch and the brakes were operated mechanically from the car by means of hand ropes.

Soon electromagnets, controlled by operating switches in the car, were introduced to

throw the motor switch and to release a spring brake. Push-button control was an early

development, later supplemented by elaborate signal systems. Safety devices have been

highly developed. In 1878 Charles Otis, a son of the inventor of the original car safety,

Page 4: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 4/35

EE 2003 Lab 1 (Elevator System) U1060761

4

UEL Semester 3/2012

introduced a similar mechanism connected to a speed governor that applied the safety if

the car was traveling at a dangerous speed, whether or not the rope broke. In later car

safeties, clamps were used to grip the guide rails so as to bring the car to a stop gradually.

Today so-called governors control a series of devices to slow down the car if it is

speeding only slightly, to shut off the motor and apply an electromagnetic brake if the car

continues to accelerate, and then to apply the mechanical safety if the speed becomes

dangerous. The use of automatic programming equipment eventually eliminated the need

for starters at the ground level of large commercial buildings, and thus the operation of

elevators became completely automatic. Automatic elevators are now generally employed

in all types of buildings. The World Trade Center in New York City, with its two 110

story towers, had 244 elevators with carrying capacities of up to 4536 kg and speeds of up

to 488 m per min The 110-story Sears-Roebuck Building in Chicago has 109 elevators

with speeds of up to 549 m per min (Funk and Wagnall’s Corporation). 

1.3. Aims

This lab is carried out with the aim of designing and implementing an elevator system

which will fulfil the criteria given. This elevator system can be referred to existing

systems nowadays.

1.4. Objectives

The objectives of this lab are:

  To interpret the software modelling diagrams 

  To develop codes, debug, and simulate the codes using software 

  To understand interfacing concepts 

  To verify the required results on display 

  To implement software Keil uVision4 and Proteus in designing the traffic light

system 

Page 5: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 5/35

EE 2003 Lab 1 (Elevator System) U1060761

5

UEL Semester 3/2012

1.5. Concept

For this particular elevator system, a 3 storey elevator was designed. It consists of ground

floor, first floor, and second floor. The elevator is protected with a security system that

will ask the user to enter a password in order to going up.

Figure 1

As can be seen in Figure 1 above, the ground floor of the elevator system is protected

with a password. So, the user will have to enter a password in order to going up either to

first or second floor. User in first floor can choose to go up to second floor up go down to

ground floor while user in second floor can go down only.

Page 6: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 6/35

EE 2003 Lab 1 (Elevator System) U1060761

6

UEL Semester 3/2012

CHAPTER 2

2.  Pre-lab

2.1. Hardware design

First of all, the apparatus to conduct this lab were prepared. They are listed below.

2.1.1.  AT89C52

After considering the size of the code and the internal architecture requirements, an

AT89C52 microcontroller has been chosen. AT89C52 is an 8-bit microcontroller and

 belongs to Atmel's 8052 family.  It can be erased and program to a maximum of 1000

times. In 40 pin AT89C52, there are four ports designated as P1, P2, P3 and P0. All these

 ports are 8-bit bi-directional ports which mean that they can be used as both input and

output ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-

ups. When 1s are written to these port pins, they are pulled high by the internal pull-ups

and can be used as inputs. These ports are also bit addressable and so their bits can also

 be accessed individually. 

Port P0 and P2  are also used to provide low byte and high byte addresses, respectively,

when connected to an external memory. Port 3 has multiplexed pins for special functions

like serial communication,  hardware interrupts, timer inputs and read/write operation

from external memory. AT89C52 has an inbuilt UART for serial communication. It can

 be programmed to operate at different baud rates. Including two timers &

hardware interrupts, it has a total of six interrupts. 

Some of the features that have made the AT89C52 popular are:

  8KB on chip program memory

  128 bytes on chip data memory (RAM)

  4 register banks

  128 user defined software flags

  16 bit timers (usually 2, but may have more, or less)

  Bit as well as byte addressable RAM area of 16 bytes

  16-bit program counter and data pointer

Page 7: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 7/35

EE 2003 Lab 1 (Elevator System) U1060761

7

UEL Semester 3/2012

The assigned function for each pin of the microcontroller is as below

Table 1: Pin Description 

Pins Used Description

1 (T2) P1.0 connected to D0 of LCD 2 (T2 EX) P1.1 connected to D1 of LCD 

3 P1.2 connected to D2 of LCD 

4 P1.3 connected to D3 of LCD 

5 P1.4 connected to D4 of LCD 

6 P1.4 connected to D5 of LCD 

7 P1.6 connected to D6 of LCD 

8 P1.7 connected to D7 of LCD 

9 (RST) Connected to ‘reset ‘button with VCC 

10 (RXD) P3.0 connected to LED of Elevator Door 

11 (TXD) P3.1 connected to LED of Ground Floor 

12 (INT 0) P3.2 connected to LED of First Floor 

13 (INT 1) P3.3 connected to LED of Second Floor 

14 (T0) P3.4 connected to LED of Motor Going Up 

15 (T1) P3.5 connected to LED of Motor Going Down 

16 (WR) P3.6 connected to RW of LCD 

17 (RD) P3.7 connected to RS of LCD 

18 (XTAL1) Connected to crystal oscillator

19 (XTAL2) Connected to crystal oscillator

20 (GND) Connected to ground

21 (A8) P2.0 connected to Column 1 of Keypad 

22 (A9) P2.1 connected to Column 2 of Keypad 

23 (A10) P2.2 connected to Column 3 of Keypad 

24 (A11) P2.3 connected to Row 1 of Keypad 

25 (A12) P2.4 connected to Row 2 of Keypad 

26 (A13) P2.5 connected to Row 3 of Keypad 

27 (A14) P2.6 connected to Row 4 of Keypad 

28 (A15) P2.7 connected to E of LCD 

29 (PSEN)

30 (ALE/PROG)

31 (EA/VPP) Enable pin connected to VCC

32 (AD7)33 (AD6) P0.6 connected to GO DOWN from second

floor

34 (AD5) P0.5 connected to GO DOWN from secondfloor

35 (AD4) P0.4 connected to GO UP from first floor

36 (AD3) P0.3 connected to GO UP from ground floor

37 (AD2) P0.2 connected to SECOND FLOOR button

38 (AD1) P0.1 connected to FIRST FLOOR button

39 (AD0) P0.0 connected to GROUND FLOOR button

40 Connected to VCC

Page 8: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 8/35

EE 2003 Lab 1 (Elevator System) U1060761

8

UEL Semester 3/2012

2.1.2.  Crystal oscillator

Most of the IC and microcontroller will need a crystal oscillator to make them run

 perfectly. Basically, crystal oscillator is an electronic component that uses resonance of

vibrating crystal to create a very precise frequency electrical signal and usually used to

count duration of timer. The crystal oscillator will provide stable clock signal for IC. The

type of crystal oscillator used in this task is quartz crystal. Each instruction cycle of

crystal used in this project takes 1us to operate. In this lab, a 12 MHz quartz crystal is

used for the AT89C52 microcontroller.

2.1.3.  Voltage regulator

The voltage regulator used in this project is LM7805CT.Tthe input leg of the voltage

regulator will be connected to the 12 V DC line and the middle leg will be connected to

ground. As the result from leg output, a stable 5V DC voltage will be produced.

2.1.4.  Capacitor

In this lab, a 33 pF capacitor is used. This capacitor will be connected in series with the

crystal oscillator. This capacitor is used to stabilise the frequency of the oscillator.

2.1.5.  LED

Light Emitting Diode (LED) is used in this lab as well to display the output from each pin

of the microcontroller. Three different colour of LED is used which are red, yellow, and

green.

Figure 2: From left: AT89C51 microcontroller, 12 MHz crystal oscillator, LM7805 voltage regulator, LED, 33 pF capacitor 

Page 9: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 9/35

EE 2003 Lab 1 (Elevator System) U1060761

9

UEL Semester 3/2012

2.2. Floors and Delays

The number of floors was achieved by using the UEL1 (last digit of UEL ID). In this

case, UEL ID is U1060761, so last digit is 1. Since 1 floor of elevator is impossible, last

digit of IC number was used. IC number is 860601-23-6677, so last digit which is 7 will

 be the number of floors.

Unfortunately, AT89C52 microcontroller only has 40 pins and the components has filled

up most of the ports, so only 3 floors are available for designing the elevator using this

microcontroller.

The delay for the system was achieved by using 0.5 of UEL2 (2nd last digit of UEL ID).

In this case, UEL ID is U1060761, so the 2nd

 last digit is 6. Then 0.5 of 6 is 3. This means

that the floor changing delay will be 3 seconds.

AT89C51 is a 16 bit microcontroller, 2^16=65,536 KB / second. The 2nd  last digit is

multiplied with the frequency of the microcontroller which is 1 MHz and then divided by

the internal cycle is which is 10,000. The value is then subtracted from 65,536. This value

is in decimal, so it needs to be converted to hexadecimal.

3 x 1,000,000 = 3,000,000

3,000,000 / 10,000 = 300

65,536 –  300 = 65,236 (in decimal)

Converting = FED4 (in hexadecimal)

Page 10: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 10/35

EE 2003 Lab 1 (Elevator System) U1060761

10

UEL Semester 3/2012

2.3. Flowchart/algorithm/state transition diagram

Page 11: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 11/35

EE 2003 Lab 1 (Elevator System) U1060761

11

UEL Semester 3/2012

Figure 3: Flowchart

Page 12: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 12/35

EE 2003 Lab 1 (Elevator System) U1060761

12

UEL Semester 3/2012

2.4.Embedded C Coding

Figure 4: Declarement of Bits

Figure above shows the pins declaration. As can be seen, all four ports were used as the outputs

which are Port0, Port1, Port2, and Port3. While figure below shows the timer of the system. As

calculated above, the delay for 3 seconds in hexadecimal is FED4. This value was inserted into

TH0 and TL0. 

Figure 5: Timer Delay Function

As for the main body function of the code, ‘while’ loop, ‘case’ statement, ‘for’ loop, and ‘if else’loop are used to execute the coding. The full coding is as per attached at Appendix section later.

Page 13: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 13/35

EE 2003 Lab 1 (Elevator System) U1060761

13

UEL Semester 3/2012

2.5. Simulation

The simulation for this system has been done using Keil uVision4 and Proteus software.

The coding was written and debugged using Keil uVision4 while the simulation was done

using Proteus.

Figure 6: Ports and Timer Peripherals 

Figure 7: HEX File process 

Using the Keil uVision4 software, the coding was converted to .hex file after debugged.

This .hex file was then used for the microcontroller simulation in Proteus.

Page 14: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 14/35

EE 2003 Lab 1 (Elevator System) U1060761

14

UEL Semester 3/2012

Figure 8: Circuit Diagram of Elevator System

Figure above shows the initial condition of the elevator system. As the go up button from

the ground floor is pressed, the user will be asked to enter the password set by the

administrator. Figure below shows the password being keyed in to the system.

Figure 9: Password Authentication 

Page 15: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 15/35

EE 2003 Lab 1 (Elevator System) U1060761

15

UEL Semester 3/2012

Figure 10: Password Accepted

Figure above shows that the correct password has been entered and the user is now able to

choose to go up to any floor desired. Figures below show the process of the elevator

going up and down. 

Figure 11(a): Motor Going Up Figure 11(b): Door Opens at First Floor

 

Figure 12(a): Door Opens at Second Floor Figure 12(b): Motor Going Down 

Page 16: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 16/35

EE 2003 Lab 1 (Elevator System) U1060761

16

UEL Semester 3/2012

Figure 13: Wrong Password Demonstration 

Figure above shows the wrong password has been keyed in. the LCD will display a

warning and user will be asked to enter the password again. If three consecutive wrong

 passwords entered, the system will not allow any more trial and the security officer will

come and restart the whole system. 

Page 17: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 17/35

EE 2003 Lab 1 (Elevator System) U1060761

17

UEL Semester 3/2012

CHAPTER 3

3.  Lab works

The physical implementation of this lab was done by firstly connecting the circuit of the

system on the breadboard. The connection is as shown in methodology part above. Then,

5 V DC power supply was given to the circuit. The complete connection of the elevator

system on the breadboard is as shown below.

Figure 14

Figure above shows the complete connection of the elevator system on breadboard. As

can be seen by the arrow, the yellow LED represents ‘Door Open’, green LED represents

the floors, and the red LED represents the motor which is going up and down. The going

up button which will initiate the system is also implemented as shown above. Spaces for

other buttons are provided at pin 33 –  39.

Door OPEN Ground

Floor

First

Floor

Second

Floor

Motor

UP

Motor

DOWN

Going UP

Button

Page 18: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 18/35

EE 2003 Lab 1 (Elevator System) U1060761

18

UEL Semester 3/2012

Figure 15

After 5 V DC power supply was provided to the circuit, the LCD and all the LEDs will

light on. This indicates that the circuit connection is correct and the microcontroller is

functioning perfectly. This is shown in figure above.

Page 19: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 19/35

EE 2003 Lab 1 (Elevator System) U1060761

19

UEL Semester 3/2012

Figure 16 

As the reset button which is at pin 9 is pressed, the system will start. As can be seen in

figure above, the LED that indicates the ground floor is the only one turning on now. At

this particular time, the LCD should display message then the user will be required to

enter password to proceed, but due to some technical problem, the wording on the LCD is

not showing up.

After consulting with the lecturer, it is safe to say that there is something wrong with the

resistance in the LCD which caused this problem. But the rest of the physical

implementation was a success and the logics run perfectly.

Page 20: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 20/35

EE 2003 Lab 1 (Elevator System) U1060761

20

UEL Semester 3/2012

3.1. Results evaluation

After the two stages of testing the elevator system which are simulation and

implementation of hardware, it is satisfied to say that the results are at its expected

 because they are consistent with each other. The delay on simulation and real time

experiment is exactly 3 seconds and the logic is working perfectly.

This shows that all procedures are followed correctly during the conduction of this lab.

However, some error occurs during the burning process of the coding into the

microcontroller. This is causing the hardware to fail to work. But thanks to the lecturer

that gave support and knowledge to the student, this problem has been identified and

repaired.

The connection on the breadboard is also an important thing to highlight. It is a must to

double check the connection before supplying a power supply. This is because some

connection might become loose or in touch with each other.

Page 21: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 21/35

EE 2003 Lab 1 (Elevator System) U1060761

21

UEL Semester 3/2012

3.2. Post lab

As stated in the post lab task, a system that will detect a user who has not entered the

 password can be designed to improve the system. This is because not all user of the

elevator will have the password to the system i.e. guests from outside the building.

To implement this improvement, a system that can detect an access card can be

considered. Guests will be provided with an access card upon registration in order for

them to be able to use the elevator. Smart cards have been advertised as suitable for

 personal identification tasks, because they are engineered to be tamper resistant. The chip

usually implements some cryptographic algorithm. 

Differential power analysis involves measuring the precise time and electrical

current required for certain encryption or decryption operations. This can deduce the on-

chip private key used by public key algorithms such as RSA.  Some implementations

of  symmetric ciphers can be vulnerable to timing or power attacks as well.

Smart cards can be physically disassembled by using acid, abrasives, or some other

technique to obtain unrestricted access to the on-board microprocessor. Although such

techniques obviously involve a fairly high risk of permanent damage to the chip, they

 permit much more detailed information (e.g. photomicrographs of encryption hardware)

to be extracted.

In order to implement this, the one and only extra pin of the AT89C52 microcontroller

can be used to attach this magnetic receiver. To make an easy understanding, this whole

smart access card system is replaced with an LED. If the receiver detects the magnetic

chip on the smart card, the LED will turn ON and the system will be bypassed so that

 password is no longer needed to activate the elevator. The coding for bypassing this

 password system by providing the smart access card is shown in the Appendix section

 below.

Page 22: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 22/35

EE 2003 Lab 1 (Elevator System) U1060761

22

UEL Semester 3/2012

Figure 17: Circuit Diagram With LED as Smart Access Card System 

Page 23: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 23/35

EE 2003 Lab 1 (Elevator System) U1060761

23

UEL Semester 3/2012

CHAPTER 4

4.  Conclusion

As for the conclusion, it can be concluded that several tasks and steps with a very strict

rules has been carried out to find a result of a working model that simulated and tested

succesfully, although alot of challenges were encountered and developed with the

developing of each level of the model, and with fighting all this challenges the aim of the

 project was achieved. Finally it can be seen on how much this project was more than

 penefectial to the student, moreover we could understand that time is not an easy thing to

 be decleared and followed and we got the difficulty of producing one elevator system.

 Nonetheless, the objectives and aims of this lab were successfully achieved.

Page 24: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 24/35

EE 2003 Lab 1 (Elevator System) U1060761

24

UEL Semester 3/2012

REFERENCES

  Pressman, R.S. (2000) Software Engineering: A Practitioner’s Approach, 5 th  Ed,

McGraw-Hill

  Wilmshurt, T. (2001) The Design of Small Scale Embedded Systems, Palgrave

  Cooling, J.E. (2003) Software Engineering for Real Time Systems, Addison

  Theagarajan, R. (2004) Microprocessor and Its Application. New Age International.

  Theodore F. Bogart, Jr. (2004) Electronic Devices and Circuit. 6th Ed.

  Thomas L. Floyd (1992) Electronic Devices. 4th

 Ed.

  Yuzuru, T. (2003) Meme Media and Meme Market Architectures. Wiley –  IEEE.

  Deakin. A. (2009) Origin of Elevator [Online] Available at:

http://www.articlealley.com. (Accessed: 2nd January 2012)

  John Hewes (2010). Available at: http://www.kpsec.freeuk.com/bread.htm.

(Accessed: 5th January 2012)

Page 25: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 25/35

EE 2003 Lab 1 (Elevator System) U1060761

25

UEL Semester 3/2012

APPENDIX

Coding for the traffic light systems:

#include <reg51.h>

sbit Floor_G=P0 0̂;

sbit Floor_1=P0 1̂;

sbit Floor_2=P0 2̂;

sbit GoUp_G=P0 3̂;

sbit GoUp_1=P0 4̂;

sbit GoDown_1=P0^5;

sbit GoDown_2=P0^6;

sbit Door=P3^0;

sbit Led_G=P3^1;

sbit Led_1=P3^2;

sbit Led_2=P3^3;

sbit Elevator_up=P3^4;

sbit Elevator_down=P3^5;

int level;

#define dataport P1

#define key P2

sbit rs = P3^7;

sbit rw = P3^6;

sbit en = P2^7;

sbit Column1=key^0;

sbit Column2=key^1;

sbit Column3=key^2;

sbit Row1=key^3;

sbit Row2=key^4;

sbit Row3=key^5;

sbit Row4=key^6;

int check=0;

int digit[4]={0,0,0,0};

int dig_one=0;

int dig_two=7;

int dig_three=6;

int dig_four=1;

int i,count=0;

int lock_output;

void delay(unsigned int item) {

unsigned int i, j;

for(i=0;i<item;i++)

for(j=0;j<1275;j++); }

void lcd_cmd(unsigned char item) {

dataport = item;

rs= 0;

rw=0;

en=1;

Page 26: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 26/35

EE 2003 Lab 1 (Elevator System) U1060761

26

UEL Semester 3/2012

delay(1);

en=0;

return; }

void lcd_data(unsigned char item) {

dataport = item;

rs= 1;rw=0;

en=1;

delay(1);

en=0;

return; }

void lcd_data_string(unsigned char *str) {

int i=0;

while(str[i]!='\0') {

lcd_data(str[i]);

i++; }

return; }

void lcd(unsigned char str[10]) {

lcd_cmd(0x38);

lcd_cmd(0x0e);

lcd_data_string(str); }

void ans() {

if(check>3) {

lcd_cmd(0x01);

lcd_cmd(0x82);

lcd_data_string(" ACCEPTED! ");

lock_output=1;

delay(200);

lcd_cmd(0x01);

lcd_cmd(0x82);

lcd_data_string(" WELCOME! ");

lock_output=1;

delay(500); }

else {

lcd_cmd(0x01);

lcd_cmd(0x82);

lcd_data_string(" DENIED! ");

lock_output=0;

delay(200);

lcd_cmd(0x01);

lcd_cmd(0x82);

lcd_data_string("PLEASE RESTART! ");

lock_output=0;

count++;

delay(500); } }

void code_check() {

if(i<=3 ) {

switch((i+1)) {case 1: {

Page 27: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 27/35

EE 2003 Lab 1 (Elevator System) U1060761

27

UEL Semester 3/2012

if(dig_one==digit[0]) {

check=check+1; }

 break; }

case 2: {

if(dig_two==digit[1]) {

check=check+1; } break; }

case 3: {

if(dig_three==digit[2]) {

check=check+1; }

 break; }

case 4: {

if(dig_four==digit[3]) {

check=check+1; }

 break; } }}

if(i==3){

ans();}}

void display(int a){

switch(a){

case 1:{

lcd_data('1');

delay(30);

digit[i]=1;

code_check();

 break; }

case 2:{

lcd_data('2');

delay(30);

digit[i]=2;

code_check();

 break; }

case 3:{

lcd_data('3');

delay(30);

digit[i]=3;

code_check();

 break; }

case 4:{

lcd_data('4');

delay(30);

digit[i]=4;

code_check();

 break; }

case 5:{

lcd_data('5');

delay(30);

digit[i]=5;

code_check();

 break; }case 6:{

Page 28: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 28/35

EE 2003 Lab 1 (Elevator System) U1060761

28

UEL Semester 3/2012

lcd_data('6');

delay(30);

digit[i]=6;

code_check();

 break; }

case 7:{lcd_data('7');

delay(30);

digit[i]=7;

code_check();

 break; }

case 8:{

lcd_data('8');

delay(30);

digit[i]=8;

code_check();

 break; }

case 9:{

lcd_data('9');

delay(30);

digit[i]=9;

code_check();

 break; }

case 0:{

lcd_data('0');

delay(30);

digit[i]=0;

code_check();

 break; }}}

void check_Column1(){

Row1=Row2=Row3=Row4=1;

Row1=0;

if(Column1==0)

display(1);

Row1=1;

Row2=0;

if(Column1==0)

display(4);

Row2=1;

Row3=0;

if(Column1==0)

display(7);

Row3=1;

Row4=0;

if(Column1==0) {

Row4=1; } }

void check_Column2() {

Row1=Row2=Row3=Row4=1;Row1=0;

Page 29: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 29/35

EE 2003 Lab 1 (Elevator System) U1060761

29

UEL Semester 3/2012

if(Column2==0)

display(2);

Row1=1;

Row2=0;

if(Column2==0)

display(5);Row2=1;

Row3=0;

if(Column2==0)

display(8);

Row3=1;

Row4=0;

if(Column2==0)

display(0);

Row4=1; }

void check_Column3() {

Row1=Row2=Row3=Row4=1;

Row1=0;

if(Column3==0)

display(3);

Row1=1;

Row2=0;

if(Column3==0)

display(6);

Row2=1;

Row3=0;

if(Column3==0)

display(9);

Row3=1;

Row4=0;

if(Column3==0) {

Row4=1; } }

void pass_ver() {

Column1=Column2=Column3=1;

lcd_cmd(0x01);

lcd_cmd(0x82);

lcd_data_string(" WELCOME! ");

lock_output=0;

delay(200);

lcd_cmd(0x01);

lock_output=0;

lcd_cmd(0x82);

lcd("WELCOME! ENTER PASSWORD");

check=0;

Row1=Row2=Row3=Row4=0;

while(Column1==1 && Column2==1 && Column3==1);

for(i=0;i<4;i++) {

delay(100);

lcd_cmd(0xc4+i);Row1=Row2=Row3=Row4=0;

Page 30: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 30/35

EE 2003 Lab 1 (Elevator System) U1060761

30

UEL Semester 3/2012

while(Column1==1 && Column2==1 && Column3==1);

Row1=Row2=Row3=Row4=0;

if(Column1==0)

check_Column1();

else

if(Column2==0)check_Column2();

else

if(Column3==0)

check_Column3();

if(count==4) {

lcd_cmd(0x01);

lcd_cmd(0x86);

lcd("SORRY");

lcd_cmd(0xc1);

lcd("NO MORE TRIALS"); }} }

// subrotuin for ground floor //

void ground(){

unsigned int x, y;

for(x=0;x<1000;x++)

for(y=0;y<1275;y++) {

if (Floor_1==1) {

Led_G=1;

Elevator_up=0;

delay(500);

Elevator_up=1;

level=1;

Led_1=0;

Door=0;

delay(400);

Door=1;

 break; }

if(Floor_2==1) {

Led_G=1;

Elevator_up=0;

delay(500);

Led_1=0;

if(GoUp_1==1) {

Door=0;

delay(400);

Door=1; }

delay(400);

Led_1=1;

delay(500);

Elevator_up=1;

Led_2=0;

level=2;

Door=0;

delay(400);Door=1;

Page 31: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 31/35

EE 2003 Lab 1 (Elevator System) U1060761

31

UEL Semester 3/2012

 break; } }}

// subrotuin for fist up&down//

void first_up(){

unsigned int x, y;

for(x=0;x<1000;x++)

for(y=0;y<1275;y++) {if (Floor_G==1) {

Led_1=1;

Elevator_down=0;

delay(500);

Elevator_down=1;

level=0;

Led_G=0;

Door=0;

delay(400);

Door=1;

 break;}

if(Floor_1==1) {

Door=0;

delay(400);

Door=1;

 break; }

if (Floor_2==1) {

Led_1=1;

Elevator_up=0;

delay(500);

Elevator_up=1;

level=2;

Led_2=0;

Door=0;

delay(400);

Door=1;

 break;;}}}

//subrotuin for secounds //

void second(){

unsigned int x, y;

for(x=0;x<1000;x++)

for(y=0;y<1275;y++) {

if(Floor_G==1) {

Led_2=1;

Elevator_down=0;

delay(500);

Led_1=0;

if(GoDown_1==1) {

Door=0;

delay(400);

Door=1; }

delay(400);

Led_1=1;delay(500);

Page 32: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 32/35

EE 2003 Lab 1 (Elevator System) U1060761

32

UEL Semester 3/2012

Elevator_down=1;

Led_G=0;

delay(500);

Door=0;

delay(400);

Door=1;level=0;

 break; }

if(Floor_1==1) {

Led_2=1;

Elevator_down=0;

delay(500);

Elevator_down=1;

Led_1=0;

delay(500);

Door=0;

delay(400);

Door=1;

level=1;

 break; }

if(Floor_2==1) {

Door=0;

delay(400);

Door=1;

level=2;

 break; } }}

// MAIN PROGRAM //

void main(){

Elevator_down=1;

Elevator_up=1;

level=0;

P0=0x00;

Led_G=0;

Led_1=1;

Led_2=1;

while(1) {

if(GoUp_G==1) {

 pass_ver();

if (lock_output==1) {

if(level==0) {

Led_G=0;

Door=0;

delay(400);

Door=1;

level=0;ground(); }

Page 33: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 33/35

EE 2003 Lab 1 (Elevator System) U1060761

33

UEL Semester 3/2012

if(level==1) {

Elevator_down=0;

delay(500);

Elevator_down=1;

Led_G=0;

level=0;Door=0;

delay(400);

Door=1;

ground(); }

if(level==2) {

Led_2=1;

Elevator_down=0;

delay(500);

Led_1=0;

delay(500);

Led_1=1;

delay(500);

Elevator_down=1;

Led_G=0;

level=0;

Door=0;

delay(400);

Door=1;

ground(); }}}

if(GoUp_1==1) {

if(level==0) {

Led_G=1;

Elevator_up=0;

delay(500);

Elevator_up=1;

Led_1=0;

Door=0;

delay(400);

Door=1;

level=1;

first_up(); }

if(level==1) {

Door=0;

Led_1=0;

delay(400);

Door=1;

first_up(); }

if (level==2) {

Led_2=1;

Elevator_down=0;

delay(500);

Elevator_down=1;

Led_1=0;Door=0;

Page 34: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 34/35

EE 2003 Lab 1 (Elevator System) U1060761

34

UEL Semester 3/2012

delay(400);

Door=1;

first_up(); } }

if(GoDown_1==1) {

if(level==0) {

Led_G=1;Elevator_up=0;

delay(500);

Elevator_up=1;

Led_1=0;

Door=0;

delay(400);

Door=1;

level=1;

first_up(); }

if (level==2) {

Led_2=1;

Elevator_down=0;

delay(500);

Elevator_down=1;

Led_1=0;

Door=0;

delay(400);

Door=1;

first_up(); } }

if(GoDown_2==1) {

if(level==0) {

Led_G=1;

Elevator_up=0;

delay(500);

Led_1=0;

delay(500);

Led_1=1;

delay(500);

Elevator_up=1;

Led_2=0;

delay(500);

Door=0;

delay(400);

Door=1;

level=2;

second(); }

if (level==1) {

Led_1=1;

Elevator_up=0;

delay(400);

Elevator_up=1;

Led_2=0;

delay(500);Door=0;

Page 35: elevator system using microcontroller

7/22/2019 elevator system using microcontroller

http://slidepdf.com/reader/full/elevator-system-using-microcontroller 35/35

EE 2003 Lab 1 (Elevator System) U1060761

delay(400);

Door=1;

level=2;

second(); }

if(level==2) {

Door=0;Led_2=0;

delay(400);

Door=1;

level=2;

second(); } } } }