auto car parking

Upload: mec101

Post on 06-Apr-2018

242 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Auto Car Parking

    1/21

    HOME Electronics Directory Articles/ Tutorials eBooksAbout Us FORUM Links Contact Us

    Project Tutorial: "Automated Car Parking System"byRanjith K H

    Here is a 8051 microcontroller based electronics project. This demo projectexplains how to make a car parking system automated. Here, there is a multi floor

    parking system, and a lift will take your car to the appropriate parking area dependingon the cars that are already occupied in the system. Use some cardboard sheets to

    make the building and take some toy cars to have a demo!Automatic multi-stored car parking system is very good substitute for car

    parking area. Since in modern world, where space has become a very big problemand in the era of miniaturization its become a very crucial necessity to avoid thewastage of space in modern, big companies and apartments etc. In space where morethan 100 cars need to be parked, its a very difficult task to do and also to reduce thewastage of area, this system can be used. This Automatic Car Parking enables theparking of vehicles-floor after floor and thus reducing the space used. Here anynumber of cars can be park according to requirement. This makes the systemmodernized and even a space-saving one. This idea is developed using 8051Microcontroller. Here program is written according to this idea using 8051.

    Click here to view photographs of this model.Description:

    A display is provided at the ground floor which is basically a counter thatdisplays number of cars in each floor. It informs whether the floors are fully filled withthe cars or is it having place in a particular floor or not. There is facility of lift to carrythe car to up and down. Movement of Lift is controlled by stepper motor. An indicatorwith a green and red LED is kept in all the floors to indicate whether the lift is busy oris it ready to take the car up or down. If the red LED glows that means the lift isalready engaged and the person has to wait for the green LED to glow. In this project

    we have provided three floors of a building for car parking. Maximum storage capacityof each floor is given as ten. Storage capacity can be changed according to therequirement.

    Any one can enter to first or second floor. The third floor in this model is forVIPs only. Therefore when VIPs are to be entering they are expected to enter theirpassword and they will be taken to the third reserved floor. The password will be of 4digits. The processor checks for the password entered and if it is found to be wrong, asiren is heard. In this particular model 10 passwords are stored. So when a password

  • 8/3/2019 Auto Car Parking

    2/21

    is entered, the processor checks for it and it is compared with 10 passwords. Itindicates whether it is the correct one or not.

    When the car enters the lift, the LDR detects its presence and sends a signal toglow RED LED indicating that the lift is busy. It also sends a signal to motor whichmakes the motor to rotate. After RED LED glows the lift will take the person and the

    car up to the floor where the space for parking is available. (For VIP it will be the thirdfloor). When the lift reaches the first floor, the processor compares the filled amount tothat of the already fed capacity of that floor, and if it finds that the first floor is fully filled, it goes to the second floor and thus the procedure stops here. As soon as a car isplaced in a particular floor, the display counter at the ground floor increments as toindicate the floor capacity has decreased by one. After the lift places the car in aparticular floor, it comes back to its normal position and that time, the motor that drivesit , also stops. Now processor sends signal to glow GREEN LED indicating that lift isfree.

    When a person needs to come down from a particular floor to ground floor, heis expected to focus the headlight onto the LDR placed in that floor. Now sensor

    section sends signal to motor that the lift has to be send back to that particular floorand sends a signal to glow RED LED indicating that the lift is busy. As soon as the liftreaches that particular floor car should come inside the lift, the display counter at theground floor decrements by one as to indicate the floor capacity has increased by one.Lift comes back to its normal position and that time, the motor that drives it , alsostops. Now processor sends signal to glow GREEN LED indicating that lift is free.

    If there no parking taking place, the processor carries out the job according tothe following priority:-

    1. It checks whether any password is entered.2. It checks whether any car is entered to lift.3. It checks whether any car headlight is pressed in front of LDR placed in each

    floor.It is like a round robin system.CIRCUIT EXPLANATIONSFollowing are the main sections in this model.

    1. Display section2. Keyboard, indicator & Beeper section3. Lift & motor section4. Sensor section

  • 8/3/2019 Auto Car Parking

    3/21

    5. LCD section6. Software program

    Program is written using 8051 microcontroller. Two 8255 IC's are connected to

    8051. All circuits are interfaced with 8255.

    Block diagram of automated car parking system1.DISPLAY SECTION

    This section displays the floor number along with the number of cars whichhas been already parked in that particular floor. So whenever a car is ready to eithercome down or go up, the program either decrements the count or increments thecount automatically according to the going up or coming down of a car. Display sectionis done by interfacing with 8255(PPI) of 8051.Here 3 ports of 8255 are connected to

  • 8/3/2019 Auto Car Parking

    4/21

    three 7-segment display. Block diagram of this section is shown.

    2.KEYBOARD, INDICATOR &BEEPERIn this section,12 switches are connected in matrix form and it has three LEDs

    , RED, GREEN&YELLOW. The person, needed to enter the password has to wait untilthe GREEN LED glows and when it glows, he has to press the START button first.This time the RED LED glows. Then the person has to enter the password. As soon asit is entered, the program checks it with the already stored passwords. If it is correct,YELLOW LED glows. If the entered password is wrong, beeper starts beeping

    signifying the incorrectness of the password entered. Circuit diagram of keyboard isshown bellow.

  • 8/3/2019 Auto Car Parking

    5/21

    The indicator section contains 2 LEDs , RED & GREEN which are present inall the floors. RED LED signifies that the lift is presently busy and shall not entertainany car to enter but if GREEN LED glows, it suggests that the lift is ready and the carcan enter the particular floor. Beeper and LED's are connected to port C upper of8255.

    One more advantage of beeper is that; when a person tries to enter the liftirrespective of finding the display section to be FFF (means the floors are already

    filled), program sends a signal to Beeper section and it starts beeping indicating thathe is not supposed to enter the lift since all the floors are already filled.LIFT AND MOTOR SECTION

    In lift section, there is a light beam and LDR to know whether a car hasentered the lift or not. When the GREEN LED of indicator section glows, that meansthe lift is ready for the car to enter. When the car enters the lift, the light beam falls onLDR present in the lift gets cut and it gives a signal that a car has entered the lift. Thenprogram decides which floor lift has to go and gives a signal to motor section. Circuitdiagram of sensor present in lift is shown bellow.

  • 8/3/2019 Auto Car Parking

    6/21

    The motor section is a mechanical part of the model which is used for takingthe lift up/down. When the lift has to go up, program gives the signal and themotor rotates clockwise and if it has to go down, it rotates anticlockwise. First 4 pinsport A is connected to motor. Power transistors must be connected to drive the motor.Circuit diagram of this section is shown bellow.

    SENSOR SECTIONSensor section contains LDR's .These LDR's are connected to each floar to

    give information if any car has to come down. When a person needs to come down

  • 8/3/2019 Auto Car Parking

    7/21

    from a particular floor to ground floor, he is expected to focus the headlight the caronto the LDR placed in that floor. When light falls on LDR its resistance decreases.Hence IC 555 triggers and gives a signal. Program identifies that signal and gives asignal to motor section. The circuit diagram sensor is shown bellow. In this projectsame circuits is connected to three floors. This circuit different if you compared with

    that of lift sensor shown above.

    LCD SECTIONIn this project LCD is used to display some messages which is useful to car

    owners. Here 2X16 LCD ( Liquid Crystal Display) is used. This is used to displaymessages like

    WELCOME TO CAR PARKING SYSTEMLIFT IS BUSY PLEASE WAITPLEASE ENTER YOUR PASSWORDCircuit diagram of LCD section is shown bellow. LCD is interfaced with 8051

  • 8/3/2019 Auto Car Parking

    8/21

    microcontroller.

    Circuit is now over. Next part is coding. Here is the complete listing of the code formulti floor car parking system. Create the hex file and download it to themicrocontroller and place the IC in circuit. Your automated car parking system isready. Wait for a car to come.

    mov r0,#19h ; Storing the equivalent codes ofmov @r0,#0bfh ; common cathode display.inc r0mov @r0,#86hinc r0mov @r0,#0dbhinc r0mov @r0,#0cfhinc r0mov @r0,#0e6hinc r0mov @r0,#0edhinc r0mov @r0,#fdhinc r0mov @r0,#87hinc r0mov @r0,#0ffhinc r0mov @r0,#0e7hinc r0mov @r0,#39hinc r0

  • 8/3/2019 Auto Car Parking

    9/21

    mov @r0,#00hmov r0,#25h ; Storing the equivalent codes ofmov @r0,#40h ; common anode.inc r0mov @r0,#0f9hinc r0mov @r0,#24hinc r0mov @r0,#30hinc r0mov @r0,#99hinc r0mov @r0,#12hinc r0mov @r0,#02hinc r0mov @r0,#78hinc r0mov @r0,#00hinc r0mov @r0,#18hinc r0mov @r0,#0ehmov r0,#45h ; Storing ten 4 digit passwords inmov @r0,#00h ; internal RAM.

    inc r0mov @r0,#01hinc r0mov @r0,#02hinc r0mov @r0,#03hinc r0mov @r0,#08hinc r0mov @r0,#00inc r0mov @r0,#05hinc r0mov @r0,#01hinc r0mov @r0,#01hinc r0mov @r0,#00inc r0

  • 8/3/2019 Auto Car Parking

    10/21

    mov @r0,#00inc r0mov @r0,#01hinc r0mov @r0,#06hinc r0mov @r0,#00inc r0mov @r0,#05hinc r0mov @r0,#00inc r0mov @r0,#09hinc r0mov @r0,#08hinc r0mov @r0,#08hinc r0mov @r0,#06hinc r0mov @r0,#03hinc r0mov @r0,#01hinc r0mov @r0,#01hinc r0mov @r0,#07hmov a,#08STORE: dec ainc r0mov @r0,ainc r0movx @r0,ainc r0movx @r0,ainc r0movx @r0,adjnz a,STOREmov dptr,#2023h ; Configuring two 8255 ports.mov a,#81hmovx @dptr,amov dptr,#2043hmov a,#80hmovx @dptr,amov r3,#00 ; Clears the display.

  • 8/3/2019 Auto Car Parking

    11/21

    mov r4,#00mov r5,#00mov a,r5call LED_CODESmov dptr,#2040hmovx @dptr,ainc dptrmovx @dptr,ainc dptrmovx @dptr,amov dptr,#2022hmov a,#30hmovx @dptr,amov sp,#11hcall lcdwel ; Calling LCD display subroutine.

    REPEAT: clr psw.3clr psw.4mov dptr,#2022hmovx a,@dptrcjne a,#31h,DONE ; Comparing whether car is inside the lift.mov a,#0ahxrl a,r4

    jz SIREN ; Call SIREN if second floor is full.call lcdbusymov a,#10hmovx @dptr,a ; send lift is busy signal.call DELAYmov r7,#02 ; Give number of rotations to motor so that...mov r6,#02h ; lift goes to first floor.call MOTER_UP ; Call motor to rotate clockwise.mov a,#0ahxrl a,r3

    jz I_FULL ; If first floor is full then jump to I_FULLinc r3call DELAYmov a,r3 ; Increment the number of car in first floor.call LED_CODES ; Display the number of cars.mov dptr,#2042hmovx @dptr,amov r7,#02h ; Again load the number of rotations to motormov r6,#02hcall MOTER_DOWN ; Call motor to rotate anticlockwise.mov dptr,#2022hmov a,#30hmovx @dptr,a ; send lift is free signal.call lcdwel

  • 8/3/2019 Auto Car Parking

    12/21

    sjmp DONEI_FULL: mov r7,#02h ; Give number of rotations to motor so tha...

    mov r6,#02h ; ...lift goes to second floor.call MOTER_UP ; Call motor to rotate clockwise.inc r4call DELAYmov a,r4 ; Increment the number of car in second floor.call LED_CODES ; Display the number of cars.mov dptr,#2041hmovx @dptr,amov r7,#04h ;Again load the number of rotations to motor.mov r6,#02hcall MOTER_DOWN ; Call motor to rotate anticlockwise.mov dptr,#2022hmov a,#30hmovx @dptr,a ; send lift is free signal.call lcdweljmp DONE

    SIREN: mov a,#70h ; Subroutine for SIREN.movx @dptr,a

    GO: movx a,@dptrjb a.0,GOjmp OVER1

    DONE: movx a,@dptr ; Compare if start button of thecjne a,#33h,OVER1 keyboard is pressed.mov a,#0ahxrl a,r5

    jz SIREN ; Call SIREN if third flore is full.mov a,#00movx @dptr,acall lcdbusysetb psw.3

    CLEAR: mov r1,#0ah ; Scanning entered password from keyboardmov r0,#04h

    START: mov dptr,#2020hmov a,#0ehmovx @dptr,a

    WAIT: mov dptr,#2022hmovx a,@dptrmov r7,#00xrl a,r7

    jz WAITmov a,#02

    LOOP: mov r6,amov dptr,#2020h

  • 8/3/2019 Auto Car Parking

    13/21

    movx @dptr,amov dptr,#2022hmovx a,@dptr

    jnz COLSCANinc r7mov a,r6rl a

    jmp LOOPCOLSCAN: rrc a

    jc DONE1inc r7inc r7inc r7sjmp COLSCAN

    OVER1: jmp OVERDONE1: mov a,r7clr psw.3setb psw.4mov r0,#19hadd a,r0mov r0,amov a,@r0clr psw.4setb psw.3mov dptr,#2021hmovx @dptr,ainc dptr

    UP: movx a,@dptrjnz UPmov a,#0ahxrl a,r7

    jz CLEARmov a,#0bhxrl a,r7

    jz BIT_CLEARmov a,r7mov @r1,a ; Store entered each digit.inc r1mov r7,#0ffh

    HEAR: djnz r7,HEARmov r7,#0ffh

    HEAR1: djnz r7,HEAR1djnz r0,START

  • 8/3/2019 Auto Car Parking

    14/21

    mov r7,#0ah ;Checking whether entered 4 digit passwordmov r0,#45h ; .... is any one of the stored password.

    CHECK: mov r1,#0ahmov r6,#03h

    CHECK1:mov a,@r0xrl a,@r1jnz NEXTinc r1inc r0djnz r6,CHECK1mov dptr,#2022hmov a,#90hmovx @dptr,aclr psw.3

    jmp OK ; Jump to OK if password is correct.NEXT: inc r0

    djnz r6,NEXTinc r0djnz r7,CHECKmov dptr,#2022hmov a,#50hmovx @dptr,a

    AGAIN: movx a,@dptrcjne a,#53h,AGAINclr psw.3mov a,#30h ; Give SIREN if entered password is wrong.movx @dptr,a

    REMAIN: movx a,@dptrxrl a,#33hjz REMAINmov r0,#0ffh

    STAY: djnz r0,STAYcall lcdwel

    jmp OVERLED_CODES:setb psw.4

    mov r0,#25hadd a,r0mov r0,amov a,@r0clr psw.4ret

    BIT_CLEAR: dec r1inc r0mov r6,#0ffh

  • 8/3/2019 Auto Car Parking

    15/21

    HEAR2: djnz r6,HEAR2mov r6,#0ffh

    HEAR3: djnz r6,HEAR3jmp START

    OK: movx a,@dptrcjne a,#91h,OKmov a,#10h

    movx @dptr,amov a,#00mov dptr,#2021hmovx @dptr,acall DELAYmov r7,#06h ; Give number of rotations to motor so thatmov r6,#02h ; lift goes to third flore.call MOTER_UP ; Call motor to rotate clockwise.inc r5 ;Increment the number of car entered to thirdcall DELAY ;... floor and display the number of cars.mov a,r5call LED_CODESmov dptr,#2040hmovx @dptr,amov r7,#06hmov r6,#02hcall MOTER_DOWN ; Call motor to rotate anticlockwise.call lcdwel

    jmp OVERMOTER_UP:push r5 ;Subroutine for motor to rotate clockwise.

    mov r5,#70hmov r0,r6mov dptr,#2020hmov a,#88h

    h3: movx @dptr,arl amov r2,#30

    h1: mov r1,#255h2: djnz r1,h2

    djnz r2,h1djnz r5,h3mov r5,#0ffhdjnz r6,h3mov r6,r0djnz r7,h3pop r5ret

  • 8/3/2019 Auto Car Parking

    16/21

    MOTER_DOWN:push r5 ;Subroutine for motor to rotate anticlockwise.

    mov r5,#70hmov r0,r6mov dptr,#2020hmov a,#88hh6: movx @dptr,arr amov r2,#30

    h4: mov r1,#255h5: djnz r1,h5

    djnz r2,h4djnz r5,h6mov r5,#0ffhdjnz r6,h6mov r6,r0djnz r7,h6pop r5ret

    DELAY: mov r1,#10h ; Subroutine for DelayDELAY1: mov r2,#0ffhDELAY2: mov r0,#0ffhDELAY3: djnz r0,DELAY3

    djnz r2,DELAY2djnz r1,DELAY1ret

    OVER: mov dptr,#2022hmov a,#30hmovx @dptr,amovx a,@dptrcjne a,#32h,I_OVERmov a,#10hmovx @dptr,acall lcdbusymov r7,#02hmov r6,#02h

    call MOTER_UP ; Call motor to rotate clockwise.dec r3 ; Decrements the number of cars entered tomov a,r3 ;... first floor and display the number ofcall LED_CODES ;... cars in first floor.mov dptr,#2042hmovx @dptr,acall DELAYmov r7,#02h

  • 8/3/2019 Auto Car Parking

    17/21

    mov r6,#02hcall MOTER_DOWN ; Call motor to rotate anticlockwise.mov dptr,#2022hmov a,#30hmovx @dptr,acall lcdwelI_OVER: movx a,@dptrcjne a,#34h,II_OVERmov a,#10hmovx @dptr,acall lcdbusymov r7,#04hmov r6,#02hcall MOTER_UP ; Call motor to rotate clockwise.dec r4 ; Decrements the number of cars entered tomov a,r4 ;...second floor and display the number ofcall LED_CODES ;... cars in second floor.mov dptr,#2041hmovx @dptr,acall DELAYmov r7,#04hmov r6,#02hcall MOTER_DOWN ; Call motor to rotate clockwise.mov dptr,#2022hmov a,#30hmovx @dptr,acall lcdwel

    II_OVER: movx a,@dptrcjne a,#38h,ENDmov a,#10hmovx @dptr,acall lcdbusymov r7,#06hmov r6,#02hcall MOTER_UP ; Call motor to rotate clockwise.dec r5 ; Decrements the number of cars entered tomov a,r5 ;... third floor and display the number ofcall LED_CODES ;... cars in third floor.mov dptr,#2040hmovx @dptr,acall DELAYmov r7,#06hmov r6,#02hcall MOTOR_DOWN ; Call motor to rotate anticlockwise.mov dptr,#2022hmov a,#30h

  • 8/3/2019 Auto Car Parking

    18/21

    movx @dptr,acall lcdwel

    END: jmp REPEATlcdwel: push r3 ; Subroutine for LCD to display

    push r4 ; WELCOME TO CAR PARKING SYSTEM mov a,#3chcall commandmov a,#0ehcall commandmov a,#01hcall commandmov a,#06hcall commandmov a,#80hcall commandmov a,#'W'call datamov a,#'E'call datamov a,#'L'call datamov a,#'C'call datamov a,#'O'call datamov a,#'M'call datamov a,#'E'call datamov a,#' 'call datamov a,#88hcall commandmov a,#'T'call datamov a,#'O'call datamov a,#' 'call datamov a,#'C'call datamov a,#'A'call data1mov a,#'R'call data

  • 8/3/2019 Auto Car Parking

    19/21

    mov a,#aahcall commandmov a,#'P'call datamov a,#'A'call datamov a,#'R'call datamov a,#'K'call datamov a,#'I'call datamov a,#'N'call datamov a,#'G'call datamov a,#' 'call datamov a,#'S'call datamov a,#'Y'call datamov a,#'S'call datamov a,#'T'call datamov a,#'E'call datamov a,#'M'call datapop r4pop r3ret

    command:mov p1,aclr p3.4setb p3.3clr p3.3mov r3,#50

    A: mov r4,#255R: djnz r4,R

    djnz r3,Aret

    data: mov p1,a

  • 8/3/2019 Auto Car Parking

    20/21

    setb p3.4setb p3.3clr p3.3mov r3,#50

    AAA: mov r4,#255AA: djnz r4,AAdjnz r3,AAAret

    lcdbusy: push r4 ;Subroutine for LCD to displaypush r3 ; LIFT IS BUSY PLEASE WAIT mov a,#3chcall commandmov a,#0ehcall commandmov a,#01hcall commandmov a,#06hcall commandmov a,#80hcall commandmov a,#'L'call datamov a,#'I'call datamov a,#'F'call datamov a,#'T'call datamov a,#' 'call datamov a,#' 'call datamov a,#'I'call datamov a,#'S'call datamov a,#88hcall commandmov a,#' 'call datamov a,#' 'call datamov a,#'B'call data

  • 8/3/2019 Auto Car Parking

    21/21

    mov a,#'U'call datamov a,#'S'call datamov a,#'Y'call datamov a,#aahcall commandmov a,#'P'call datamov a,#'L'call datamov a,#'E'call datamov a,#'A'call datamov a,#'S'call datamov a,#'E'call datamov a,#' 'call datamov a,#'W'call datamov a,#'A'call datamov a,#'I'call datamov a,#'T'call datamov a,#' 'call datapop r3pop r4ret

    To contact author, use [email protected] ; To discuss article, use ElectroSoftsForum

    Home | About Us | Articles/ Tutorials | Downloads | Feedback | Links | eBooks | Privacy PolicyCopyright 2005-2007 electroSofts.com.

    [email protected]