(ELCE Project) 3 level car parking system.

Share Embed


Descrição do Produto

2 " Page






Khalifa University of Science, Technology and Research
Electronic Engineering Department
ELCE332

Microprocessors Laboratory

Mini PROJECT
3-Level Car Parking System
Eman Qawasmi 100038650
Maitha Amiri 100037428







Fall 2015

Contents





1. Abstarct 3
2. Introduction 4
Aim: 5
Objectives: 5
3. Design & Results 5
4. Analysis and Interpretations 13
5. Conclusion 14
6. References_____________________________________________________15












Abstract

Parking system is one of the main important facilities that should have in any infrastructure or building especially for the place of interest and place of people's attraction. The best parking system is the system that provides customers the ease of finding the available spaces, user friendly and less time consuming. This report presents the intelligent parking system. Software and hardware implementations have been carried out. Few electronic components such as Microcontroller, Roadrunner, Dip-Switches and LCD have been used to realize the system. Personal computer and IDE Codewarrior program are used to communicate and interface with the monitor to display that on the LCD It will also present the parking system greetings and validate any information regarding the parking status.
This mini-project is about designing and implementing a 3-Level Car Parking System using ThunderBird12 board. The logic behind this system is the interaction between the input and the output ports. The input ports in this project were: the dip switches. Whereas for output ports were LEDs and LCD screen.
The scenario of this system is to let the user see between three floors (levels), Each floor has three parking lots to park in. For parking in the first floor (for example); once the car is parked, the switch will be closed and this will be shown by the LCD to inform the people by the number of the parks that are occupied so they will know whether there are places to park in or not.
The project was built using C language in IDE Codewarrior. The coding included if statements, while loops, and many other techniques.
This report illustrates through figures and explanations the methods used to design this system and implement it.

Introduction (Theoretical Discussion)


The M68HCS12 has a particularly rich, fully integrated, suite of I/O capabilities, including parallel and serial I/O, analog input, and timer functions. Many of the I/O pins have shared or dual purpose functions. All I/O, and control of I/O, is done using a set of 1024 control registers, which are initially located at memory locations $0000-$03FF.


Input ports:
Dip-Switches
Dip switches are the most basic of all binary input devices. On Thunderbird board all the PTT bits are connected to the red -DIP switches. Note that DIP switches are active-high inputs In order to read a DIP switch , PTT must be programmed as input (DDRT=0x00) and then the specific switch that is connected to a specific input port pin can be read using the data register PTT. The table below shows the PTT connection to the DIP switches and the push buttons. Note that in order to make the car occupy the lot and park in it, the corresponding DIP switch has to be in the upper position.

Output ports:

Light-Emitting Diode (LED):
The simplest display devices on the Thunderbird board are the four light-emitting diodes (LEDs). On Thunderbird board all the PORTB bits are connected to LEDs. In order to turn on Port B LEDs, they must be programmed as output (DDRB=0xFF). These LEDs will be programmed to be turned on once a level is fully filled with cars



LCD screen:

A liquid crystal display (LCD) is a thin, flat electronic visual display that uses the light modulating properties of liquid crystals. LCDs are more energy efficient and offer safer disposal than CRTs. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color. The LCD is a HCS12 board and it is connected to PORT P. It contains 2 lines; each line has the capacity for 16 characters. In order to initialize and access the LCD some pre-written C library functions can be used.


Aim:
The aim of this mini-project is to design and implement a 3-Level smart Car Parking System

Objectives:
There are many objectives behind this mini-project, such as, to use previous skills and knowledge gained during lab experiments and implements it in this project. Also, to be creative in writing the code program instead of writing a missy one. Finally, to be able to design the system with minimal and available components.






Design experiment:

Start Display LCD.L(1): WELCOME TO ELCE332 CAR PARKSYSTEMx1- First floor input. 2- second floor input. 3- Third floor input. Park the car or un park it by moving one of the three (First red dip switches)Park the car or un park it by moving one of the three (Second red dip switches)Display LCD.L(1): Level x : Max 3 Occupied: y Increment/ decrement counter y Goto function 'Start'Start Display LCD.L(1): WELCOME TO ELCE332 CAR PARKSYSTEMx1- First floor input. 2- second floor input. 3- Third floor input. Park the car or un park it by moving one of the three (First red dip switches)Park the car or un park it by moving one of the three (Second red dip switches)Display LCD.L(1): Level x : Max 3 Occupied: y Increment/ decrement counter y Goto function 'Start'Park the car or un park it by moving one of the three (First red dip switches)Park the car or un park it by moving one of the three (First red dip switches)Increment/ decrement counter yIncrement/ decrement counter yThe flow chart of the microwave project is shown in Figure 1.
Start
Display LCD.L(1): WELCOME TO ELCE
332 CAR PARK
SYSTEM


x
1- First floor input.
2- second floor input.
3- Third floor input.
Park the car or un park it by moving one of the three (First red dip switches)

Park the car or un park it by moving one of the three (Second red dip switches)

Display LCD.L(1): Level x : Max 3
Occupied: y


Increment/ decrement counter y
Goto function 'Start'
Start
Display LCD.L(1): WELCOME TO ELCE
332 CAR PARK
SYSTEM


x
1- First floor input.
2- second floor input.
3- Third floor input.
Park the car or un park it by moving one of the three (First red dip switches)

Park the car or un park it by moving one of the three (Second red dip switches)

Display LCD.L(1): Level x : Max 3
Occupied: y


Increment/ decrement counter y
Goto function 'Start'
Park the car or un park it by moving one of the three (First red dip switches)

Park the car or un park it by moving one of the three (First red dip switches)

Increment/ decrement counter y
Increment/ decrement counter y









Increment/ decrement counter yIncrement/ decrement counter y
Increment/ decrement counter y
Increment/ decrement counter y




x is fully occupied with cars (closed switchs == 3) x is fully occupied with cars (closed switchs == 3)
x is fully occupied with cars (closed switchs == 3)
x is fully occupied with cars (closed switchs == 3)
make a led that relates to that x to be turned on. make a led that relates to that x to be turned on.
make a led that relates to that x to be turned on.

make a led that relates to that x to be turned on.

Yes

No



The Flow chart of the car parking system

So, As Mentioned previously; this project, uses Thunderbird microcontroller as the primary one. Besides, it is consist of various inputs and outputs circuits together with a car parking system model. The microcontroller is used to coordinate the functions of various hardware circuitries are used as input. The car parking model was constructed to simulate an actual car parking in the real life. It can be counted as the output hardware of the system. The software for the system was too designed according to the real car parking management in smart companies parking's lots. The combination of the hardware and software perform the simulate function of a basic car parking system.





block diagramfor the car parking system.block diagramfor the car parking system.
block diagramfor the car parking system.
block diagramfor the car parking system.

In this work, we show the basic car system with three floors (levels). Also, in this project, we will show three floors with 3 switches (with three lots for each floor).When we press a start switch; the floor automatically starts and immediately responds to user input display which includes occupying a certain lot in that floor. Some options are there for the user if he wishes to park in other floor, so he will make his selection to go to a particular floor and park in the available lots if there are some. Below is the list of choices the user can make.
1. First floor input.
a) User can go to second floor and choose a lot from there.
b) User can go to third floor and choose a lot from there.

2. Second floor input.
a) User can go to the first floor and choose a lot from there.
b) User can go to third floor and choose a lot from there.

3. Third floor input.
a) User can go to first floor and choose a lot from there.
b) User can go to second floor and choose a lot from there.

For a given condition suppose that the user wants to park in the second floor. This condition is accepted by the system by the programmer as a switch entry. Then the user has to choose an available lot to park in (if there were some free lots).

Pin configuration of LMC-STC2E16 (The LCD)
In this project, we use the MC9s12 controller to interface all the inputs and outputs. In the input device, we use three red Dip-switches boxes. In output, we use one LCD and LEDs as a display. The brain inside the controller is to control all these inputs and outputs and perform perfectly.
Thunderbird12 –our used controller- is an 80 pin controller with 12K bytes of RAM and 4k byte of EEPROM inside.
Pin no. 60 of the controller is supposed to be connected to the positive 5 volt power supply. But since we have not used any sensors; the laptop will be powering our Roadrunner USB stick- that is combined with the controller so it works as a versatile minimal prototype system. The road runner makes our prototyping much neat and reliable on .Its connected to the controller with no need for any external voltages from the any power supply. So we don't need to provide a 5 volts regulated power supply on this pin. Pin no 9 is the reset pin and this pin is connected to a Data bit 6 of the LCD -that is pin No.13 in it- in order to provide an auto-reset option for the LCD, we connected the LCD Reset pin (pin no.4 on the LCD) to pin no. 13 on Thunderbird board which is PP0. Pin no. 61 of the controller is connected to the ground pin of the LCD as well. Pin no. 12 (PP1) is connected to the ENABLE SIGNAL (E) on the LCD (that is pin No.4 on the LCD). Also, Pin no. 11 of the Microcontroller- that is (PP2)- is connected to the Data bit 4 (DB4) that is pin no.11 in the LCD. Pin no. 10 (PP3) is connected to the Data bit5 (DB5) that is pin no.12 in the LCD. As well, we have Pin no. 8 (PP5) is connected to the Data bit7 (DB7) that is pin no.14 in the LCD.
The LCD resolution was controlled with a potentiometer that is about 10 K . . it has three terminals the first terminal was grounded while the second was connected to the VCC, the third terminal was connected to the VDD. This potentiometer resistor is only for making the LCD screen as clear as we wish.
In order to connect the switches with the microcontroller, we used Port T and Port A as well. The first floor (level) parking switches were connected to port T; pin PT0, PT1 and PT2 with a 30 resistor for each one of them.
This is actually a method that is called "pull up switch".









As its illustrated in the figure above, this method have been carried out in our connections in order to connect the input of the switches to the microcontroller., Second floor switches were connected by 30 resistors with portT pins; PT$, PT5 and PT6. While the third floor switches were connected by resistors too to portA pins; PA3, PA2 and PA1.
Also, built in LEDS are used from the microcontroller (Port B) -beer in mind that you will see our code refers to portB as an output ; (DDRB=0xFF) . So the switches will be connected with portB. The first level switches box is connected to pin PB0 (pin No. 30) while the second level switches box is connected to pin PB1, and the third level switches box is connected with PB2
LEDS are flashed when their level is full of cars to indicate that this floor has no free lots to park in.
When parking system is running, Port p of the controller is connected to the LCD directly. Here we use port p with the data pins of the ASCII code. LCD displays only the ASCII code. In the programming, we convert the digital code in to ASCII code by adding 30h in any binary number. So to provide a data in the LCD, we send these codes by the data lines. These data lines from the controller are from the PP0 to PP1.. PP2, PP3, PP.4 and PP5 are connected to the control pins of the LCD. On this control pin, we select the command register, data register and the enable pin. We use the command and the data register pins to send the data and command separately. The interfacing of microcontroller with the LCD chip was mentioned previously and is shown below as a hardware implementation of the circuit.





















Hardware implementation of the car parking system Hardware implementation of the car parking system
Hardware implementation of the car parking system
Hardware implementation of the car parking system



Software implementation:

The use of C language to program microcontrollers is becoming too common. And most of the time it's not easy to build an application in assembly-that have been learnt earlier in this cours- which instead you can make easily in C. So It's important to know the C language for microcontroller which is commonly known as Embedded C

Writing to LCD
It is required to write a C language program using the LCD function calls to print the following text message "WELCOME TO ELCE 332 CAR PARK " on the first line of LCD and " SYSTEM " on the second line. The two messages should be displayed for an amount of time and cleared for another amount of time second and so on as a flashing text. The flashing should be done alternatively so that when the first line appears, the second disappear and vice versa. Figure 9 shows the C code of this task.

Figures below show the LCD screen for a test on the previous code. The result on LCD screen once the programm is runned is showen below.



Here is the C language code that was used in this project:
#include /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#include "lcd1.h"

int one=0, two=0, three=0;

int prk1,prk2,prk3;

int prk4,prk5,prk6;

int prk7,prk8,prk9;

int x=1;

void main(void) {

DDRB=0xFF;
DDRT=0x00;
DDRA=0x00;
PORTA=0x00;
PORTB=0x00;
PTT =0x00;

LCD_Init();
LCD_clear_disp();

for(;;) {

LCDWriteLine(1,"WELCOME TO ELCE");
LCDWriteLine(2,"332 CAR PARK");

delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);

delay(250);
delay(250);

LCD_clear_disp();
LCDWriteLine(1,"SYSTEM");

delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);


LCD_clear_disp();


if(PTT_PTT0 == 1) { prk1=1;} else{ prk1=0;}
if(PTT_PTT1 == 1) { prk2=1;} else{ prk2=0;}
if(PTT_PTT2 == 1) { prk3=1;} else{ prk3=0;}


one=prk1+prk2+prk3;


if(one==3){ PORTB_BIT0=1;}
if(one!=3){ PORTB_BIT0=0;}

LCDWriteLine(1,"Level 1: Max 3");
LCDWriteLine(2,"Occupied: ");
LCDWriteInt(one);

delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);

LCD_clear_disp();


if(PTT_PTT4 == 0x01) { prk4=1;} else{ prk4=0;}
if(PTT_PTT5 == 0x01) { prk5=1;} else{ prk5=0;}
if(PTT_PTT6 == 0x01) { prk6=1;} else{ prk6=0;}

two=prk4+prk5+prk6;

if(two==3){ PORTB_BIT1=1;}
if(two!=3){ PORTB_BIT1=0;}

LCDWriteLine(1,"Level 2: Max 3");
LCDWriteLine(2,"Occupied: ");
LCDWriteInt(two);

delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);


LCD_clear_disp();

if(PORTA_BIT3 == 0x01) { prk7=1;} else{ prk7=0;}
if(PORTA_BIT2 == 0x01) { prk8=1;} else{ prk8=0;}
if(PORTA_BIT1 == 0x01) { prk9=1;} else{ prk9=0;}

three=prk7+prk8+prk9;

if(three==3){PORTB_BIT2=1;}
if(three!=3){PORTB_BIT2=0;}

LCDWriteLine(1,"Level 3: Max 3");
LCDWriteLine(2,"Occupied: ");
LCDWriteInt(three);

delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);
delay(250);

LCD_clear_disp();

}

}

As mentioned previously, the switches are enabled as input previously so no need to re-enable them again. The table below shows how the selection of your parking lot-that is done by moving the DIP switches- will be shown on the LCD.
So here we examine an example of having some cars occupying certain lots in the three different levels. The table below clears out what the LCD shows about each level.

Level
DIP switch
LCD
1


2


3





Third FloorThird FloorIn the picture below we are investigatin how the flashing LEDs works on and how they indicate the parking status in each floor;
Third Floor

Third Floor

Second FloorSecond FloorFirst FloorFirst Floor
Second Floor

Second Floor

First Floor

First Floor


So as it can be seen from the picture, the first floor switches box is connected to pin PB0 and since we have three switches positioned up (high), this means that all of the three lots are occupied and there is no free places available. Therefore, the PB0 led is turned on as it shows in the picture. Second floor still has a free lot, which is why pin PB1 led is turned off. While the third floor lots are completely full with cars – as same as floor one previously- so that is why Pin PB2 is turned on as well.



Analysis and Interpretations


The project required to design a C code for a microcontroller (Thunderbird+) that controls the car parking system. The code is a combination between what was given through the labs with extra coding.
The first step was main screen. The main screen shows the welcoming statement. And then starts validating any information regarding the parking status based on the position of the switches whether they were high or low which indicates occupying the lot or not.
DIP switches were set to represent occupying the lots while counting them. When DIP is law = lot is occupied , high = lot is empty.
A display is provided at each floor which is basically a counter that counts number of cars in each floor. It informs whether the floors are fully filled with the cars or is it having place or not. In this project we have provided three floors of a building for car parking. Maximum storage capacity of each floor is given as three cars.
Any car can enter inside the car parking area. When the car enters and parks, the switch will be high indicating that this slot is occupied, The counter value increases so that it shows on the LCD how many cars are in there.
The flowchart was used to ease and illustrate the whole structure of the coding for the microwave controller.






5. Conclusion

The report clearly demonstrates the way the 3-level parking controller system was implemented. Most of the input and output ports of the HCS12 Thunderbird12 board were used to complete the systems. The project in fact was meant to give us the chance to link all of the learned techniques through the course. It was also highly beneficial as it gave us an insight view of how advanced smart parking system is programmed in order to be used in embedded systems later on. It is also quite important to mention that our code was optimized so it can hold fewer contexts, and avoid complex instruction.
Generally, the project was quite useful to us as these techniques are going to be used in further hardware programming courses, in addition to programming courses in C language.











References
Jin Xu, et al, "Vision-Guided Automatic Parking for Smart Car," IEEE Intelligent Vehicle Symposium (2000), 725-730.
Sheng-Fuu Lin , Yung-Yao Chen , "A vision-based parking lot management system"., 2006 IEEE Conference on Systems, Man, and Cybernetics.Peter. C, pp. 2897-902, Oct. 2006.
Q.Wu, C. Huang, S. yuWang, W. chen Chiu, and T. Chen. "Robust parking space detection considering interspace correlation." In Proceedings of IEEE International Conference on Multimedia and Expo, pages 659–662, 2007.
Paromtchik, Igor; Laugier, Christian (1998). "Automatic Parallel Parking and Returning to Traffic", Video Proceedings of the IEEE International Conference on Robotics and Automation, Belgium, May 1998.
Aristeidis Karalis; J.D. Joannopoulos, Marin Soljačić."Steering and Velocity Commands for Parking Assistance", Proceedings of the 10th IASTED Conference on Robotics and Applications, USA, August 2004, pp. 178-183.
C. Laugier. "Autonomous parallel parking of a nonholonomic vehicle," in Proc. of the IEEE Intelligent Vehicles Symp., Tokyo, Japan, September 1996, pp. 13–18.
Driss, V. Rodrigez, and P. Cohens, "Parking a vision-guided automobile vehicle," in Proceeding of the IEEE on Control and Applications vol.1, Glasgow, UK, August 1994.



Lihat lebih banyak...

Comentários

Copyright © 2017 DADOSPDF Inc.