Back to Portfolio

Smart Parking Sensor System (Raspberry Pi 5 + HC-SR04)

IoT / Embedded Systems / Automation2024

An intelligent parking assistance system using Raspberry Pi 4 & 5, ultrasonic distance sensing, multicolor LEDs, and buzzer alerts for real-time parking guidance.

Smart Parking Sensor System (Raspberry Pi 5 + HC-SR04)

The Problem

In low-visibility parking conditions, drivers often struggle to gauge safe distances, leading to vehicle or wall collisions. Traditional parking sensors are expensive or unavailable in low-budget vehicles. This project aims to design a low-cost, Raspberry Pi-based smart parking sensor that provides both visual and auditory feedback for safer parking.

Problem illustration

The Solution

The Smart Parking Sensor System measures the distance between the vehicle and nearby obstacles using an ultrasonic sensor (HC-SR04). The Raspberry Pi 5 processes the readings and drives color LEDs and a buzzer according to distance thresholds. The system alerts the driver with green, yellow, and red lights combined with sound patterns to indicate proximity levels. It is suitable for garages, campuses, or public parking zones as a reliable and energy-efficient assistance tool.

Hardware Setup

Connected Raspberry Pi 5 (8 GB) and Pi 4 (4 GB) to HC-SR04 ultrasonic sensor, LEDs (R/Y/G), and buzzer on a perforated board using jumper wires and resistors.

Electronic Design

Defined GPIO mappings: TRIG (14), ECHO (18), GREEN (17), YELLOW (27), RED (22), BUZZER (23). Implemented power management and test circuits on a breadboard.

Software Logic

Used gpiod library for Raspberry Pi 5 and RPi.GPIO for Pi 4 to control GPIO pins. Measured distance, mapped values to LED/buzzer patterns: Green (> 25 cm), Yellow (10–25 cm), Red (< 10 cm).

Hardware & Architecture

Embedded IoT architecture combining Raspberry Pi, ultrasonic sensing, and LED + audio feedback for distance-based guidance.

  • Microcontroller: Raspberry Pi 5 (8 GB) and Pi 4 (4 GB)
  • Sensor: HC-SR04 Ultrasonic Distance Sensor
  • Indicators: RGB LEDs (traffic-light style) + Active Buzzer
  • Software Libraries: gpiod / RPi.GPIO / time modules
  • Power Management + Breadboard Prototyping Circuit

Technologies Used

Raspberry Pi 5 / 4Python 3HC-SR04 Ultrasonic SensorLED Modules (G/Y/R)Active Buzzergpiod / RPi.GPIO LibraryBreadboard PrototypingProteus Simulation

Future Improvements

  • Add energy-saving mode to disable LEDs when idle.
  • Integrate ultrasonic array for side and front detection.
  • Develop mobile app interface for Bluetooth status feedback.
  • Include haptic feedback or LCD display for drivers.
  • Optimize mounting and waterproof housing for outdoor use.
Smart Parking Sensor System (Raspberry Pi 5 + HC-SR04) | Abdulrahman Hamdi