Smart Parking Lot | IoT Cloud Kit for microbit-MakeCode-Tutorial

userhead
Meimei Aug 03.2023

Lesson 7: Smart Parking Lot 

Objectives

1. Get to know Smart Parking Lot

2. Get to know ultrasonic sensor

3. Learn ultrasonic distance detection

4. Make auto boom gate for parking lot  

5. Vacancy of parking lot statistic system

Learning Process

Preparation

Teachers: A computer, good internet, IoT internet kits.

Students: A computer, good internet, IoT internet kits.

Learning Content

Lead-in: With the rising of people’s living standards, almost every family owns a car. Meanwhile, the following parking problem is emerging increasingly. Especially in densely populated areas, searching for an available parking lot takes up a lot of time, and usually, there are traffic jams at the exit and entrance of the parking lot. As the IoT technology develops, to help citizens park easily, smart parking lot comes out, which becomes the fastest-growing smart city solution in the world at present. The parking lots in airports, schools, shopping malls, large office buildings, etc. bring great convenience to our daily life. This solution mainly relies on the abilities of data analysis of IoT and data collection by automation equipment.      

Get to Know Smart Parking Lot 

A smart parking lot can be described as services that integrate radio communication, mobile terminal technology, GPS, etc., which applies to parking lots in all places within a city. It allows users to check real-time nearest vacant parking space, book lot, and plan routes, and guides drivers to there. Thanks to the development of technology, smart parking lots are becoming more advanced and widely used, significantly improving the utilization efficiency of parking spaces and alleviating the contradiction between supply and demand.  

How does a smart parking lot work?

When a owner of a registered card drives into the parking lot, the entry control system detects the arrival of the vehicle and check if the inserted card is valid. If so, the boom gate pole moves up to allow the car to access, and the camera takes a photo of the car and stores it onto the PC. The procedures are all the same for the car to leave the parking lot.

When a driver comes for the first time, he/she first needs to get a temporary card from the entry control system, the camera takes a photo of the car and stores it in the PC. The controller records the time the car enters and transmits the information into PC. When leaving the parking lot, if the exit control system detects that the card is a temporary one, then the driver will be prompted to pay the fee. The temporary card must be returned back to the security guard. The driver is allowed to leave only when it is confirmed that the fee is paid.

The vacancy of the parking lot will be displayed on the LED screen outside.

The above shows the working principle of the common smart parking lot. Based on this, can we use the IoT could kit to make a smart parking system that can allow people to remotely check the vacancy of the parking space through IoT? To build a system like that, we first need ultrasonic sensors as triggers. When there is a car approaching or passing the ultrasonic sensor, the number of cars in the parking system will be plus/minus 1 automatically. Next, let’s get to know what an ultrasonic sensor is?

What is an ultrasonic sensor?

Currently, the ranging sensor includes several types: ultrasonic sensor, IR distance sensor, Laser ranging sensor and Radar sensor, among which ultrasonic sensors are suitable for static ranging in large amplitude plane. The sensing range of a common ultrasonic sensor is about 2cm~450cm.  

We can see that there are 4 angles in ultrasonic sensors: VCC-5V, Trig-transmitter, Echo-receiver, GND - Ground

Principle of ultrasonic sensor

Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in the air at the velocity of sound. If they strike an object, then they are reflected back as echo signals to the sensor, which itself computes the distance to the target based on the time span between emitting the signal and receiving the echo.

During the process, the ultrasonic emitter sends ultrasonic waves into one direction, then start timing; The ultrasonic waves are transmitted in the air and when striking a barrier, they are reflected back; The ultrasonic receiver receives the ultrasonic waves and timing stops. The formula should be: L=C*T/2(L: distance, C: speed in the air, T: total time). C is related to the temperature, as shown below:  

Then, we will use the principle of ultrasonic ranging to simulate the auto-recording process at the ins and outs of the parking lot.

Question: What other sensors can be used to imitate the process of a driver stopping the car and getting a card.   

Project Practice - Vacancy of Parking Lot Statistics 

 

Task 1: Make the Boom Gate 

Boom gates can be usually seen at parking lots. When the system detects there is a vehicle driving in/out, the boom gate pole will automatically move up to let it go. Here we will use ultrasonic sensors to simulate this set of equipment. The following is the principle of the auto boom gate at parking lots.    

Hardware Preparation

Please prepare the hardware as below:

Hardware Connection

Insert micro:bit V2 into micro:IoT Board for Cloud, connect ultrasonic sensor pin Trig to board P1, Echo to P2; Since the ultrasonic operates at 5V, its VCC and GND need to connect to the VCC and GND of Pin S2; Connect the servo to P8. As shown below:

Program Design

Function Analysis

In this task, the function we have to realize is: detected distance≤60cm, boom gate pole moves up, after 5 seconds, moves down.  

Program Flowchart
Sample Program  

Program Link: https://makecode.microbit.org/_dug27e3v0bso 

Operating Effect

When the program is burned into the board, block the ultrasonic sensor front with your hands or other objects and observe what happens to the servo. According to the program, when the detected distance ≤60cm, the servo goes to 90°; when more than 60cm, the servo rotates to 0°.  

Note: power from the expansion board (DC 5V)

Note: 1. Adjust the initial and ending angle of the servo as your actual situation.

2. According to angle setting required in the tutorial, please find the servo 15° and then install the servo arm.  

Conclusion

In this case, we simulated the boom gate of the parking lot by using ultrasonic sensor and servo, and learned how it works: the boom gate system detects the arrival of a car, its pole moves up.

Task 2: Auto Calculation of Vacant Parking lot 

We may notice that there is usually a big LED matrix screen outside of the parking lot for showing how many spaces are left, which is very convenient for drivers to get real-time parking lot information.

For making a system like this, we have to install sensors at the entry and exit of the parking lot to collect the number of vehicles driving in/out, then calculate the remaining parking spaces and display on an LED screen. It basically works as the following:

Hardware Preparation

Prepare the hardware as below:

Hardware Connection

Insert micro:bit V2 to micro:IoT Board for Cloud, connect Pin Trig of the ultrasonic sensor at the entry to the board P1, Pin Echo to P2; The ultrasonic sensor needs to work at 5V so its Vcc and Gnd have to be connected to the VCC and GND of Pin S2. The pin Trig of the exit ultrasonic sensor goes to P12, Echo to P13, Vcc and Gnd to Pin S1 VCC and GND. As shown below:

Program Design

There are two systems at a parking lot: entry and exit. To let them run independently, we have to build two “forever”---entrance and exit.

Function analysis

Entrance: Suppose there are 100 parking spaces, when one car parks in, the total number of the parking spaces -1.

Exit: Suppose there are 100 parking spaces, when one car drives out, the total number of parking spaces +1. Display the real-time available parking lots on the OLED screen.

Program Flowchart

To distinguish the functions of every data, we have to create 3 variables, “entrance”, “exit”,“parking_spaces”, they work as below:

Sample Program

Program link: https://makecode.microbit.org/_gut5jqFkHCV8  

Operating Effect

Burn the program above into the board. When you block the ultrasonic sensor at the entrance, the number P(Parking spaces left) will reduce. It will increase when detecting there is a vehicle driving out.

Conclusion

In this case, we use ultrasonic sensor as card reader or vehicle license plate recognition device. When there is a vehicle passing the entrance or exit, the parking lot system will be plus/minus 1 automatically, and the final number of the parking spaces will be presented on the screen. However, this kind of system still cannot meet actual requirements sometimes. It would be great if we can get the vacant parking spaces information on the way to a parking lot.  

Task 3: Check Available Parking Spaces Online 

We have learned how to calculate the vacant parking spaces in a parking lot in the last part. Now we are going to use the IoT to improve the project so people can check the available parking spaces information online. It works as below:

Hardware Preparation

Please prepare the hardware as below:

Hardware Connection

Program Design

Function Analysis 

What we have to do here is to send commands from Easy IoT to a device via WiFi to let it feed back the parking spaces information to IoT platform.

Program Flowchart

Calculate the vacant parking spaces by the entrance program we designed before, and then upload the data onto Easy IoT.

Sample Program

Not finished, continue on the next page

Not finished, continue on the next page

Program Link: https://makecode.microbit.org/_EsmVUKWJwiyo 

Operating Effect

1. Enter Easy IoT to send information to a device. Find the related Topic, click “Send” to send the message “empty”.

2. Refresh the web-page to check available parking spaces.

Note: to decrease error, do not place the two ultrasonic too close.

Conclusion

In this task, we used the Easy IoT Platform to realize the functions of remotely checking parking lot.

Discussion

Extension

IoT-based Smart Parking System

The smart parking system makes full use of the IoT recognition technology to capture the license plate and quickly identify the vehicle information through the million level HD license plate recognition camera installed at the entrance and exit of the parking lot, so that you can enter the parking lot without using a card. When the vehicle enters the parking lot, the parking space guidance system displays the parking space in real-time. In addition, there is a car parking lot search system. Just use the query machine in the parking lot or scan the QR code, input the license plate number, then the system will quickly provide parking space information and electronic map. Parking payment is also very convenient. It can be completed by POS machines in shopping malls, parking lot self-service payment machines, mobile payments, QR code payments and manual payments in parking lots.

Summary

In this class, we used the ultrasonic ranging principle to make the automatic statistics system of parking spaces, and also used the easy IOT Internet of things platform to help us check the remaining parking spaces online. Thus saving more time. The next project is the life-related project of the Internet of things, mainly learning how to analyze the power consumption of corridor lights through IoT technology.


 

License
1
All Rights
Reserved
[[i.text]]
licensBg
0
0
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.publish_time]]
[[c.parent_comment.count]]