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

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

Kicad Schematic

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2 WThe microcontroller40 RON
Breadboard HQ (830 Puncte)Main board for connecting the components9,98 RON
6 x HC-SR04 Ultrasonic sensorThe base of the parking feature40 RON
2 x DC motorsDrive Motors30 RON
L298N Motor Driver ModuleThe motor driver module10.99 RON
Plusivo LED setIndicators for distance26.99 RON
Battery Holder + batteriesSupplying current to the circuit12 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