Car with Parking Sensors
A car equipped with front and back parking sensors.
Author: Popazu Petru Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-PetruPopazu.git
Description
The project consists of a car equipped with 6 ultrasonic sensors (3 at the front and 3 at the rear), 2 DC motors that allow it to move forward and backward. It detects the obstacles nearby, expressing the distance using LEDs, and based on readings of the sensors it stops when getting too close to an object. Using the wifi chip on the Pico, data from the sensor is transmitted to a web page and signals (forward, stop or backward) are sent to the Pico.
Motivation
The reason behind choosing the theme for this project is my great passion for cars, wanting to do something related to it. As i drive an older car with no parking sensors, i've always wished for this feature. I wanted to build them myself and learn how they operate. Along the way of building this project, i hope to gather as much knowledge as possible about microprocessor architecture and electronics.
Architecture
Diagram
Raspberry Pi Pico 2 W
- Controls all peripherals: reads distance from the ultrasonic sensors, manages the motors and the LEDs, sends data to the web page
HC-SR04 Ultrasonic sensors
- They constantly read distances, detecting obstacles in front and back
- Interface: GPIO
LEDs
- They light up reacting to the distances read by the ultrasonic sensors
- 2 Green LEDs, 2 Yellow LEDs, 2 Red LEDs and one Blue LED (Green = Safe, Yellow = Caution, Red = Stop, Blue: On = front detection, Off = rear detection)
- Interface: GPIO
L298n Motor Driver Module
- Controls the DC motors: forward and backward
- PWM speed control
- Interface: GPIO
DC Motors
- Drive the car forward and backward
- Interface: GPIO
Log
Week 28 April - 4 May
Started to visualize the idea of the project and wanted to better understand the overall concept, so i started to translate the idea into something more detailed using Kicad. During the drawing of the schematic I added to the cart the components of the project and ordered them.
Week 12 - 18 May
Week 19 - 25 May
Hardware
When signaling the car to move, the ultrasonic sensors start reading and the motors move in the direction provided. While moving, the ultrasonic sensors may detect obstacles; as the car approaches them, it slows down and provides visual indication through LEDs, eventually stopping ahead of the obstacle.
Schematics
This is the Kicad schematic.
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2 W | The microcontroller | 40 RON |
Breadboard HQ (830 Puncte) | Main board for connecting the components | 9,98 RON |
6 x HC-SR04 Ultrasonic sensor | The base of the parking feature | 40 RON |
2 x DC motors | Drive Motors | 30 RON |
L298N Motor Driver Module | The motor driver module | 10.99 RON |
Plusivo LED set | Indicators for distance | 26.99 RON |
Battery Holder + batteries | Supplying current to the circuit | 12 Ron |
Software
Library | Description | Usage |
---|---|---|
embassy_rp | Embassy RP | Initializing and interacting with the peripherals |
gpio | General Purpose Input/Output | Used for controlling digital pins connected to motors, LEDs, and ultrasonic sensors |
hc_sr04 | Driver for the ultrasonic sensors | Reading measurements |
pwm | PWM Module | For controlling the motors speed |
cyw43 | Rust driver for the CYW43 wifi chip | Interacting with the Wi-fi chip |
embassy-net | async network stack, designed for embedded systems | To send data of the sensor and receive commands for the car |