Skip to main content
Version: FILS English

Autonomous Parking Car

A simple autonomous parking prototype using Raspberry Pi Pico 2W, Rust and Embassy.

info

Author: Ghita Alexandru-Catalin
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-GhitaAlexandruCatalin

Description

This project builds a small autonomous parking car, using Raspberry Pi Pico 2W programmed in Rust with Embassy. The car uses three ultrasonic sensors to detect a parking space and automatically perform a parking maneuver using tank steering. A simple web interface on the Pico 2W shows the parking status and allows the user to confirm the parking if needed.

Motivation

I chose this project because I wanted to understand how automated parking systems work, like the one in my Renault 2024. I noticed the real system sometimes struggles, so I decided to create a basic prototype to see how parking detection and control could be implemented with simple sensors and motors. I also wanted to practice using Rust in embedded systems.

Architecture

The system is made up of a Raspberry Pi Pico 2W that runs all the logic. It reads data from three ultrasonic sensors:

one at the front-center (to detect obstacles ahead),

one at the right-front (to detect the start of a parking space),

one at the right-rear (to detect the end of the parking space).

The Pico 2W also controls the two motors (using tank steering) through a TB6612FNG driver. It hosts a simple web interface that shows if a parking space was found and allows the user to press a button to start parking.

When a space is detected, the car either starts parking automatically or waits for confirmation through the web interface. The parking maneuver is done by reversing with tank steering.

Architecture

Log

Week 5 - 11 May

Built the car and developed stable automatic parking algorithm with PWM motor control and sensor-based logic.

Week 12 - 18 May

Calibrated the parking stages duration (to make sure the car parks as good as possible), integrated Wi-Fi support and added web interface plan with special parking maneuver detection.

Week 19 - 25 May

Created the web page and the server on the Pico to control the maneuvres of the car (Start searching, Start parking, Auto parking)

Hardware

The car is built on a 2-wheel drive chassis from a robot kit. It uses two DC motors controlled by a TB6612FNG motor driver. Three ultrasonic sensors (2x HC-SR04 and 1x HC-SR04+) are used to detect obstacles and parking space. A Raspberry Pi Pico 2W runs the control program. Power is provided by 4x AA batteries in a holder with a switch. HardwareLeft HardwareRight

Schematics

Schematic

This is the kicad schematic.

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller39 RON
Raspberry Pi Pico Debug probePico Debug Probe66 RON
TB6612FNG Motor DriverControls the 2 DC motors25 RON
2 DC Motors + 3 wheels chassis + 4 AA battery holder + battery switchThe motors that power the car50 RON
Breadboard+Wires+Resistors+Power supplyUsed to connect the devices together~25 RON (included in a kit)
2x HC-SR04 Distance sensorsUsed to measure the distance from the car to the wall6 RON
HC-SR04+ Distance sensorUsed to measure the distance from the car to the wall15 RON
Holding brackets for the distance sensorsUsed to keep the sensors in a good position for the parking manoeuvre2RON

Software

LibraryDescriptionUsage
embassyAsynchronous embedded frameworkBase for writing async embedded code
embassy-executorAsync task executorRuns async tasks like motor control and sensor reading
embassy-rpEmbassy HAL for RP2040Access to GPIO, PWM, timers and peripherals on Pico 2W
embassy-timeAsynchronous time managementProvides delays and timers for task synchronization
embassy-netEmbedded networking stackEnables Wi-Fi and TCP/Web server on the Pico W
smoltcpLightweight TCP/IP stackManages TCP connections for the web server
static_cellStatic memory allocatorSafe global resource allocation (e.g., networking stack)
embedded-halHardware Abstraction LayerAbstract interface for motors, sensors and peripherals
embedded_io_asyncAsync traits for I/O operationsUsed for async socket read/write operations
core::sync::atomicAtomic types for concurrencySafe flag sharing between web server and parking logic
defmt, defmt-rttEfficient embedded loggingLow-overhead logging for debugging
panic-probePanic handler for no_stdLightweight handler for crash diagnostics
heaplessHeap-free data structuresUseful for HTTP response buffers and internal strings
embassy_lab_utilsWi-Fi and network stack initialization helpersProvides init_wifi!() and init_network_stack() macros
  1. YouTube link with the working project
  2. Real life inspiration
  3. Arduino model