← All Projects

Build an Ultrasonic Parking Sensor with ESP32

Intermediate Est. Time: 2 hours Est. Total: $21.41

Build a distance-sensing system that uses the HC-SR04 ultrasonic sensor to detect objects and provide visual and audible proximity warnings — just like the parking sensors in modern cars. The NE555 generates a beeping tone that speeds up as objects get closer. The ESP32's WiFi lets you add a live distance readout on your phone. A hands-on project that teaches distance measurement, signal processing, and output control.

Bill of Materials — Available in Our Shop

PartQty PriceTotal Status
ESP32-WROOM-32 DevKit (38-Pin, USB-C)
Microcontroller — processes distance data and controls alarm rate
1 $8.99 $8.99 In Stock
HC-SR04 Ultrasonic Distance Sensor
Distance measurement — detects objects from 2 to 450cm
1 $2.49 $2.49 In Stock
NE555 Timer IC (DIP-8)
Beep generator — variable-rate proximity warning tone
1 $0.99 $0.99 In Stock
830-Point Breadboard + Jumper Wires + Power Supply Kit
Prototyping platform with power supply and jumper wires
1 $7.99 $7.99 In Stock
Subtotal (from our shop) $20.46
View Cart

Additional Parts Needed

These common parts are available at most electronics retailers. Estimated prices shown for budgeting.

PartQty Est.Total
Piezo Buzzer 1 $0.50 $0.50
3x LEDs (green, yellow, red) 1 $0.30 $0.30
3x 220 ohm Resistors 1 $0.15 $0.15
Est. external subtotal $0.95
Parts from our shop$20.46
Est. external parts$0.95
Est. Project Total$21.41

Step-by-Step Instructions

  1. Mount the HC-SR04 sensor on the breadboard. Connect VCC to 5V, GND to GND, Trig to ESP32 GPIO 5, and Echo to ESP32 GPIO 18.
  2. Wire three LEDs through 220 ohm resistors to ESP32 GPIO 26 (green), GPIO 27 (yellow), and GPIO 14 (red). These indicate proximity zones.
  3. Build the NE555 alarm circuit on the breadboard. Connect ESP32 GPIO 25 to the NE555 reset pin to control beeping.
  4. Upload the ESP32 sketch via USB-C: send a 10-microsecond pulse on Trig, measure the Echo return time, and convert to centimeters using the speed of sound formula (duration / 58).
  5. Program three distance zones: green LED for objects beyond 100cm, yellow LED for 30-100cm with slow beeping, red LED for under 30cm with rapid beeping. Optionally add a WiFi web server to display live distance readings on your phone.
  6. Mount the sensor facing outward on a wall or post. Test by walking toward it and verifying the LED transitions and beep rate changes match the expected zones.