Automated Parking Lot
Subject: STEAM
Grade(s): 8th and up
Duration: 90min and up
Difficulty: Advanced
Project File
Here is the project file: Automated Parking Lot
Learning Objectives
In this project, there are lots of strong links to the curriculum:
●
AI Text Recognition
Understanding how AI can interpret and analyze text, which can be applied in
various fields like automated customer service and data entry.
●
Security and Privacy
Exploring the implications of personal data, such as
understanding the importance of data protection measures.
●
license
plates, and
Storing and Retrieving Data
1
Learning about databases and data storage solutions, including efficiently accessing
and managing information.
●
Data Structures
Introduction to basic data structures like lists, arrays, and other collections that help
organize and manipulate data.
●
Communication Between Gates
This could refer to understanding how different systems communicate, possibly in
LAN, IoT (Internet of Things), or networked devices.
Overview
This demo shows AI in education for middle school. The theme concerns smart
parking/access control and license plate recognition.
mBot2 will have a license plate (paper,
printed letters, and numbers). When
approaching
the
gate,
a
normal
webcam takes a picture, and the text is
extracted using the mBlock 5 extension
of “cognitive services.”
The text is stored in a list together with
the timestamp. Then the gate opens, and
mBot2 drives to the parking area. After a
short period (random), it drives back through the same gate to get scanned again.
The time difference is shown – could be the basis for the parking fee.
Project Checklist
What do you need?
2
Material Required
Name
A laptop or tablet with internet
access
mBot2
CyberPi Go Kit
MS-1.5A servo
Webcam
Printed Numberplate map
Image
Quantity
1
2
1
1
1
1
3
Data USB cable
Printed letters & numbers
Slide Beam 0824-224
Slide Beam 0824-080
Slide Beam 0824-064
Slide Beam 0824-032
Beam 0412-076
1
1
3
4
2
1
1
4
Beam 0412-140
1
Socket Cap Screw M4*16
-Button Head
16
Socket Cap Screw M4*18
-Button Head
3
Socket Cap Screw
M4*22-Button Head
1
Socket Cap Screw M4*24
-Button Head
Nut 4mm
4
5
5
Nylon LocknutM4 * 1
M4*Spanner
1
1
Download mBlock Software
● You can visit the mBlock website: https://mblock.cc/
● Click【Code with Block】to open the editor
Knowledge Expansion
About Smart Parking and License Plate Recognition
Smart parking systems address parking challenges in urban areas driven by
urbanization and technological advancements. License Plate Recognition (LPR)
technology captures vehicle images and extracts license plate information using
Optical Character Recognition (OCR). This is useful for controlling entry and exit at
parking lots, monitoring traffic, and detecting violations. Key components include
high-resolution cameras and processing units like mBot2, which runs programs and
controls actions, and software such as mBlock 5, which enables license plate
recognition. By recording entry and exit times, parking durations can be calculated
for pricing strategies like hourly rates and discounts. This topic is significant in
education; it promotes STEM skills through hands-on activities, enhances
problem-solving abilities, and encourages teamwork. As smart parking becomes part
of smart cities, it will integrate with urban management systems, and advances in AI
will improve its accuracy and efficiency. Exploring this topic prepares students for
future innovations, showing them the real-world applications of technology.
6
Block Explanation
1. Upload Mode Broadcast
With the Upload Mode Broadcast extension, you can enable a 【sprite】 to interact
with a 【device】 in 【Upload】 mode.
2. LAN
The default local area network channel for 【all CyberPi is six】. Devices on the same
channel in the local area network do not need to connect to the internet. They can
send messages to each other through LAN broadcasting. Theoretically, a CyberPi can
send messages to any number of other CyberPis. In simple terms, CyberPi can use
the "LAN" blocks in the Makeblock App to send broadcast messages to other CyberPi
devices. Other CyberPi devices will respond accordingly based on the messages they
receive, thus achieving mutual control.
3. Cognitive Services
Cognitive Services extension provides more image, sound, and knowledge functions
for sprites, which allows you to have more fun with 【stage programming】. Note: To
use the Cognitive Services extension, ensure that your PC is equipped with a camera
or connected to an external one and that the camera works properly.
4. Variables
When no suitable variable blocks are available, you can create a desired report block
by establishing variables.
7
5. My Blocks
You can create a desired report block by establishing new blocks and defining
functions for them when no suitable ones are available.
Program
Step 1:Add extension
●
●
Add mBot2 and Cyberpi as the devices
Click on【extension】in 【Sprites】and 【Devices】separately to add the【Upload
Mode Broadcast】extension
8
●
Click on【extension】in 【Sprites】to add the 【Cognitive Services】
Step 2:Add background
●
Click + on the 【Background】 tab to upload the numberplate map
●
Disable to show the 【Sprites】
9
Step 3:Set the mBot2 LAN network channel and send a broadcast message to
the Cyberpi
●
●
Make variables like the blocks below
Please note that after the first block is made, the last four blocks will be shown
automatically
10
●
Make three blocks like the ones below
●
Please note that you need to input the content for the second block, like the
one below. And then, the 【line_follow 1 1 1】will be shown on 【My Blocks】
11
●
Define those new blocks like the ones below
12
●
Set 【mBot2】 LAN channel and send a broadcast message to the Cyberpi
13
Step 4:【Cyberpi】 receives a broadcast message from mBot2 and sends a
message to【Sprites】
●
●
Cyberpi receives the 【at_gate】 broadcast, and then send the 【enter】message
to 【Sprites】
Add the【play hi】block to confirm if the Cyberpi sends the message to 【Sprites
】successfully
14
Step 5:【Sprites】receives message and process text recognition
●
Receive the 【enter】message and recognize the printed English text
●
For the No.1 part, the software will record the license plate number and
parking time if a car has never entered. For the No.2 part, if the car has entered
before, the software will clear the license plate number and parking time and
send a 【leave】message. This way, the same car can perform a looping
automatic parking action
15
Step 6:【Cyberpi】receives the 【open】or【leave】message
●
Create the【open】and 【close】variables, and then 【untick】 them
●
Then set the values
16
【leave】message
●
●
●
First, 【Cyberpi】 will control the servo to open the gate automatically after it
receives the 【leave】message from【Sprites】
Then, send the 【drive_to_exit】message on LAN to mBot2
The servo will close the gate in 10 seconds, clear the screen, and show label 1
【leave】message -【drive_to_exit】
●
Make two blocks 【drive_to_T_ junction】【turn left】
17
●
Then define them like the ones below
●
●
mBot2 receives the 【drive_to_exit】broadcast on LAN
After mBot2 goes back to the original position, it will turn left and perform a
looping automatic parking action
18
【open】message
●
●
●
First, 【Cyberpi】 will control the servo to open the gate automatically after it
receives the 【open】message from【Sprites】
Then, send the【drive_to_parking】message on LAN to mBot2
The servo will close the gate in 10 seconds
【open】message -【drive_to_parking】
●
●
Make two blocks【drive_to_right_crossing】【drive_to_2nd_T_ junction】
Then define them like the ones below
19
●
●
mBot2 receives the 【drive_to_parking】broadcast on LAN
If mBot2 detects an obstacle ahead, it will stop at the second parking space;
otherwise, it will stop at the first. After entering the parking space, mBot2 will
wait 5 seconds before exiting. This is to create an automatic parking loop
action
20
21
Step 7:Stop the mBot2 if needed
Setup Instruction
22
Step 1:Make a gate
●
Make the first base
23
●
Make the second base
●
Make the gantry
24
Step 2: Make a connector from the gate to the servo
●
First, make a connector
25
●
Then connect it to the gate
Step 3:Install the MS-1.5A servo and the lifting rod
Please note that you must use the Nylon LocknutM4 nut when installing the lifting
rod, or it will get loose when it’s up or down. The servo must be installed upside
down to ensure the correct operating direction.
26
27
Step 4:Install the MS-1.5A servo to Cyberpi Go Kit
●
Put the cable in the MS-1.5A servo to S1 or S2
●
Put the CyberPi on the base
28
Step 5:Install the WebCam on the gate
First-use Guide
●
●
First, connect Cyberpi to mBlock software through 【Bluetooth】
Then select the 【Bluetooth】connection, and click 【Pair】
29
●
Enable the external WebCam: Go to Device Manager on your computer and enable it
30
●
If you want to demonstrate that the mBot2 automatically turns to parking space 2 when
encountering an obstacle, you can place an mBot2 on parking space 1 like the one below
●
●
Stick the license plate on the mBot2 【Recommended size is 75*38mm】
Place the mBot2 in the designated position. Please do not go beyond the
position of the T-junction. Press 【Button B】to start the automatic parking
process.
31
Copyright © 2024 Makeblock.
For more quality content: makeblock.com
For technical support, please contact: [email protected]
Updated: September 23, 2024 Version: 1.0
32