Arduino Nano — Parking Sensor
4 distance zones — 1 slow low beep far, 2 fast high-pitch beeps close (like a real car reversing buzzer)
What you will learn
- How pulseIn() measures the time it takes for an ultrasonic pulse to come back
- Why real car parking sensors use DISTANCE ZONES (1 beep far, 2 close) instead of a smooth map()
- How a helper function (playBeeps) keeps the main loop() short and readable
- How to handle "no echo" (distance = 0 or very large) gracefully
What you will need
| Component |
|---|
| 1× Arduino Nano |
| 1× HC-SR04 ultrasonic sensor |
| 1× buzzer |
| 1× breadboard |
| 4× jumper wires |
Step by step
Take it further
- Add 3 LEDs: green (safe), yellow (close), red (very close).
- Print the distance to the Serial Monitor AND the Serial Plotter to see a live graph.
- Add a button to switch between "parking" and "intruder" mode (continuous tone above a threshold).
Practise it before you build it
Wire this circuit in the ThinkEdge Learn simulator first. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so the LED on screen actually lights when the current is right — no hardware, no burnt components, and a class can try it in a browser.
Related projects
Guides that use this project
2 guides on the site build this project as part of a longer explanation. The guide says why the circuit works; this page says how to wire it.
Where this project sits
It is also part of these lists, which is how a class usually finds it.
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.