Project Overview: The project is a small car controlled by an Arduino that can park itself automatically using four distance sensors. The goal is to show how basic electronics can be used to create a simple self-parking system. I started with the idea of helping a car park safely in tight spaces.
What it does: It can park itself automatically when a button is pressed, using real-time distance measurements from four ultrasonic sensors (front, back, left, and right).
What is its purpose: The goal is to demonstrate how autonomous parking can be implemented in a simple and affordable way using basic electronic components. It shows how distance sensors, motors, and simple logic can be used to create useful automation.
What was the starting idea: I wanted to simulate the basic functionality of smart cars that can park themselves, but using only simple components that are easy for students or hobbyists to understand and build.
Why we believe it's useful: For others, it can serve as a starting point for more advanced robotics or automotive projects. For me, it helped improve my practical skills in programming and electronics.
Components :
Electrical scheme :
Electrical table :
Component | Arduino Pin(s) | Power | GND | Notes |
L298N Motor Driver | D5 (ENA), D8 (IN1), D12 (IN2), D11 (IN3), D10 (IN4), D6 (ENB), 5V (5V) | 5V - 12V | GND | ENA/ENB for speed (PWM), IN1-4 for direction; `JPI` jumper off so 5V pin works as logic input |
DC Gear Motor 1 (Left) | Controlled via IN1, IN2 (L298N) | — | — | Connect to OUT1, OUT2 on L298N |
DC Gear Motor 2 (Right) | Controlled via IN3, IN4 (L298N) | — | — | Connect to OUT3, OUT4 on L298N |
Ultrasonic Sensor Front-Right | D2 (Trig), A0 (Echo) | 5V | GND | Use voltage divider on Echo if Arduino 101 (3.3V logic) |
Ultrasonic Sensor Front-Left | D3 (Trig), A1 (Echo) | 5V | GND | Use voltage divider on Echo if Arduino 101 (3.3V logic) |
Ultrasonic Sensor Back-Left | D4 (Trig), A2 (Echo) | 5V | GND | Use voltage divider on Echo if Arduino 101 (3.3V logic) |
Ultrasonic Sensor Back-Right | D7 (Trig), A3 (Echo) | 5V | GND | Use voltage divider on Echo if Arduino 101 (3.3V logic) |
Push Button | D9 | 5V (pull-up) | GND | Using INPUT_PULLUP |
Red LED | A4 | 5V (via 220Ω) | GND | Status indicator |
Green LED | D13 | 5V (via 220Ω) | GND | Status indicator |
Battery (Motors) | — | 6V-12V to L298N `VCC` | GND | Powers motors through L298N |
Battery (Arduino) | Vin | 7.5V/9V | GND | Powers Arduino Uno or 101 |
Breadboard | — | — | — | — |
IDE :
Data structures :
struct orientation_t
: refers to the configuration (pins/functions) of a certain orientation used for parkingAlgorithms :
Pseudocode :
DEFINE struct Orientation: front_trigger_pin front_echo_pin back_trigger_pin back_echo_pin turn_function // function pointer for turning left or right FUNCTION readUltrasonic(trigger, echo): Send trigger pulse Measure echo pulse duration RETURN calculated distance FUNCTION moveForward(speed): Set motors to move forward at given speed FUNCTION moveBackward(speed): Set motors to move backward at given speed FUNCTION turnLeft(speed): Set motors to turn left at given speed FUNCTION turnRight(speed): Set motors to turn right at given speed FUNCTION stopMotors(): Stop all motors FUNCTION lateralPark(orientation): Turn on green LED WHILE front distance ≤ 10 cm: Move backward slightly Recheck front distance WHILE back distance > 15 cm: Call orientation.turn_function(speed) // turn left or right Recheck back distance WHILE front distance > 10 cm: Move backward slightly Recheck front distance Turn off green LED Blink green LED to indicate success FUNCTION loop(): IF button is pressed: Read all 4 distances (FL, FR, BL, BR) IF FL and BL ≤ 10 cm: Create Orientation with FL, BL, and turnRight Call lateralPark() ELSE IF FR and BR ≤ 10 cm: Create Orientation with FR, BR, and turnLeft Call lateralPark() ELSE: Turn on red LED (parking not possible)
This project demonstrates a simple and effective autonomous parking system using ultrasonic sensors and motor control. With modular design and real-time feedback, the robot can detect space, align itself, and park laterally on either side.