Build it step by step
0 of 6 doneSet the regulator
Before connecting the Nano, power the LM2596 from a 12 V source and turn it to exactly 5.0 V.
Wire the power
Take the feed from the reverse light wire through a 3 A in-line fuse. Never power it from the Nano's USB.
Wire the sensor
TRIG to D2, ECHO to D3, VCC to 5V, GND to GND. Run the sensor on its cable through the bumper.
Add the alerts
Buzzer to D5, red LED to D6 and green to D7, each LED with 220 Ω.
Upload and test on the bench
Hold a book at different distances and check the beeps.
Mount
Seal all joints with silicone and heat-shrink, mount the sensor facing back at about 50 cm height, and test slowly with a helper.
How do you build a reverse parking sensor?
A waterproof ultrasonic sensor on the bumper beeps faster as you get closer when reversing, with a steady tone under 30 cm. You need Arduino Nano, JSN-SR04T waterproof ultrasonic sensor, Active buzzer 5 V, LED 5 mm red, LED 5 mm green, Resistor 220 Ω × 2, LM2596 Buck Module, Blade fuse with inline holder (car type) and ABS project box (100 × 60 × 25 mm). It takes 6 steps and about 150 minutes.
- Level
- Beginner
- Time
- About 150 min
- Parts
- 9
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- Motors & ActuatorsBuy
- SemiconductorsBuyLED 5 mm red × 1
- SemiconductorsBuyLED 5 mm green × 1
- PassivesBuyResistor 220 Ω × 2
- PowerBuy
- PassivesBuy
- Mechanical & HardwareBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Reverse light + (through the in-line fuse) | LM2596 IN+ | Power only while reversing |
| Vehicle ground | LM2596 IN− | Return |
| LM2596 OUT+ / OUT− (set to 5.0 V first) | Nano 5V / GND | Regulated power |
| JSN-SR04T TRIG / ECHO | Nano D2 / D3 | Distance |
| JSN-SR04T VCC / GND | Nano 5V / GND | Sensor power |
| Active buzzer + / − | Nano D5 / GND | Beeps |
| Green LED anode through 220 Ω | Nano D7, cathode to GND | Clear |
| Red LED anode through 220 Ω | Nano D6, cathode to GND | Close |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). No libraries. The JSN-SR04T cannot measure closer than about 20 cm, which is why the steady tone starts at 30 cm.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const byte TRIG = 2, ECHO = 3, BUZ = 5, RED = 6, GREEN = 7;
float readCm() {
float v[3];
for (byte i = 0; i < 3; i++) { // take three readings and use the middle one
digitalWrite(TRIG, LOW); delayMicroseconds(4);
digitalWrite(TRIG, HIGH); delayMicroseconds(12);
digitalWrite(TRIG, LOW);
long us = pulseIn(ECHO, HIGH, 30000); // 30 ms timeout is about 5 m
v[i] = us ? us / 58.0 : 999;
delay(15);
}
if (v[0] > v[1]) { float t = v[0]; v[0] = v[1]; v[1] = t; }
if (v[1] > v[2]) { float t = v[1]; v[1] = v[2]; v[2] = t; }
if (v[0] > v[1]) { float t = v[0]; v[0] = v[1]; v[1] = t; }
return v[1];
}
void setup() {
pinMode(TRIG, OUTPUT); pinMode(ECHO, INPUT);
pinMode(BUZ, OUTPUT); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT);
}
void loop() {
float cm = readCm();
digitalWrite(GREEN, cm > 150); digitalWrite(RED, cm <= 150);
if (cm > 150) { digitalWrite(BUZ, LOW); delay(100); return; } // clear: silent
if (cm < 30) { digitalWrite(BUZ, HIGH); delay(100); return; } // too close: steady tone
unsigned int gap = map((long)cm, 30, 150, 80, 600); // closer means faster beeps
digitalWrite(BUZ, HIGH); delay(60);
digitalWrite(BUZ, LOW); delay(gap);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Object at 2 m | Green LED, silent |
| Object at 1 m | Red LED, a beep about every 350 ms |
| Object at 40 cm | Beeps about every 140 ms |
| Object at 20 cm | Steady tone |
If it does not work
Random beeps with nothing behind
The sensor may be catching the bumper or the tow bar. Aim it slightly down and away.
Readings are zero
Check TRIG and ECHO are not swapped and the sensor has 5 V.
The Nano resets when the engine starts
Supply noise. Add a 470 µF capacitor on the LM2596 output.
It does not work in heavy rain
Water on the face of the sensor can cause false readings. Dry it or wipe it.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the reverse parking sensor?
Arduino Nano, JSN-SR04T waterproof ultrasonic sensor, Active buzzer 5 V, LED 5 mm red, LED 5 mm green, Resistor 220 Ω × 2, LM2596 Buck Module, Blade fuse with inline holder (car type) and ABS project box (100 × 60 × 25 mm).
How long does the reverse parking sensor take to build?
About 150 minutes for a beginner maker, in 6 steps.
How do I know the reverse parking sensor works?
Object at 2 m: Green LED, silent. Object at 1 m: Red LED, a beep about every 350 ms. Object at 40 cm: Beeps about every 140 ms.
Random beeps with nothing behind: what should I check?
The sensor may be catching the bumper or the tow bar. Aim it slightly down and away.
Readings are zero: what should I check?
Check TRIG and ECHO are not swapped and the sensor has 5 V.
The Nano resets when the engine starts: what should I check?
Supply noise. Add a 470 µF capacitor on the LM2596 output.
It does not work in heavy rain: what should I check?
Water on the face of the sensor can cause false readings. Dry it or wipe it.
