Autonomous Parking Car
A simple autonomous parking prototype using Raspberry Pi Pico 2W, Rust and Embassy.
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.
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.
Schematics
This is the kicad schematic.
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | The microcontroller | 39 RON |
Raspberry Pi Pico Debug probe | Pico Debug Probe | 66 RON |
TB6612FNG Motor Driver | Controls the 2 DC motors | 25 RON |
2 DC Motors + 3 wheels chassis + 4 AA battery holder + battery switch | The motors that power the car | 50 RON |
Breadboard+Wires+Resistors+Power supply | Used to connect the devices together | ~25 RON (included in a kit) |
2x HC-SR04 Distance sensors | Used to measure the distance from the car to the wall | 6 RON |
HC-SR04+ Distance sensor | Used to measure the distance from the car to the wall | 15 RON |
Holding brackets for the distance sensors | Used to keep the sensors in a good position for the parking manoeuvre | 2RON |
Software
Library | Description | Usage |
---|---|---|
embassy | Asynchronous embedded framework | Base for writing async embedded code |
embassy-executor | Async task executor | Runs async tasks like motor control and sensor reading |
embassy-rp | Embassy HAL for RP2040 | Access to GPIO, PWM, timers and peripherals on Pico 2W |
embassy-time | Asynchronous time management | Provides delays and timers for task synchronization |
embassy-net | Embedded networking stack | Enables Wi-Fi and TCP/Web server on the Pico W |
smoltcp | Lightweight TCP/IP stack | Manages TCP connections for the web server |
static_cell | Static memory allocator | Safe global resource allocation (e.g., networking stack) |
embedded-hal | Hardware Abstraction Layer | Abstract interface for motors, sensors and peripherals |
embedded_io_async | Async traits for I/O operations | Used for async socket read/write operations |
core::sync::atomic | Atomic types for concurrency | Safe flag sharing between web server and parking logic |
defmt , defmt-rtt | Efficient embedded logging | Low-overhead logging for debugging |
panic-probe | Panic handler for no_std | Lightweight handler for crash diagnostics |
heapless | Heap-free data structures | Useful for HTTP response buffers and internal strings |
embassy_lab_utils | Wi-Fi and network stack initialization helpers | Provides init_wifi!() and init_network_stack() macros |