Skip to content

System that detects danger levels relative to drivers. Once a driver overpasses a biker, the system detects this unauthorised act, and responds by recognising the car plate in order to contact law enforcements..

License

Notifications You must be signed in to change notification settings

Yifan-Xie/Cycle_Buddy

 
 

Repository files navigation

Cycle Buddy

⭐️Explore Our website»

Logo

⭐️Explore the doxygen»

To keep people can ride bike more safely on the road.

              

Contributors Forks Stars Issues License

Contents

  1. About
  2. Software
  3. Hardware
  4. Roadmap
  5. Packages
  6. Usage
  7. Results & Real-Time Responsivness
  8. Contributing
  9. License
  10. Contact

About

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.

⭐️ Doxygen about the project

Circuit of Cycle Buddy:



Figure 1: Indoor circuit of Cycle Buddy




Software

Necessary:

  • 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.

  • OpenALPR - Automatic License Plate Recognition (API)

​ 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.

Optional:

  • 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.


Hardware

Main device:

  • 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.

Sensors:

  • 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

Other auxiliary tools :

  • 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.


Roadmap

See the open issues for a list of proposed features (and known issues).

Threads of Sensors

3 threads: One is for ultrasonic sensors, one for hall sensor, the rest one is for Pi camera.


Packages

  • WiringPi
  • Raspicam
  • OpenALPR
  • JSON
  • Cmake

Packages Installations

Before install any packages, please run the following:
sudo apt-get update && upgrade

  1. WiringPi:
    sudo apt-get install wiringpi

  2. Raspicam : (For Pi camera)
    Download, build, make and install it.

  3. OpenALPR: (Github page)
    sudo apt-get update && sudo apt-get install -y openalpr openalpr-daemon openalpr-utils libopenalpr-dev

  4. 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

  5. Cmake : (Website)

    Click and download it from the website above.


Usage

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:

  1. Clone the project with:
    git clone https://github.com/OmarJabri7/Cycle_Buddy.git
  2. Change directorites and relocate in Cycle_Buddy project:
    cd Cycle_Buddy
  3. Link the necessary executables and libraries using CMake:
    cmake .
  4. Build the project using make:
    make
  5. Generate Unit tests and check if all components pass:
    make test
  6. Run the test file labeled Cycle_Buddy:
    ./Cycle_Buddy
    For more information, please visit this Youtube link


Results & Real-Time Responsivness:

  1. 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:



Figure 2: Real time demo

  • 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.
  1. 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:

results-appresults_outdoor

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.


  1. 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).


Contributing

This is an open-source project, therefore, just fork it and build up the project according to the README.md in every document.


License

Distributed under the GPL-3.0 License. See LICENSE for more information.


Contact




⭐️ Project address - @Project address

About

System that detects danger levels relative to drivers. Once a driver overpasses a biker, the system detects this unauthorised act, and responds by recognising the car plate in order to contact law enforcements..

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 70.0%
  • Java 27.9%
  • Other 2.1%