Skip to main content
Version: FILS English

Car with Parking Sensors

A car equipped with front and back parking sensors.

info

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

Architecture

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.

Picture1

First Layer

First Layer

First layer

Second Layer

Second Layer

Third Layer

Third Layer

Overall view

Overall Front

Overall Back

Schematics

This is the Kicad schematic.

Kicad Schematic

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2 WThe microcontroller40 RON
Mini BreadboardUsed for connecting the LEDs2.35 RON
Breadboard HQ (830 Puncte)Main board for connecting the components4.56 RON
6 x HC-SR04 Ultrasonic sensorThe base of the parking feature40 RON
2 x DC motors with WheelsDrive Motors30 RON
L298N Motor Driver ModuleThe motor driver module10.99 RON
Plusivo LED setIndicators for distance26.99 RON
Battery SupportConnection between battery and current for the pico1.29 Ron
BatterySupplying current to the circuit7.99 RON

Software

LibraryDescriptionUsage
embassy_rpEmbassy RPInitializing and interacting with the peripherals
gpioGeneral Purpose Input/OutputUsed for controlling digital pins connected to motors, LEDs, and ultrasonic sensors
hc_sr04Driver for the ultrasonic sensorsReading measurements
pwmPWM ModuleFor controlling the motors speed
cyw43Rust driver for the CYW43 wifi chipInteracting with the Wi-fi chip
embassy-netasync network stack, designed for embedded systemsTo send data of the sensor and receive commands for the car
  1. Embedded Programming with Rust
  2. NerdCave