1. Jonathan Lepp
ECE 323 Final Project
Parking Meter Design Embedded System in C
Department of Electrical and Computer Engineering
St. Cloud State University
12/11/2015
2. Lepp 2
Table of Contents
Objective of project 3
Hardware Components 3
Circuit Discription 3
Circuit (Fig P.1) 4
LPC 2378 Microprocessor (Fig P.2) 4
DesignSpecifications 4-5
Block Diagram Description 5
Block Diagram 6
State Table/State Diagram 7
Examples of Working System 8
Discussion 8-9
Conclusion 9
3. Lepp 3
Jon Lepp
ECE 323 Final Project
Dr. Amiri
12/11/2015
Parking Meter Desing
Objective
The objective of the final project is to design a parking meter that utilizes the LPC2378
microprocessor, liquid crystal display (LCD), resistors, keypad, and several LEDs to take user
input from the keypad to display what parking space is desired by the user. There are several
design constrictions to this project so a block diagram should be implemented in the design.
There will also be hardware and software components to this lab that will be implemented
together in the final project as an embedded system. See content under Design Specifications for
further details on design constrictions for this project.
Hardware Components
1. Hitachi HD44780U LCD Display (1)
2. 4x4 Keypad (1)
3. 220 Ω resistors (4)
4. 10 kΩ resistors (4)
5. 1 kΩ resistor (1)
6. SN74LS08 AND gate or equivalent (1)
Schematic
The following schematic in Fig P.1 interfaces the keypad, LCD display, and the LPC2378
microprocessor board. This schematic also includes the use of the AND gate, an LED indicator
that indicates when a button is being pressed, and all of the resistors used in the embedded
system besides the resistors on the LPC2378 board. This is the only schematic implemented in
the final design. The output ports shown in the schematic are then interfaced with port 4, pins 0-7
on the LPC2378 board. The port 4 pins connect the keypad to the microprocessor to allow a user
interface with the microprocessor. The onboard LED’s on the LPC 2378 board are used to
indicate the parking space being occupied by the user. The LED’s will initially all light up when
the user begins the program. When a user has selected their spot in the parking lot and confirms
with the program their desired space, the LED indicating that specific position will turn off.
When the time constriction for that spot is up, the LED will then light back up indicating the
spots availability for another user. For further details see the design constrictions.
4. Lepp 4
Fig P.1 (Keypad Interface Schematic)
Fig P.2 shows LPC2378 board which consists of the microprocessor, LCD, and GPIO port pins
implemented in the final design. The onboard LED’s are shown right below the LCD screen and
use the port 2 pins which are implemented in the program. These LED’s are programmed to turn
off or on depending on the user choosing that spot or not. See example photos for further details.
Fig P.2 (LPC 2378 Microprocessor Board)
DesignSpecifications
The parking meter being designed for this problem has eight different parking spots to keep track
of using a timer and LED indicator lights to signal which spots are empty or full. Once a spot has
been chosen by the user correlating to the spot where they wish to park, the user is to press a key
on the keypad labeled zero through seven. Once the user has selected a spot and confirmed that is
the spot they are parked in by pressing the “*” key, the LED light indicating the space is open
5. Lepp 5
when it is on will then switch off indicating the parking spot has been filled. At this time a
default time will be set allowing the user to remain parked there for the allotted time. The user
has the option to add more time to the duration of their parking as well. Once the user’s time has
expired, the LED will turn on indicating their parking time has expired.
Next, implementing the LCD into the project, several messages must be displayed in
order to display the system status. Upon initial turn-on or the reset button is pressed, the LCD
should display an initial message stating “Final Project by” on the first line of the LCD and “Jon
Lepp” on the second line of the LCD. This should remain on the LCD for a duration of two
seconds, after which it is replaced by the message stating “Enter Lot #”, “date (day and month)”,
and “current time” referring to the actual time. When a valid key (0-7) is pressed, the user must
confirm their submission by pressing the button “*” on the keypad. Upon user confirmation of
the spot, the parking spot selected will then be displayed on the LCD and be shifted one space to
the right of the “Enter Lot #” message. At this point, a count-down message will be displayed on
the LCD indicating the amount of time in minutes the user has remaining for the parking spot.
The user has the option to add extra time to their parking duration by pressing the “A” on the
keypad. This will add 30 minutes to the time duration for each additional press. When an invalid
key is pressed on the keypad, a null message will be displayed. For example when a key is
pressed on a pop machine vending unit, the price is displayed for the item and will not vend the
pop until money has been entered into the machine.
Finally, the computer is implemented into the project. Upon initial startup of the project,
the computer will display the message “***ECE323 Final Project – Parking meter project***” as
well as “Developed by Jon Lepp, 2015”. The computer will also have the capability of
requesting the list of expired parking spots. This consists of all the design specifications for this
project.
Block Diagram
The following block diagram is an example of the algorithm that will run when a user starts the
program. This block diagram is only specific for one user input rather than multiple inputs. It
shows the simplest form of the algorithm that is run. If there are going to be multiple user inputs,
as is the case when another user wants to park in a different spot, a few more blocks will have to
be added and implemented into the system. However, for demonstration purposes this block
diagram serves its purpose.
6. Lepp 6
State Table/Diagram
The following state table and state diagram displays the different states of the program based
upon user input from the keypad. State 1 is the reset state. When the user presses a valid input (0-
7 on keypad), the state enters state 2. Upon user confirmation by the (*) key on the keypad, the
state is switched to state 3. At this point the count will begin. The user also has the option to add
additional time to the clock. If user enter (A) on the keypad the state goes to state 5. Otherwise
the state goes to state 4 and clock begins. Once time has expired, the state enters state 6 and will
7. Lepp 7
eventually return to state 1 where the initial message is again displayed on the keypad asking the
user to enter a lot number using the keypad.
Circuit/Picture of System
The following pictures show several examples of the system being implemented at different
times throughout the program. Fig P.3 shows the initial startup of the program. This is the same
message that will be displayed when the reset button has been pressed. Fig P.4 shows the user
interface a few seconds later when the system asks the user to select a lot number. The user
should select their desired lot number using the keypad digits 0-7 correlating to the position they
wish to park in. When the user has selected their desired position, the LCD will wait for the user
to confirm that position. Nothing will happen until the user has selected the (*) key on the
keypad. At this time a counter will turn on indicating the amount of time a user has to remain
parked in that position. This is shown in Fig P.5. The user also has the option to add more time to
the count. This program began the count with ten seconds. If the user presses the (A) key on the
keypad, the timer adds an additional 30 seconds to the count. This is shown in Fig P.6.
8. Lepp 8
Fig P.3 (Initial Message) Fig P.4 (Enter Lot # Message)
Fig P.5 (Timer) Fig P.6 (Added Time)
Discussion
I completed this project alone. Some of the files that were added to the code from lab 10 could be
found online. There were many examples of adding a real time clock to an LCD display. Some
of the examples I looked at used C code and others used the Arduino IDE. I found it helpful to
look at Arduino examples because the code is similar to that of C. The LED files simply had to
implement the right ports correlating to the state table relating to the user input of the parking
spot. For this part of the code I referenced a previous lab where the onboard LED’s were lit and
9. Lepp 9
switched on and off. The hardest part of the project was implementing the state table into the
main C file. Some of the problems I had was when I went to implement all of the hardware
together. The wires I was using to connect the keypad to the ports of the microprocessor kept
coming out of the female headers on the board which would then mess up the display. This made
everything hard to troubleshoot. For example, initially I had a wire in the wrong position that
was supposed to go to port 2, pin 10 for the output of the AND gate. The initial display showed
up on the LCD so I knew the program was working, however I couldn’t get the LCD to display
the lot number desired. To trouble shoot I initially thought it was my code. After not finding
anything I looked back at the circuit to find several wires had pulled out of the headers. So I put
those back in and it still didn’t work. So I took a closer look at my circuit and found the problem
in my circuit. After fixing this, the program worked as desired. It just makes it altogether hard to
troubleshoot a project like this because you don’t know where to look. You can look at your
code, your circuit, or the interface to the microprocessor. However, if you don’t do this in
incremental steps, you can remain lost in a problem such as this for a very long time and the
problem could be staring you in the face and be something as simple as a wire in the wrong
position as I found out.
Conclusion
This purpose of this experiment was to create a parking meter. This experiment built off of the
code used in lab ten. In addition to the C code used in lab ten, several additional pieces of code
had to be implemented into the final code to meet the design constrictions. For example, a real
time header file, and LED header file, the real time C code, and the LED C code had to be added
to the files used in lab ten in order to get the real time clock to display and the LED to indicate
the user position in the parking lot. In addition to this, the main C code file also had to be
changed to implement the different states of the program for the user interface. The parking
meter design worked, but there were several problems upon check off that had to be dealt with.
For example, the wires that were used to connect the keypad interface to the LPC 2378 kept
coming out of the port positions because the female headers were too loose for the wires being
used. Despite this problem, this system met all of the design constrictions.