⭐️Explore Our website»
⭐️Explore the doxygen»
To keep people can ride bike more safely on the road.
We are a group of graduate students currently studying at University of Glasgow. This is our course project for Real-Time Embedded Programming Project advised by Dr. Bernd Porr and Dr. Nicholas Bailey. For our team, two members major in Robotics & Ai, one member majors in Electronic and Electrical Engineering.
Our project, Cycle Buddy, is a system that detects cars that endanger the bikers on the road. Once the car overpasses our biker in a relative high speed and within a close distance, the system can detect this dangerous action and responds by capturing the car's photo and recognize its car plate number. Then it will send the id, the photo and the velocity& distance to the mobile application as long as the online database. With those infomation recorded as evidence, the bikers can then use it to contact local law enforcement to report the issue.
Figure 1: Indoor circuit of Cycle Buddy
-
Android Studio (Mobile Phone Application)
Android Studio provides the fastest tools for building apps on every type of Android device. We use it for connecting the raspberry pi and get real-time information from the raspberry pi, such as car distance, car velocity, and bike velocity.
-
Visual Studio 2019 (Raspberry pi threads)
Visual Studio 2019 has the latest features to bring real-time collaboration so it is convenient for us to write C++ code for their project.
-
Firebase (Real time database)
Firebase is Google’s mobile application development platform that helps you build, improve, and grow your app. It manages our data and stores our license plate numbers which are from the Pi camera.
-
Cmake (Build up the full project)
CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of our choice.
-
Doxygen (document generation tool)
Doxygen is a document generation tool that extracts documents from code, organizes them, and outputs them into beautiful documents (HTML, PDF, RTF, etc.).
With the Doxygen tool, programmers can write code directly in the document, no longer need to write a separate document for a function of the code, thus keeping the document and code as consistent as possible.
This API can recognize the license plate number directly from the picture, we find a GB (Great Britain, UK) lib trained model and use it.
-
Putty
Find the IP address of raspberry pi simply.
-
VNC (Other Remote Desktop Services are also fine)
Use ssh services to log in to the raspberry pi so that we do not need to use HDMI or screen to connect to the raspberry pi. It is also convenient to use UI to code in raspberry pi.
-
Typora
Edit markdown and Html files for Doxygen and web page.
-
Search for the car information
Here is the government website to search for the car information, so when we get the license plate number, we can search for it here.
-
Raspberry Pi 3 Model B + (£33.90, 1 is needed, not included)
The Raspberry Pi 3 Model B is the earliest model of the third-generation Raspberry Pi. In our project, It can receive the real-time signals of the GPIO from all the sensors and deal with the real-time data.
-
Hall sensor (£4.49, 1 is needed)
We use a hall sensor to detect the velocity of the bike. The theory is to put the magnets On the axle of the bicycle wheel. Make sure the hall sensor is close to magnets enough so that it can detect the magnetic field when the bike runs.
-
Ultrasonic sensor(£3.99, 1 is needed)
The Ultrasonic sensor is to detect the distance between the bicycle and car. Besides, according to the velocity of the bicycle, it can calculate the velocity of the car.
-
Pi camera (£10.99, 1 is needed)
The Pi camera is to capture the picture of the car, especially capture the license plate number of the car. We find a feasible location for the Pi camera so that the
- Male/Male, Female/Female and Male/Female wires ,magnets (approximately £ 2.34)
- GPIO Breakout Kit Expansion Board For Raspberry Pi 3 B+ (£14.49)
- Power supply for Raspberry Pi or Power bank. (£ 13.56)
Overall, it costs us £49.86 except the Raspberry Pi 3 Model B + for the project.
See the open issues for a list of proposed features (and known issues).
3 threads: One is for ultrasonic sensors, one for hall sensor, the rest one is for Pi camera.
- WiringPi
- Raspicam
- OpenALPR
- JSON
- Cmake
Before install any packages, please run the following:
sudo apt-get update && upgrade
-
WiringPi:
sudo apt-get install wiringpi
-
Raspicam : (For Pi camera)
Download, build, make and install it. -
OpenALPR: (Github page)
sudo apt-get update && sudo apt-get install -y openalpr openalpr-daemon openalpr-utils libopenalpr-dev
-
JSON Library: (Github page)
sudo apt-get install -y nlohmann-json-dev
If the above method does not work, please try the following:
a.git clone https://github.com/nlohmann/json.git
b.cd json
c.mkdir build
d.cd build
e.cmake ..
f.make
g.make install
-
Cmake : (Website)
Click and download it from the website above.
This project is built using Cmake and Makefiles in order to allow users to easily run our code and tets it.
Please follow these necessary steps:
- Clone the project with:
git clone https://github.com/OmarJabri7/Cycle_Buddy.git
- Change directorites and relocate in Cycle_Buddy project:
cd Cycle_Buddy
- Link the necessary executables and libraries using CMake:
cmake .
- Build the project using make:
make
- Generate Unit tests and check if all components pass:
make test
- Run the test file labeled Cycle_Buddy:
./Cycle_Buddy
For more information, please visit this Youtube link
- The Gif below demonstrates the real time nature of the system, where each sensor reading is sent to the android application and plotted in real time:
- It is clear to note how the timestamp emerging from the raspberry pi is the same as the one displayed in the android app. This reinforces the real-time responsiveness of our system.
- The image below demonstrates how the system triggers the Pi Camera to capture an image of the car plate and recognizes it using the OpenAlpr API:
Figure 3: Indoor and Outdoor results
-
On the left, we have the results from the indoor testing, where the car plate is displayed on a phone screen.
-
On the right, we have the results from the outdoor testing, where the car plate is captured by the camera on the streets of Glasgow.
-
Moral of the story is, that the api is capable enough to recognize the car plates within any environment. Moreover, the data displayed under the Car Plate are the sensor readings at the instant of capturing the image. Thus, ensuring that the system operates in real time.
- The final thing to notice is how the system saves the relevant data once the image is captured, reinforcing the idea of a real-time embedded system:
Figure 4: Real time & Results snapshot
- Notice how the car plate is equivalent (green square), alongside car distance, velocity and bike velocity (red square).
This is an open-source project, therefore, just fork it and build up the project according to the README.md in every document.
Distributed under the GPL-3.0 License. See LICENSE
for more information.
- Omar Jabri - @Omar Jabri
- Chang Liu - @Chang Liu
- Yifan Xie - @Yifan Xie
⭐️ Project address - @Project address