Parking Assistant on an Arduino Uno
by definetlyanepiccreator in Circuits > Arduino
17 Views, 1 Favorites, 0 Comments
Parking Assistant on an Arduino Uno
This project is a parking assistant system designed using a breadboard with an Arduino Uno and an ultrasonic sensor. The idea here is to detect how close an object is to the system and display this on an LCD screen in centimeters to ensure a collision-free system.
Prior to developing this project, I investigated the mechanism by which existing parking sensors are implemented in cars. I also looked for existing projects similar to mine that utilize Arduino. Most existing projects employ the use of ultrasonic sensors since they are cheaper and more accurate over shorter ranges for objects behind a car. Through these projects, I gained insight into how distance is measured using the time taken for a sound wave to travel to an object and back.
Based on this research, I created my own project that aims to provide visual feedback using an LCD and LEDs, and also uses an AND gate to showcase digital logic control. This makes my project both practical and applicable to Computer Engineering principles.
Supplies
- Arduino Uno
- I2C LCD (20x4)
- Ultrasonic Distance Sensor
- Slide Switch
- Red LED (1x)
- Green LED (1x)
- Resistors (2x 330 Ω)
- Potentiometer
- 1x AND Gate (IC)
- Breadboard
- Jumper Wires
Understanding How the System Works
Before building, it’s important to understand the logic of the project.
- The distance sensor continuously measures the distance between the system and nearby objects.
- The Arduino processes this data and converts it into centimeters.
- The LCD displays the distance in real time.
- LEDs provide a visual warning:
- Green LED: Object is at a safe distance
- Red LED: Object is too close
- A slide switch allows the assistant system to be turned ON or OFF.
- An AND gate ensures the assistant system only activates when both the switch is ON and the Arduino is powered.
Setting Up the Breadboard Power Rails
- Place the Arduino Uno next to the breadboard.
- Connect Arduino 5V to the breadboard’s positive rail.
- Connect Arduino GND to the breadboard’s ground rail.
- Make sure all components share the same ground connection.
Connecting the Distance Sensor
- Place the distance sensor on the breadboard.
- Connect:
- VCC → 5V rail
- GND → Ground rail
- Signal pins → Assigned Arduino digital pins
- Ensure the sensor is facing outward to detect approaching objects.
This sensor is responsible for measuring how close an object is to the system.
Wiring the I2C LCD Display (20x4)
- Connect the I2C LCD module to the breadboard (Note that the one on the image shown is a 16x4 LCD module, so imagine it as a 20x4).
- Wire the LCD:
- VCC → 5V
- GND → GND
- SDA → Arduino SDA pin
- SCL → Arduino SCL pin
- Use the potentiometer to adjust the LCD contrast:
- Middle pin → LCD contrast input
- Side pins → 5V and GND
The LCD will display the measured distance in centimeters.
Adding the LED Warning System
- Place the red and green LEDs on the breadboard.
- Connect a 330 Ω resistor in series with each LED.
- Wire:
- Green LED → Arduino output pin
- Red LED → Arduino output pin
- Connect LED cathodes to ground with the resistors for efficiency.
The LEDs provide quick visual feedback for safe and unsafe distances.
Integrating the Slide Switch
- Place the slide switch on the breadboard.
- Connect one side to 5V.
- Connect the other side to ground (pull-down).
- Connect the switch output to the AND gate input.
This switch allows the user to manually enable or disable the parking assistant.
Using the AND Gate for System Control
- Place the AND gate IC on the breadboard.
- Connect:
- Input 4B → Slide switch output
- Input 4A → Arduino control signal
- Output 4 → Arduino pin 6 + AND gate input 1A and 2A
- Input 1B → Arduino pin 7
- Input 2B → Arduino pin 9
- Output 1 → Red LED Anode
- Output 2 → Green LED Anode
- This ensures the system only runs when both conditions are true.
This step demonstrates the use of digital logic in a real-world application.
Arduino Programming Logic
The Arduino program performs the following tasks:
- Reads distance data from the sensor
- Converts time or voltage values into centimeters
- Displays distance on the LCD
- Controls LEDs based on distance thresholds
Example logic:
- Distance > 50 cm → Green LED ON
- Distance ≤ 50 cm → Red LED ON
Full Code:
Testing the Parking Assistant
- Power the Arduino using USB or external power.
- Turn the slide switch ON.
- Move an object closer to the sensor.
- Observe:
- Distance changing on the LCD
- LEDs switching based on proximity
Adjust thresholds in code if necessary.
Final Results and Improvements
This parking assistant successfully:
- Measures distance in real time
- Displays accurate distance readings
- Provides visual warnings to avoid collisions
Possible Improvements
- Add a buzzer for audio alerts
- Use multiple sensors for wider coverage
- Enclose the circuit in a protective case
- Add brightness control for LEDs
Downloads
Conclusion
This project demonstrates how sensors, microcontrollers, logic gates, and user interfaces can work together to solve real-world problems. A parking assistant like this could be scaled up for real vehicles or adapted for robotics and automation applications.
This makes it a strong and practical Computer Engineering final project.