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, backward, left and right. It detects the obstacles nearby, expressing the distance using LEDs, and based on readings of the sensors it stops when getting close to an object and looks for a way to go around it. Using the Wi-Fi chip on the Pico, sensor data is transmitted from the Pico to a web page, while control signals (such as forward, stop, or backward) are sent from the web page back 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, backward, right and left
- 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 5 - 11 May
The Ultrasonic Sensors have arrived, so i began building the layers of the car. I put together the 3 layers:
- first layer will be for the motors with the wheels and driver module
- second layer is where the ultrasonic sensors will be placed; also the battery is going to sit here
- third layer is where the 2 breadboards are situated: first breadboard for the Pico and the connections with the sensors and motors; second breadboard for the LED's Secured the ultrasonic sensors to the board using small metal parts and attached the wires to them.
Week 12 - 18 May
I added to the base layer 2 DC Motors and L298N module. I firstly screwed in a side of the Motor, but saw that it was wobbly and decided to use a Hot Glue Gun to secure it to the base. Wired them to the module and from the module to the Breadboard with the Pico.
Going to the last layer, because the second was already done. Placed the 2 breadboards on the last layer and attached to the larger one, the Pico. Connected the previously attached wires from the sensors to the GPIO pins of the Pico and the wires from the driver module. Added to the small breadboard the LEDs and connected them to the Pico.
This is the final form of the hardware. From now on, starting to implement the software.
Hardware
Raspberry Pi Pico 2W used for controlling the hardware of the project.
DC Motors are used to move the car through the L298N driver module.
The LEDs visualize the distance to the objects.
HC-SR04P Ultrasonic Sensors detect objects nearby.
Initial Skeleton of the car.
First Layer
Second Layer
Third Layer
Overall view
Schematics
This is the Kicad schematic.
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2 W | The microcontroller | 40 RON |
Mini Breadboard | Used for connecting the LEDs | 2.35 RON |
Breadboard HQ (830 Puncte) | Main board for connecting the components | 4.56 RON |
6 x HC-SR04 Ultrasonic sensor | The base of the parking feature | 40 RON |
2 x DC motors with Wheels | 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 Support | Connection between battery and current for the pico | 1.29 Ron |
Battery | Supplying current to the circuit | 7.99 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 |