Automated Parking System - Final Report

By Allen Ong 355136

  Ritchie Poon 342326

  Yat Lai 243781

 

1.0 INTRODUCTION

This report culminates the design of the Automated Parking System Controller. The device will be able to monitor and regulate the complete operation of a car park. The behavior of the device was coded in VHDL and simulated using the Altera MaxPlusII software. Upon successful simulation of our code, the design was downloaded to the Altera UP1 education board and tested with the prototype hardware for an Automated Parking System. Each step of our design and verification process is documented here.

 

 2.0 SYSTEM OVERVIEW

 The overall Automated Parking System consists of the Automated Parking System Controller (2 Altera FLEX10K20 FPGA chips) as the central unit, controlling a pay terminal interface, a photo-detector system, and a parking slot availability indicator board. The system block diagram is given below followed by the description of the functionality of each block.

System Block Diagram

 

2.1 Automated Parking System Controller

The main function of this device is to regulate the operation of a parking facility. This includes navigating the user to an available parking slot, storing the entrance time, calculating the parking charges, providing a interface for paying and handling security matters.

Firstly, the device interfaces with a LED Parking Slot Availability board that indicates the location of available parking slots to the customer at the entrance of the parking facility. It provides a ‘1’ signal when a particular slot is occupied and ‘0’ otherwise. A car park full signal is also provided when all slots are occupied. Now, as soon as the customer completely parks their vehicle, this device will store the corresponding entrance time for that particular slot in its memory. This process is triggered by the photo-detector system which senses the presence of a vehicle at each parking slot. The controller would poll the photo-detector system at a 3 seconds interval. When a transition from ‘1’ to ‘0’ is observed and the signal stays at ‘0’ for the next 3 polling (9 seconds), the controller assumes that the vehicle is stationary (customer completes parking routine) and stores the current time. A memory of 256 x 16 bit is available for storage of the entrance time (capable of supporting 256 slots).

Parking charges are calculated by the ½ hour and two different rates ( $0.25 every ½ hour (rate 0) or $0.50 every ½ hour (rate 1) ) can be selected. Selection is done in the supervisory mode (refer to User Manual). To calculate the charge, the customer first enters the slot number which will be used by the device as an address pointer to retrieve the stored entrance time for that slot. Then, the stored time (in a 24 hour format) is subtracted from the current time to obtain the parking duration and subsequently the parking charge.

A user-friendly interface terminal is controlled by this device for the customer to pay their parking charges as well as the parking supervisor to preset the system. The current time (24 hour format), slot number and parking charges or duration is displayed on the terminal. Push-buttons and a 10-digit keypad are available here for user input as well as LED lights to guide the user in making their selections. This device will accept $2.00 and $1.00 coin payment and provides the exact change in $0.25 increments. The charge display on the terminal will be updated constantly as payment is being made to indicate the remaining charge. In our design, 2 push buttons were used to provide the coin payment signals and 4 LEDs to indicate the number of quarters provided in change.

When the customer pays off all the parking charges for his slot, a paid signal would be set to ‘1’. This allows the customer to leave. An alarm will be triggered if a customer attempts to leave the parking slot without paying. A switch is provided to turn off the alarm when necessary.

On the whole, the Automated Parking System Controller has 2 operating modes: supervisory and normal. Supervisory mode allows the parking supervisor to setup the time and parking rate. Then, the system goes into normal operation until the reset button is pressed. Please refer to the User Manual in the Appendix C for initialization sequence and operating procedures. The table below summarizes the I/O of the controller.

 PIN NAME 
TYPE
FUNCTION
Clk In System intenal clock (6.25 MHz)
Reset In (push button) Resets and initialize the system. Invoke supervisory mode.
Start_end In (push button)  Starts the paying process
Charge_display In (push button)  Shows the parking duration
In_loonie In (push button) $1.00 coin is deposited
In_toonie In (push button) $2.00 coin is deposited
Keypad_input (9..0) In (10 push buttons) Keypad selection signals (0 – 9)
Photo_detect (7..0) In (8 photo detectors) Provides the availability status of each parking stall
Changer Ready  In (DIP switch) Feedback from the changer indicating all change has been provided
Data_7_display (6..0) Out (7 segment display) Data line for the seven-segment displays
Enable_7_display (8..0) Out (7 segment display)  Selects which of the 9 seven segment display is to be enabled
Changer_output Out (LED)  Indicates the number of quarters provided as change
Sel_sup Out (LED) Indicates that system is in supervisory mode
Sel_keypad Out (LED) Indicates to user that system is waiting for keypad input
Sel_coin Out (LED) Indicates that to user that system is waiting for a coin input (in_toonie / in_loonie)
Sel_startend Out (LED) Indicates to user that system is waiting for startend input
Avail(7..0) Out (8 LEDs) Shows the availability of each parking stall
Full_sign Out (LED) Indicates that car park is FULL

 

   2.2 Parking Slot Availability Indicator

 

Parking Slot Availability Indicator

This indicator, which is located at the entrance to the car park, helps navigate the customer to an empty parking slot. It contains 9 LED lamps indicating the available parking slots in the car park. By letting the customer know the location of the available parking slots, this will effectively reduce their searching time.

Eight LED lamp is used to indicate the availability of each of the 8 parking slots and one more to indicate that the car park is full. The slot LED would turn ON when the parking slot is available (empty) and OFF when the parking slot is occupied. When all the parking slots are occupied, the "Car Park FULL" LED turns ON.

 

2.3 Photo-Detector System

The photo-detector system consists of 8 infrared transmitter-receiver pair, one located at each parking slot, which detects the presence of a vehicle at the parking slots. The schematic of our designed detection circuit is as follows.

* 100 W resistor to limit the IR-emitter current to 50 mA (maximum 60 mA)

* 1 kW is the suggested current-limiting resistor for the photo-detector

 
Figure 3 : Photo Detection System Schematic

When the parking slot is available (i.e. no vehicle is present), the light emitted by the LD 271 Infrared Emitter would be detected by the SFH300 Phototransistor, thus giving rise to an ~ 0 V output (logic level ‘0’). If a vehicle comes along and occupies the parking slot, the light path would be blocked. Then, the phototransistor would be OFF and the output would be clamped to ~ 5V (logic level ‘1’). Note here that the emitter and receiver would be lined up in such a way that the light path would be blocked by the presence of a vehicle at the parking slot.
 

Logic Level
Parking Slot Status
0
AVAILABLE
1
OCCUPIED
Table 1 : Photo Detection System Output Summary

 

2.4 User Interface Terminal

 

Pay Terminal Interface

The user interface terminal serves as the main interface between the car park customer (as well as supervisor) and the parking system. It enables the customer to pay their parking charges and the parking supervisor to initialize the system. The illustration of our designed interface is given below.

The terminal consists of 8 LEDs, 9 seven-segment displays, 4 push buttons and 1 keypad. The LED lamps help make the interface user-friendly. Four of the LEDs are used as Panel Indicators which lights up the active panel. This guides the customer through the paying cycle by indicating which field of buttons to select. Five other LEDs are used as Selection Indicators which lights up the customers selections. This reminds the customer on his/her selections. Another LED (Supervisory Indicator) is used to indicate the current mode of the system. It will turn ON when the system is in supervisory mode and goes OFF during normal operation. Apart from this, 9 seven-segment displays are present to display the current time (4 displays), slot # (1 display), and charge, duration or password (4 displays). All the seven-segment displays are controlled by 16 signal lines form the FPGA (7 data lines and 9 enable lines – one for each display). The BCD to seven-segment conversion is done internally in the FPGA and the data is written to each display in a cycle at a frequency fast enough to avoid flickering of the display.

A 10 button keypad (0-9) is available for the customer or supervisor to input data into the system. The keypad is implemented using 10 signal lines (1 for each push button) which is decoded in the FPGA to give the corresponding value (4 bit signal value – 0 to 9). Apart from this, a START / END push button is present to restart or end the paying sequence. Two push buttons (Loonie and Toonie) are used for coin payment while another push-button (TOGGLE) is used to toggle between displaying the duration parked or total charge. Finally, this terminal houses an array of 4 LEDs that displays the amount of quarters provided as change.

Note that a supervisory reset push button is available at the terminal to reset the system and invoke the supervisory mode. This push button is usually locked up and is only accessible by authorized personnel.

 

3.0 DESIGN DETAILS

Our design was synthesized using VHDL via the Altera MaxPlusII software package. A bottom-up design methology was used. The lower level entities were individually coded first and we proceeded up the design hierarchy, as given below.

Since the design was too large to fit into one chip (1328 /1152 logic cells), we decided to implement the design on 2 separate Flex10K20 chip. This is because we were able to separate the system into 2 almost independent parts and we do not want to remove any features from the system. Thus, the device consists of 2 ICs, namely terminal controller and monitor.

VHDL Design Hierarchy

 

3.1 Terminal Controller IC Design

 

The terminal controller IC includes 8 high-level entities and the top-level entity "term_con". The following is the list of entity declarations of the VHDL codes, followed by explanatory notes for each module.

 

Term_con (TERMINAL CONTROLLER)

entity term_con is
port (clock, reset : in std_logic;
        clk_ext : in std_logic;
        start_end, charge_display : in std_logic;
        in_toonie, in_loonie : in std_logic;
        keypad_input : in std_logic_vector(9 downto 0);
        sel_coin, sel_keypad, sel_sup, sel_startend : out std_logic;
        paid : out std_logic;
        paid_slot : out std_logic_vector(3 downto 0);
        data_7display : out std_logic_vector(6 downto 0);
        enable_7display : out std_logic_vector(8 downto 0);
        total_change : out std_logic_vector(3 downto 0);
        changer_ready : in std_logic; ctime : out std_logic_vector(15 downto 0)
        );
end term_con;

This entity is to monitor the pay terminal. It uses the entities, calculate_charge and cash_vendor, to calculate the charge for selected slot and take care of the paying process respectively. After the system is being reset, the terminal controller will enter to supervisory mode and be asked to input the current time as well as the rate. As soon as the time and the rate are set, the terminal controller will be in normal operation mode. During the normal operation mode, customer can select the slot number which user wants to pay for and then the charge will be displayed on 7-segment LEDs. The duration can be displayed on the same 7-segment LEDs when the toggle button is pressed. User can pay either by toonie or loonie. The remaining charge will be displayed on the 7-segment LEDs when the customer is paying. After the paying process, the change will be dispensed in quarters only if there is change and customer is asked to press the "End" button to end the paying process.

 

Clock_inc2 (used by CLOCK)

clock_inc2

entity clock_inc2 is
port (clock :in std_logic;
        reset : in std_logic;
        h2i, h1i, m2i, m1i : in std_logic_vector(3 downto 0) ;
        h2o, h1o, m2o, m1o : out std_logic_vector(3 downto 0) := "0000";
        clock_go : in std_logic
        ) ;
end clock_inc2;

This entity is used to increment time and pass the incremented time to clock2 entity. The inputs are the current time from clock2 entity. This entity is designed to use a counter to increment time. When the counter has reached the clock frequency minus 3, it will increment the time by a minute and pass the output to clock2 entity.

 

Clock2 (CLOCK)

entity clock2 is

port (clk1, reset : in std_logic;
        keypad : in std_logic_vector (3 downto 0);
        enter : in std_logic;
        normal_op : out std_logic;
        cur_time : out std_logic_vector (15 downto 0)
        );
end clock2;

This entity allows user to input the current time from the keypad after the system is being reset. It does not accept any invalid input. If the acceptable input has been entered from keypad, it will be echoed on the correspondent 7-segment LED. If invalid input has been entered from keypad, the system will ask user to input a valid number again. After a valid time has been entered, the clock will be in normal operation mode and a signal, normal_op, is asserted high. This entity uses the entity clock_inc2 to increment the time. The current time, in BCD format, will be encoded to 7-segment format using decode_7seg entity and then will use output_7seg_display entity to output the current time to the correspondent 7-segment LEDs.

 

Calculate_charge (CALCULATE CHARGE)

entity calculate_charge is
port ( clk, reset, restart : in std_logic;
         keypad : in std_logic_vector(3 downto 0);
        set_slot, enter, set_rate : in std_logic;
        cur_time : in std_logic_vector(15 downto 0);
        duration : out std_logic_vector(15 downto 0);
        total_charge : out std_logic_vector(7 downto 0);
        done_rate : out std_logic;
        slot_number : out std_logic_vector(3 downto 0);
        done_cal : out std_logic
        );
end calculate_charge;

This entity is a synchronous state machine that calculates the total charge for an entered slot based on the stored entering time and the current time. It also allows the car park supervisor to change the parking rate multiplier which specifies the charge on a half-an-hourly basis. When certain slot number has been selected, it will retrieve the entered time for the corresponding slot and then calculate the difference between the current time and the entered time. Furthermore, it also computes the number of 30-minute blocks for the duration and multiplies the selected rate to obtain the total charge.

 

Cash_vendor (CASH VENDOR)

entity cash_vendor is

port (reset : in std_logic; clk,
        sel_cash : in std_logic;
        total_charge : in std_logic_vector(7 downto 0);
        in_toonie, in_loonie : in std_logic;
        changer_ready : in std_logic; total_change : out std_logic_vector(3 downto 0);
        output_charge : out std_logic_vector(15 downto 0);
        complete_cash : out std_logic
        );
end cash_vendor;

This entity regulates the paying/coin slot at the terminal controller. It accepts only toonie and loonie for paying and the changer only provides 25 cents change. It takes in an 8-bit word, representing the total charge, and then output it into the 7-segment LEDs. When payment is received, the total charge will be decrement by the paid amount and then output the remaining charge into the 7-segment LEDs. This process repeats until the remaining charge has reached zero. A signal, complete_cash, will be asserted when all charges have been paid.

 

Keypad_decode1 (KEYPAD DECODER)

entity key_decode1 is
port ( reset : in std_logic;
        clk : in std_logic;
        keypad_input : in std_logic_vector (9 downto 0);
        keypad : out std_logic_vector (3 downto 0);
        enter : out std_logic
        );
end key_decode1;

This entity will take in 10 binary words from keypad and decode them into a BCD word. Each BCD word represents a digit of the desired input from the keypad. Furthermore, a "enter" signal will be asserted when any of the ten keys is pressed.

 

Decoder_7seg (7 SEGMENT DECODER)

entity decoder_7seg is

port (input: in std_logic_vector(3 downto 0);
        led: out std_logic_vector(6 downto 0)
        );
end decoder_7seg;

This entity will take in a BCD code and decode it into a 7-segment code. It will be used in output_7seg_display entity.

 

Output 7-segment display (OUTPUT 7 SEGMENT SELECTOR)

entity output_7seg_display is
port ( clk : in std_logic;
        reset : in std_logic;
        cur_time : in std_logic_vector(15 downto 0);
        duration : in std_logic_vector(15 downto 0);
        charge : in std_logic_vector(15 downto 0);
        slot_num : in std_logic_vector(3 downto 0);
        charge_display : in std_logic;
        data_7display : out std_logic_vector(6 downto 0);
        enable_7display : out std_logic_vector(8 downto 0)
        );
end output_7seg_display;

This enitiy is used to output the current time, the slot number, the charge and the duration in 9 common cathode 7-segment LEDs on the pay terminal. The data will be displayed one digit after one digit and the sequence repeats at a rate of 347kHz which is fast enough for human eyes seeing the 7-segment LEDs remain turned on.

 

3.2 Monitor IC Design

 

The monitor IC includes 2 high-level entities and the top-level entity "monitor". The following is the list of entity declarations of the VHDL codes, followed by explanatory notes for each module.

 

Ram (RAM CONTROLLER)

entity ram is
port (clk : in std_logic;
        reset : in std_logic;
        sel_avail, sel_cal : in std_logic;
        avail_data : in std_logic_vector(15 downto 0);
        avail_addr : in std_logic_vector(7 downto 0);
        cal_data : out std_logic_vector(15 downto 0);
        cal_addr : in std_logic_vector(7 downto 0);
        avail_done, cal_done : out std_logic;
        ram_ready : out std_logic
        );
end ram;

Since the memory is shared by two components, access control is required to avoid data collision on the data bus and address bus. The access control is done by a hand-shaking mechanism.

When idle, the RAM will check the two components in turns to see if either select line (sel_avail or sel_cal) is asserted. The components also have to check if the ram_ready signal is high before they put the select line to high. If a sel_line is high, it will output a low ram_ready signal to acknowledge the other to wait. Even if the two components put the select line on high on the same clock edge, they will not cause collision because the RAM poll either select signal in alternative clock period. The other will just have to wait for several clock periods until its neighbor finishes. After the RAM access finishes, it will assert the done signals (avail_done or cal_done) to acknowledge the components, and the components put the select line back to low. The ram_ready is high again to wait for another access request.

 

Availibility

entity availability is
port (clk : in std_logic;
        reset : in std_logic;
        photo_detect : in std_logic_vector(7 downto 0);
        full_sign : out std_logic;
        avail : out std_logic_vector(7 downto 0);
        paid : in std_logic;
        slot_num : in std_logic_vector(3 downto 0);
        alarm : out std_logic;
        alarm_off : in std_logic;
        sel_avail : out std_logic;
        avail_addr : out std_logic_vector(7 downto 0);
        done_avail : in std_logic;
        ram_ready : in std_logic
        );
end availability;

This entity will detect arrival or departure of the cars using photo-detector and set the availability of the parking slots. For arrival, the arrival time will be recorded into the RAM and it will be retrieved later to calculate the duration. In the case of all parking slots are occupied, the full sign signal goes high to light up the sign. An alarm will be turned on if it detects any car leaves without paying.

 

3.3 External Hardware Design

 

CLOCK

The system clock for the Terminal Controller is chosen to be 120Hz. The reason behind this choice is related to the size of counter being used in the clock_inc2 entity. It only takes seven bits to encode 120 and it will require more bits to implement higher clock frequency. Consequently, it will require more logic cells for the clock_inc2 entity. At first, a "clock divider" circuit was planned. The circuit was to have a slower clock pulse. Depending on the size of the counter, the "clock divider" approach can generate a second clock signal that is much slower than the system clock. There are two problems are associated with this method. On the one hand, the counter can take up much valuable space on the FPGA if the system clock is much faster than the new clock signal. On the other hand, the new (slower) clock is fed to, fan-out problems will likely occur. Consequently, the "clock divider" approach was dropped.

For ease of design and implementation, a 555-timer is used to generate the system clock. It is relatively easy to design a 555-timer circuit that produces a pulse train with periods in the millisecond range. The main drawback of the 555-timer approach is that it is difficult to achieve a high timing accuracy with RC components. As a result, the real-time clock of the Terminal Controller will not be very accurate. The schematic of the 555-timer circuit can be found in the Appendix D.

 

PUSH BUTTONS

The Terminal Controller has fifteen push button inputs: 10 keypad buttons, "reset", "toonie_in", "loonie_in", "Start/End", and "Charge/Duration". At each rising clock edge, the system checks the level of the each button to determine if actions need to be taken. The buttons can be directly affected by the clock frequency. For example, if the user pushes the "1" buttons when user is being asked to input the current time and the "1" input at the FPGA will stay high for several clock edges. The current time may be set as 11:11 when "1" button is being pressed once. In order to correct this problem, a large capacitor is required for de-bouncing.

 

7-SEGMENT LEDs (common cathode)

There are two groups of pins connected to each group of 7-segment LEDs: the "selector" pins and the "segment" pins. Each "selector" pin is connected to the common cathode of a 7-segment display, while each "segment" pin is connected to the corresponding anodes. When a display needs to be turned on, a "selector" pin will go low to supply current to the common cathode. On the other hand, a logic value "1" at the "segment" pin will allow current flow and turn on the diode. Similarly, a logic value "1" at the "segment" pin will turn off the diode.

Moreover, it is determined that a 100W resistor between a "selector" pin and a common cathode will limit the current flow at the "selector" pin to 35mA. The purpose of the resistor is to ensure that the maximum I/O current of the FPGA is not exceeded.

 

4.0 DESIGN VERIFICATION

 

The back-annotated simulation has been successfully carried out to demonstrate the functionality of the car park system. The following simulation results are carefully selected that can cover almost all aspects of our design.

The system clock is connected to the on-chip oscillator, which runs at 25.175Mhz speed. Actually, this clock speed is too fast for the system, especially for the displaying clock on the terminal controller. Instead of using tremendous amount of logic cells to implement a clock divider, an external clock of 120Hz is used.

However, simulation of 120Hz rate caused a problem because it requires very long simulation time and it is turn requires huge amount of memory, which even the CAD lab machine cannot handle. Therefore, 10MHz was used in the simulation. It is believed that if faster clock works, the slower one should also work.

 

Node Name Type Description
Clk I System clock (25.175MHz)
Clk_external I External clock (120 Hz)
Reset I System reset
Keypad_input I (x10) Keypad inputs
Start_end I Button input to restart the paying transaction
Charge_display I Switch input to select displaying either charge or duration 
In_toonie I Coin input 1 (for toonie)
In_loonie I Coin input 2 (for loonie)
Changer_ready I Signal from changer to indicate changing operation
Slot_number B(x16) Slot number selected, displaying on seven-segment LEDs
Duration B(x16) Duration of parking, displaying on seven-segment LEDs
Output_charge B(x16) Charge for the parking, displaying on seven-segment LEDs
Cur_time B(x16) Current clock time displaying on seven-segment LEDs
Sel_coin O Output to LED to guide the user to input coins
Sel_keypad O Output to LED to guide the user to input at the keypad
Sel_sup O Output to LED to indicate operation of supervisory mode
Sel_startend O Output to LED to guide user to start another paying transaction
Photo_detect I (x8) Input from sensors to detect arrival and departure of the cars
Full_sign O Output to Neon light sign indicate the car park is full
Avail_board O (x8) Output to lights to indicate the availability of parking slots
Alarm_off I Switch input to turn off the alarm
Alarm O Output to alarm to sound the alarm
Data_7display O (x7) Seven-bit word for displaying onto seven-segment LEDs
Enable_7display O (x9) Nine bits control for selecting of seven-segment LEDs
Ram address B (x8) Ram address
Ram content (1) B x16) Memory content for slot 1
Ram content (2) B x16) Memory content for slot 2
List of signal names used in simulation

 

Waveform 1 (refer to Appendix A1)

The system starts up with initialized signals in the simulation. For reliability, the reset is asserted to initialize all the signals again. The sel_keypad and the sel_sup signals are high, indicating keypad input is required and supervisor mode is active, respectively.

 

The clock time requires four digits (hh:mm) before its operation begins. Upon the first digit is entered at keypad_input, the clock time, cur_time, changes to 10:00. Note that input ‘1’ at keypad_input represents 1, 2 or 3. The second input at keypad_input changes cur_time to 12:00. The third input changes cur_time to 12:30, and the last (input ‘2’ represents 4, 5 or 6) changes cur_time to 12:34.

 

The nine seven-segment LEDs are fed with data one after one in cycles. The enable_7display signals of 1FE(hex) (= 111111110) means enabling the first seven-segment LED. The data_7display signals represent the codes to display numeric digit on the seven-segment LEDs. The two groups of signals are omitted in latter waveforms since they are not significant in the simulation.

 

Waveform 2 (refer to Appendix A2) After setting up the displaying clock time, that is the last digit (unit minute digit) of the clock is entered, the clock will start to run. The clock time uses an external clock to drive. The clock goes from 12:36 to 12:37 after 118 clock ticks and it continues to increment by "one minute" for every 118 ticks.

 

Upon the rate is entered, the sel_sup signal goes low to indicate the leaving of the supervisor mode. From then, the system begins the normal operation.

 

The first car arrives at around 31us as the photo detector signals changes from 00000000 to 00000001. The avail_board signals immediately update, from 11111111 to 11111110, with the corresponding bit (first bit) changes. After several system clock ticks, the current clock time is written into the first slot RAM location. The RAM address and that slot data content are initialized with zeros. As the RAM address for the first slot is also 00h, it remains the same.

 

Waveform 3 (refer to Appendix A3) The photo detector signals change from 00000001 to 00000011. The avail_board again changes the second bit which corresponds to the detector signal change. The RAM address then select the address for slot two, 01h, and stores the time 12:36 into the slot two memory location.

 

The keypad_input triggers the slot_number to change to 1. This action in turns triggers the RAM address to select 00h, the duration to output 00:03 and the output_charge to change to 00.50. During that time, many calculations are involved. The duration is the difference of the clock time and the stored time, which is 12:37 – 12:34 = 00:03. The output_charge corresponds to the duration and prompts the user the charge of 50 cents (rate 1 = 50cents/30mins). The signals sel_keypad and sel_coin also change, indicating the user to pay the coin and leave the keypad alone. The procedure continues in next waveform.

 

A car arrives at slot three. The RAM signals and data do not change. The storing of time for the other slots was disabled due to insufficient space at earlier time.

 

Waveform 4 (refer to Appendix A4) The in_loonie signal pulse represents the user pays a loonie. The output_charge, or the charge, is cleared and the total_change turns to 2 indicating there are two quarters of change. The latter in_toonie pulse has no effect as the paying operation has completed. It is assumed that the coin is not accepted. Then the changer_ready is asserted and the total_change returns to 0. The sel_coin and sel_startend change to prompt the user to end the transaction or the other user to start a new one.

 

The alarm signal goes high and the alarm sounds when the car at slot two leaves without paying. The leaving can be seen from the photo_detector signals change, from 00000111 to 00000101. The alarm is turned off by the alarm_off input.

 

Waveform 5 (refer to Appendix A5) The other user pressed the start_end button and the signal pulse triggers the clearance of slot_number and duration. The sel_startend signal goes low, and the sel_keypad signal goes high to prompt the user to enter from keypad. The keypad_input is entered and the slot_number is selected as 2. The duration, 12:42 – 12:41 = 00:01 is displayed and the output_charge displays the charge. The procedure should be repeated as before so omitted.

 

The second bit of the photo_detector signals change to one, that means a car arrives at slot two. The photo_detector signals are all ones and the avail_board signals are all zeros. The full_sign signal is high to indicate no space left in the carpark. It turns low again when a car leaves slot one.

 

5.0 IC TEST

 

Since the FPGAs was designed to serve as a controller for a parking system, the most efficient way of testing it is to incorporate the FPGAs into a prototype Automated Parking System and then verify the functionality of the complete system. As time was a constraint, the photo-detector system peripheral was replaced by DIP switches (same logic retained) and each FPGA was tested separately. This could be done since the terminal controller IC and monitor IC are almost independent of one another.

 

5.1 Terminal Controller IC Testing

 

To test the terminal controller chip independently, we pre-assign the entrance time of each parking slot to the following.

Slot 1 Þ 00:00

Slot 2 Þ 01:49 Slot 3 Þ 03:59 Slot 4 Þ 08:45 Slot 5 Þ 13:17 Slot 6 Þ 15:00 Slot 7 Þ 20:59 Slot 8 Þ 21:21

 

This is necessary since the terminal controller chip does not have access to the stored entrance time in the memory of the monitor chip. Then, the user interface terminal was realized on hardware to test the operation of the terminal controller chip.

Initially, the 7-segment displays were giving us erroneous and inconsistent output. Also, all the pushbutton switches, although not hooked up together, were causing the system to reset. Also, the LED display seems to have problems displaying 8 (all segments lid). We realized later that our external hardware is drawing more current that it is supposed to from the VCC pin (+5 V). This problem explained our observations and was solved by powering our hardware with an external supply of 5 V (4 A).

The other problem we encountered was with the "reset" push button. Apparently, the "reset" button does not reinitialize all the crucial signals to the same initial state every time it is pressed. This is a coding error which possibly occurred when we were trying to reduce the size of the design by removing repetitive signal assignments. This bug was fixed by including some additional signal assignment statements in the reset state.

 

The following is the summary of some interesting test cases that were carried out.

 

TEST #1 : Basic Functionality – Initialization (Supervisory Mode)
    1. RESET the system (push button). Enter "1", "2", "3", "4" via the push button keypad

    2. RESULT : The clock display shows 12:34 and the clock starts counting up at

      the rate of 1 minute every 1 second (real-time).

    3. Enter "1" via push button keypad

    4. RESULT : The parking rate is set to $0.50 every ½ hour. The yellow LED

      (indicates supervisory mode) turns OFF. This indicates normal operation and the system is waiting for the customer to enter a slot number for charge calculation.

      TEST #2 : Basic Functionality – Paying Sequence (Normal Mode)

    5. Enter "1" via push button keypad (current time = 12:55)

    6. RESULT : 1 appears on the slot number display. The correct parking charge

      of $13.00 and parking duration of 12:55 was shown. The charge / duration push button is use to toggle between displaying these 2 data.

      MATH : Time in = 00:00 (initialized for slot 1)

      Time out = 12:55

      Duration = 12:55 – 00:00 = 12:55

      # of ½ hour blocks = 12:55 / 30 minutes = 24

      Total Charge = ( # of ½ hour block ) * parking_rate

      = 24 * 0.50 = $12.00

       

    7. Pay using the toonie and loonie push buttons.

    8. RESULT : The charge displays decrements correspondingly when the buttons

      were pressed. The paid LED turn ON when all charge have been

      paid. The number of quarters provided as change is displayed in using the 4 LEDs. The parking rate is set to $0.50 every ½ hour.
      The parking duration could still be viewed by pressing the charge / duration push button.

       

    9. Hit Start / End push button (anytime during the cycle)

    10. RESULT : The slot number display, duration and total charge resets to zero.

       

    11. The paying sequence is repeated for different parking slots and parking rate
RESULT :  
CURRENT TIME ENTRANCE TIME TOTAL CHARGE DURATION
05:12
01:49
$3.30
3:23
20:55
08:45
$12.50
12:10
18:47
13:17
$2.75 *
5:30
15:01
15:00
$0.25 *
0:01
22:58
20:59
$1.00 *
1:59
* parking rate of $0.25 per ½hour is used here

  TEST #3 : Clock Functionality

Initialize clock to 23:59 and leave it running
RESULT : The clock increments to 00:00 and continues running. It completes a

24 hour cycle in 23 minutes, a little bit faster that it was designed for.

TEST #4 : User Input Protection Functionality
    1. Initialize the clock to 29:00

    2. RESULT : The clock display shows 20:00 because 29:00 is an invalid time setting. Thus, 9 was not accepted by the system and it is still waiting for a valid input. Reset could be pressed to reenter a new time.
    3. Enter 3

    4. RESULT : The clock display shows 23:00 because 23 is a valid hour setting.
Other keypad protection features were also tested and verified correct.

 

  1. Monitor IC Testing

The monitor consists mainly of the availability entity and the ram entity. It was tested by simulating several arrivals of car and the changes of photo_detect and avail signals were observed. The paid signal was preset to 1, and then a car departed from slot 2 was simulated. The alarm was sound and the alarm_off input turned it off. Then a car departed from slot 1, alarm did not sound. The full_sign light was observed when all the slots were occupied.

The ram was not tested directly. Another entity was written to read at a specific slot memory location when the trigger_sel button was pushed. The output data was mapped to four LEDs, therefore, we could test four bit of the data each time. The stored time was verified.

The testing entity is listed as below:

entity test_ram is
port ( clock, reset : in std_logic;
        trigger_sel : in std_logic;
        address : out std_logic_vector(7 downto 0);
        sel : out std_logic;
        ram_ready : in std_logic
        };
end test_ram;

 

6.0 OTHER CONSIDERATIONS

 

Speed vs. Area trade-off

The terminal controller and monitor entities were compiled using area optimization and then speed optimization. The result is documented below.

 

ENTITY AREA OPTIMIZATION SPEED OPTIMIZATION
TERMINAL CONTROLLER
Logic Cells Used
920
952
Longest Path
30.3 ns
29.2 ns
MONITOR    
Logic Cells Used
391
408
Longest Path
22.4 ns
18.3 ns

 

Thus, we see that by optimizing the design speed (faster) there would be an increase in the required logic cells and vice-versa. So, a trade-off would need to be made when the designing the system. Speed is not a major concern is a parking system controller, thus we would go for area optimization if required.

 

7.0 CONCLUSION

We have learned a lot from coming up with the idea of designing an automated parking system to building the actual system. During this period, we have gained valuable experience in writing VHDL codes, doing simulations, and implementing the system with hardware. Due to time constraint, the implementation of Automated Parking System is a little different from its original design. The Maxplus2 program is fairly easy to follow and to use. Since the Flex 10K Device is re-programmable, it is quite useful for us to redesign some of the entities. During the course of implementing our design, we encountered a lot of timing problem because we had many asynchronous inputs. We solved this problem by closely examining the simulation waveforms and subsequently correcting the VHDL codes. We consider our project is very successful and we are proud of our final product. The experience obtained during the course of designing the system is extremely valuable.

 

Presentation...

Presentation Photo #1

Presentation Photo #2

Presentation Photo #3

 

  Last Update: April 9, 1998