HOME

    Electronics Directory Articles/ Tutorials eBooks

About Us

FORUM Links Contact Us
   

Project Tutorial:  "Automated Car Parking System"

by Ranjith K H

         

 

     Here is a 8051 microcontroller based electronics project. This demo project explains 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 depending on 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 problem and in the era of miniaturization its become a very crucial necessity to avoid the wastage of space in modern, big companies and apartments etc. In space where more than 100 cars need to be parked, it�s a very difficult task to do and also to reduce the wastage of area, this system can be used. This Automatic Car Parking enables the parking of vehicles-floor after floor and thus reducing the space used. Here any number of cars can be park according to requirement. This makes the system modernized and even a space-saving one. This idea is developed using 8051 Microcontroller. 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 that displays number of cars in each floor. It informs whether the floors are fully filled with the cars or is it having place in a particular floor or not. There is facility of lift to carry the car to up and down. Movement of Lift is controlled by stepper motor. An indicator with a green and red LED is kept in all the floors to indicate whether the lift is busy or is it ready to take the car up or down. If the red LED glows that means the lift is already 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 capacity of each floor is given as ten. Storage capacity can be changed according to the requirement.
            Any one can enter to first or second floor. The third floor in this model is for VIP�s only. Therefore when VIP�s are to be entering they are expected to enter their password and they will be taken to the third reserved floor. The password will be of 4 digits. The processor checks for the password entered and if it is found to be wrong, a siren is heard. In this particular model 10 passwords are stored. So when a password is entered, the processor checks for it and it is compared with 10 passwords. It indicates whether it is the correct one or not.
           When the car enters the lift, the LDR detects its presence and sends a signal to glow RED LED indicating that the lift is busy. It also sends a signal to motor which makes 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 third floor). When the lift reaches the first floor, the processor compares  the filled amount to that 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 is placed in a particular floor, the display counter at the ground floor increments as to indicate the floor capacity has decreased by one. After the lift places the car in a particular floor, it comes back to its normal position and that time, the motor that drives it , also stops. Now processor sends signal to glow GREEN LED indicating that lift is free.
            When a person needs to come down from a particular floor to ground floor, he is 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 floor and sends a signal to glow RED LED indicating that the lift is busy. As soon as the lift reaches that particular floor car should come inside the lift, the display counter at the ground 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 , also stops. 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 to the 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 EXPLANATIONS

Following are the main sections in this model.

    1.   Display section

    2.   Keyboard, indicator & Beeper section

    3.   Lift & motor section

    4.   Sensor section

    5.   LCD section

    6.   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 system

1.DISPLAY SECTION

              This section displays the floor number along with the number of cars which has been already parked in that particular floor. So whenever a car is ready to either come down or go up, the program either decrements the count or increments the count automatically according to the going up or coming down of a car. Display section is done by interfacing with 8255(PPI) of 8051.Here 3 ports of 8255 are connected to three 7-segment display. Block diagram of this section is shown.

    

2.KEYBOARD, INDICATOR &BEEPER

             In this section,12 switches are connected in matrix form and it has three LED�s , RED, GREEN&YELLOW. The person, needed to enter the password has to wait until the 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 as it 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 is shown bellow.

              &0��) V0��) V0�) V@��) V���) VP��) V@P��) Vp>

            The indicator section contains 2 LED�s , RED & GREEN  which are present in all the floors. RED LED signifies that the lift is presently busy and shall not entertain any car to enter but if GREEN LED glows, it suggests that the lift is ready and the car can enter the particular floor. Beeper and LED's are connected to port C upper of 8255.
            One more advantage of beeper is that; when a person tries to enter the lift irrespective 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 that he 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 has entered the lift or not. When the GREEN LED of indicator section glows, that means the lift is ready for the car to enter. When the car enters the lift, the light beam falls on LDR present in the lift gets cut and it gives a signal that a car has entered the lift. Then program decides which floor lift has to go and gives a signal to motor section. Circuit diagram of sensor present in lift is shown bellow.


            

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

 

SENSOR SECTION

             Sensor 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 from a particular floor to ground floor, he is expected to focus the headlight the car onto 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 a signal to motor section. The circuit diagram sensor is shown bellow. In this project same circuits  is connected to three floors. This circuit different if you compared with that of lift sensor shown above. 

              

 

LCD SECTION

           In 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 display messages like

         WELCOME TO CAR PARKING SYSTEM

         LIFT IS BUSY PLEASE WAIT

         PLEASE ENTER YOUR PASSWORD

        Circuit diagram of LCD section is shown bellow. LCD is interfaced with 8051 microcontroller.

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

0��) V0��) V0�) V@��) V���) VP��) V@P��) V         inc r0        call data

        mov r0,#19h           ; Storing the equivalent codes of      

        mov @r0,#0bfh         ;    common cathode display.

        inc r0

        mov @r0,#86h

        inc r0

        mov @r0,#0dbh

        inc r0

        mov @r0,#0cfh

        inc r0

        mov @r0,#0e6h

        inc r0

        mov @r0,#0edh

        inc r0

        mov @r0,#fdh

        inc r0

        mov @r0,#87h

        inc r0

        mov @r0,#0ffh

        inc r0

        mov @r0,#0e7h

        inc r0

        mov @r0,#39h

        inc r0

        mov @r0,#00h

       

        mov r0,#25h                ; Storing the equivalent codes of      

        mov @r0,#40h               ;             common anode.

        inc r0

        mov @r0,#0f9h

        inc r0

        mov @r0,#24h

        inc r0

        mov @r0,#30h

        inc r0

        mov @r0,#99h

        inc r0

        mov @r0,#12h

        inc r0

        mov @r0,#02h

        inc r0

        mov @r0,#78h

        mov @r0,#00h

        inc r0

        mov @r0,#18h

        inc r0

        mov @r0,#0eh

      

        mov r0,#45h                       ; Storing ten 4 digit passwords in

        mov @r0,#00h                     ; internal RAM.       

        inc r0

        mov @r0,#01h

        inc r0

        mov @r0,#02h

        inc r0

        mov @r0,#03h

        inc r0

        mov @r0,#08h

        inc r0

        mov @r0,#00

        inc r0

        mov @r0,#05h

        inc r0

        mov @r0,#01h

        inc r0

        mov @r0,#01h

        inc r0

        mov @r0,#00

        inc r0

        mov @r0,#00

        inc r0

        mov @r0,#01h

        inc r0

        mov @r0,#06h

        inc r0

        mov @r0,#00

        inc r0

        mov @r0,#05h

        inc r0

        mov @r0,#00

        inc r0

        mov @r0,#09h

        inc r0

        mov @r0,#08h

        inc r0

        mov @r0,#08h

        inc r0

        mov @r0,#06h

        inc r0    

        mov @r0,#03h

        inc r0

        mov @r0,#01h

        inc r0

        mov @r0,#01h

        inc r0

        mov @r0,#07h

        mov a,#08

 STORE: dec a

        inc r0

        mov @r0,a

        inc r0

        movx @r0,a

        inc r0

        movx @r0,a

        inc r0

        movx @r0,a

        djnz a,STORE

 

        mov dptr,#2023h            ; Configuring two 8255 ports.

        mov a,#81h  

        movx @dptr,a

        mov dptr,#2043h

0��) V0��) V0�) V@��) V���) VP��) V@P��) V/td>

        movx @dptr,a

        mov r3,#00                    ; Clears the display.    

        mov r4,#00

        mov r5,#00

        mov a,r5

        call LED_CODES

        mov dptr,#2040h

        movx @dptr,a

        inc dptr

        movx @dptr,a

        inc dptr

        movx @dptr,a

        mov dptr,#2022h

        mov a,#30h

        movx @dptr,a

        mov sp,#11h

        call lcdwel                      ; Calling LCD display subroutine.

REPEAT: clr psw.3

        clr psw.4

        mov dptr,#2022h

        movx a,@dptr

        cjne a,#31h,DONE    ; Comparing whether car is inside the lift.    

        mov a,#0ah                    

        xrl a,r4

        jz SIREN            ; Call SIREN if second floor is full.

        call lcdbusy

        mov a,#10h

        movx @dptr,a        ; send lift is busy signal.

        call DELAY

        mov 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,#0ah

        xrl a,r3

        jz I_FULL           ; If first floor is full then jump to I_FULL

        inc r3

        call DELAY

        mov a,r3            ; Increment the number of car in first floor.

        call LED_CODES      ; Display the number of cars.  

        mov dptr,#2042h

        movx @dptr,a

        mov r7,#02h         ; Again load the  number of rotations to motor 

        mov r6,#02h                 

        call MOTER_DOWN     ; Call motor to rotate anticlockwise.

        mov dptr,#2022h

        mov a,#30h                  

        movx @dptr,a        ; send lift is free signal.

        call lcdwel

        sjmp DONE

  I_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 r4

        call DELAY

        mov a,r4            ; Increment the number of car in second floor.

        call LED_CODES      ; Display the number of cars.   

        mov dptr,#2041h

        movx @dptr,a

        mov r7,#04h         ;Again load the  number of rotations to motor.

        mov r6,#02h

        call MOTER_DOWN     ; Call motor to rotate anticlockwise.

0��) V0��) V0�) V@��) V���) VP��) V@P��) V

        mov a,#30h

        movx @dptr,a        ; send lift is free signal.

        call lcdwel

        jmp DONE

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

            movx @dptr,a

  GO:    movx a,@dptr 

        jb a.0,GO

        jmp OVER1

 

DONE: movx a,@dptr           ; Compare if start button of the

        cjne a,#33h,OVER1                             keyboard is pressed.  

        mov a,#0ah

        xrl a,r5 

        jz SIREN             ; Call SIREN if third flore is full.

        mov a,#00

        movx @dptr,a

        call lcdbusy

        setb psw.3

 CLEAR: mov r1,#0ah           ; Scanning entered password from keyboard 

        mov r0,#04h

  START: mov dptr,#2020h

        mov a,#0eh

        movx @dptr,a

  WAIT: mov dptr,#2022h    

        movx a,@dptr

        mov r7,#00

        xrl a,r7

        jz WAIT

        mov a,#02

 LOOP: mov r6,a

        mov dptr,#2020h

        movx @dptr,a

        mov dptr,#2022h

        movx a,@dptr

        jnz COLSCAN

        inc r7

        mov a,r6

        rl a

        jmp LOOP

 

COLSCAN: rrc a

        jc DONE1

        inc r7

        inc r7

        inc r7

        sjmp COLSCAN

 

 OVER1: jmp OVER

   DONE1: mov a,r7

        clr psw.3

        setb psw.4

        mov r0,#19h

        add a,r0

        mov r0,a

        mov a,@r0

        clr psw.4

        setb psw.3

        mov dptr,#2021h

        movx @dptr,a

        inc dptr

     UP: movx a,@dptr

        jnz UP

        mov a,#0ah

        xrl a,r7

        jz CLEAR

        mov a,#0bh

        xrl a,r7

        jz BIT_CLEAR

        mov a,r7

        mov @r1,a                     ; Store entered each digit.

0��) V0��) V0�) V@��) V���) VP��) V@P��) Vial">        inc r1

        mov r7,#0ffh

  HEAR: djnz r7,HEAR

        mov r7,#0ffh

 HEAR1: djnz r7,HEAR1

        djnz r0,START

       

        mov r7,#0ah             ;Checking whether entered 4 digit password 

        mov r0,#45h             ;   ....  is any one of the stored password.

  CHECK: mov r1,#0ah

        mov r6,#03h

 CHECK1:mov a,@r0

        xrl a,@r1

        jnz NEXT

        inc r1

        inc r0

        djnz r6,CHECK1

        mov dptr,#2022h

        mov a,#90h

        movx @dptr,a

        clr psw.3

        jmp OK                          ; Jump to OK if password is correct.

 NEXT: inc r0

        djnz r6,NEXT

        inc r0

        djnz r7,CHECK

        mov dptr,#2022h

        mov a,#50h

        movx @dptr,a

  AGAIN: movx a,@dptr

        cjne a,#53h,AGAIN

        clr psw.3

        mov a,#30h            ; Give SIREN if entered password is wrong.

        movx @dptr,a

 REMAIN: movx a,@dptr

        xrl a,#33h

        jz REMAIN

        mov r0,#0ffh

  STAY: djnz r0,STAY

        call lcdwel

        jmp OVER

  

 LED_CODES:setb psw.4

            mov r0,#25h

            add a,r0

            mov r0,a

            mov a,@r0

            clr psw.4

            ret

 

  BIT_CLEAR: dec r1          

           inc r0

           mov r6,#0ffh

    HEAR2: djnz r6,HEAR2

           mov r6,#0ffh

    HEAR3: djnz r6,HEAR3

           jmp START

        

   OK: movx a,@dptr

          cjne a,#91h,OK

          mov a,#10h

        movx @dptr,a

        mov a,#00

        mov dptr,#2021h

        movx @dptr,a

        call DELAY

        mov r7,#06h            ; Give number of rotations to motor so that

        mov r6,#02h            ;  lift goes to third flore.

        call MOTER_UP          ; Call motor to rotate clockwise.

        call DELAY             ;...   floor and display the number of cars.

        mov a,r5

        call LED_CODES

        mov dptr,#2040h

        movx @dptr,a

        mov r7,#06h

        mov r6,#02h

        call MOTER_DOWN       ; Call motor to rotate anticlockwise.    

        call lcdwel

        jmp OVER

 

MOTER_UP:push r5                ;Subroutine for motor to rotate clockwise.

         mov r5,#70h

         mov r0,r6

         mov dptr,#2020h

         mov a,#88h

   h3: movx @dptr,a

         rl a

         mov r2,#30

   h1: mov r1,#255

   h2: djnz r1,h2       

         djnz r2,h1

         djnz r5,h3

         mov r5,#0ffh

         djnz r6,h3

         mov r6,r0

         djnz r7,h3

         pop r5

         ret

  

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

               mov r5,#70h

               mov r0,r6

               mov dptr,#2020h

               mov a,#88h

         h6: movx @dptr,a

               rr a

               mov r2,#30

         h4: mov r1,#255

         h5: djnz r1,h5       

               djnz r2,h4

               djnz r5,h6

               mov r5,#0ffh

               djnz r6,h6

               mov r6,r0

               djnz r7,h6

               pop r5

               ret

 

 DELAY:  mov r1,#10h            ; Subroutine for Delay

  DELAY1: mov r2,#0ffh

  DELAY2: mov r0,#0ffh

  DELAY3: djnz r0,DELAY3

               djnz r2,DELAY2

               djnz r1,DELAY1

               ret

 

    OVER: mov dptr,#2022h

               mov a,#30h

               movx @dptr,a

               movx a,@dptr

               cjne a,#32h,I_OVER

               mov a,#10h

               movx @dptr,a

         &n0��) V0��) V0�) V@��) V���) VP��) V@P��) V

               mov r7,#02h

               mov r6,#02h

         call MOTER_UP         ; Call motor to rotate clockwise.

         dec r3                ; Decrements the number of cars entered to

         mov a,r3              ;... first floor and display the number of

         call LED_CODES        ;...       cars in first floor.

         mov dptr,#2042h

         movx @dptr,a

         call DELAY

         mov r7,#02h

         mov r6,#02h

         call MOTER_DOWN       ; Call motor to rotate anticlockwise.   

         mov dptr,#2022h

         mov a,#30h

         movx @dptr,a

         call lcdwel

 I_OVER: movx a,@dptr

         cjne a,#34h,II_OVER

         mov a,#10h

         movx @dptr,a

         call lcdbusy

         mov r7,#04h

         mov r6,#02h

         call MOTER_UP         ; Call motor to rotate clockwise.

         dec r4                ; Decrements the number of cars entered to

         mov a,r4              ;...second floor and display the number of

         call LED_CODES        ;...       cars in second floor.

         mov dptr,#2041h

         movx @dptr,a

         call DELAY

         mov r7,#04h

         mov r6,#02h

         call MOTER_DOWN       ; Call motor to rotate clockwise.

         mov dptr,#2022h

         mov a,#30h

         movx @dptr,a

         call lcdwel

II_OVER: movx a,@dptr

         cjne a,#38h,END

         mov a,#10h

         movx @dptr,a

         call lcdbusy

         mov r7,#06h

         mov r6,#02h

         call MOTER_UP         ; Call motor to rotate clockwise.

         dec r5                ; Decrements the number of cars entered to

         mov a,r5              ;... third floor and display the number of

         call LED_CODES        ;...       cars in third floor.

         mov dptr,#2040h

         movx @dptr,a

         call DELAY

         mov r7,#06h

         mov r6,#02h

         call MOTOR_DOWN       ; Call motor to rotate anticlockwise. 

         mov dptr,#2022h

         mov a,#30h

         movx @dptr,a

         call lcdwel

  END: jmp REPEAT

 

 lcdwel: push r3                  ; Subroutine for LCD to display

        push r4                   ;  �  WELCOME TO CAR PARKI0��) V0��) V0�) V@��) V���) VP��) V@P��) V

        mov a,#3ch

        call command

        mov a,#0eh

        call command

        mov a,#01h

        call command

        mov a,#06h

        call command

        mov a,#80h

        call command

        mov a,#'W'

        call data

        mov a,#'E'

        call data

        mov a,#'L'

        call data

        mov a,#'C'

        call data

        mov a,#'O'

        call data

        mov a,#'M'

        call data

        mov a,#'E'

        call data

        mov a,#' '

        call data

        mov a,#88h

        call command

        mov a,#'T'

        call data

        mov a,#'O'

        call data

        mov a,#' '

        call data

        mov a,#'C'

        call data

        mov a,#'A'

        call data1

        mov a,#'R'

        call data

        mov a,#aah

        call command

        mov a,#'P'

        call data

        mov a,#'A'

        call data

        mov a,#'R'

        call data

        mov a,#'K'

        call data

        mov a,#'I'

        call data

        mov a,#'N'

        call data

        mov a,#'G'

        call data

        mov a,#' '

        call data

        mov a,#'S'

        call data

        mov a,#'Y'

        call data

        mov a,#'S'

        call data

        mov a,#'T'

        call data

        mov a,#'E'

        call data

        mov a,#'M'

        call data

        pop r4

        pop r3

        ret

 

0��) V0��) V0�) V@��) V���) VP��) V@P��) V

command:mov p1,a

        clr p3.4

        setb p3.3

        clr p3.3

        mov r3,#50

    A: mov r4,#255

    R: djnz r4,R

        djnz r3,A

        ret

 

   data: mov p1,a

        setb p3.4

        setb p3.3

        clr p3.3

        mov r3,#50

     AAA: mov r4,#255

       AA: djnz r4,AA

        djnz r3,AAA

        ret

 

 

  lcdbusy: push r4                ;Subroutine for LCD to display

        push r3                   ;    � LIFT IS BUSY PLEASE WAIT �

        mov a,#3ch

        call command

        mov a,#0eh

        call command

        mov a,#01h

        call command

        mov a,#06h

        call command

        mov a,#80h

        call command

        mov a,#'L'

        call data

        mov a,#'I'

        call data

        mov a,#'F'

        call data

        mov a,#'T'

        call data

        mov a,#' '

        call data

        mov a,#' '

        call data

        mov a,#'I'

        call data

        mov a,#'S'

        call data

        mov a,#88h

        call command

        mov a,#' '

        call data

        mov a,#' '

        call data

        mov a,#'B'

        call data

        mov a,#'U'

        call data

        mov a,#'S'

        call data

        mov a,#'Y'

        call data

        mov a,#aah

        call command

        mov a,#'P'

        call data

        mov a,#'L'

        call data

        mov a,#'E'

        call data

        mov a,#'A'

        call data

        mov a,#'S'

        mov a,#'E'

        call data

        mov a,#' '

        call data

        mov a,#'W'

        call data

        mov a,#'A'

        call data

        mov a,#'I'

        call data

        mov a,#'T'

        call data

        mov a,#' '

        call data

        pop r3

        pop r4

        ret

 

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

Home   |    About Us   |   Articles/ Tutorials   |   Downloads   |   Feedback   |   Links   |   eBooks   |   Privacy Policy
Copyright � 2005-2007 electroSofts.com.
[email protected]