How To: Make These Sonic Distance Sensors for the Bad Driver in Your Life

Make These Sonic Distance Sensors for the Bad Driver in Your Life

Today's fancy cars come with all sorts of options, from power mirrors to working seat belts. Some of us condemned to live in the reality of capitalist recession have no car, or perhaps a very modest one. But your modest car can still have some cutting edge technology wedged into the trunk and dashboard if you know what you want and where to look for parts. Today, we make a parking sensor using a sonic range finder, just like in the vehicles our owners drive!


  • Ping sonic range finder
  • Arduino
  • Light or buzzer

Step 1 Using the Ping Sensor

We've used a ping sensor before in our wildlife camera project. One circle emits a high frequency sound wave and the other catches the echo. Based on the difference between the time the sound is made and the time the echo is received, the ping sensor can tell how far away an object is. We will be using ours to detect obstacles in front of and behind our car.

Wire your ping sensor to your Arduino as shown below.

Make These Sonic Distance Sensors for the Bad Driver in Your Life

Step 2 Output

What do you want your output to be? Do you want to see a light when you are too close to an object? Would you prefer to be alerted by a buzzer? Figure out what works best for you. I chose to wire a buzzer into the circuit. Place the positive end of the buzzer on pin 8 and the negative end on a ground pin.

Make These Sonic Distance Sensors for the Bad Driver in Your Life

Step 3 Code

Load up the example Arduino code for the ping sensor. Navigate to File > Examples > Sensors > Ping. Sonic range finding is a bit of a task and the hardware on the ping sensor cannot do it all for us. The code does the final math necessary to translate the ping values into readable distances.

Now that you have seen the ping code, download this version I made for the parking sensor. The code sets off the warning buzzer when you come within a foot of a parking obstacle. You can change this distance by changing the highlighted section of the code, as shown below.

Make These Sonic Distance Sensors for the Bad Driver in Your Life

Step 4 Installation

This is the fun part. How you install your sensor will depend entirely on your materials and the shape of your car's bumper. You could try epoxy or zip ties—even duct tape. I decided to run my wires through my trunk to the driver's seat. My sensor just hangs from the trunk.

Make These Sonic Distance Sensors for the Bad Driver in Your Life

Final Thoughts

Put one of these modules on each end of your car. A front mounted sensor will tell you when you are getting too close to other cars in traffic or on the highway. The back one will help you with your miserable parallel parking skills. For a final iteration, you may want to use giant magnets like the FBI uses to attach radio transmitters to bumpers.

Have any questions? Please feel free to ask in the comments below or just message me. If you have a lengthy question or concern, the forum is a great place to get help from the community!

Don't Forget About Our Mad Science Contest!

Don't forget! We are currently accepting entries into our photo contest for a chance to win your very own lucid dreaming goggles kit! Just post a picture on the corkboard of a project you have made or are currently working on. All projects are welcome. Here is my example entry.

Just updated your iPhone? You'll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what's new and changed on your iPhone with the iOS 17.5 update.


What would be a good way to weatherproof the sensors? Am I correct in thinking that sealing them in a plastic box would negate their ability to ping?

You could put them in a plastic box with recessed holes so there is minimal exposure. An overhang above the sonar could help protect from rain as well. You could also try a plastic IR distance sensor, though you might get some interference from the sun.

Putting it in a sealed box will not work.

I was just typing the same thing. I would like to use this concept for a driveway alarm and making it water tight is a must.

just use conformal coating its like a varnish for electronic components and its water proof just spray it on its none conductive and is used by the electronics industry to weather proof pcbs my old company used it to weather proof boards for stair lifts that where used outside at beaches in the states it pretty tough stuff and easy to get just google it i think maplins sells in the uk

The all repairing sugru should do the same thing, and would allow you to attach the sensor in a more molded fashion. just a link for the conformal coating i mentioned above pcb lacquer at maplins in uk

dose the buzzer just buzz or is it sound like sonar sound getting faster as u get closer?

how did you power the arduino, car battery or something else?

the ultrasonic sensor i have has 4 pin, power, ground, trig and echo. from trig and echo which do i have to connect to pin 7?

Not sure. Do you know what the name of the sensor is?

can you use a different sensor? theres only one type on amazon and it s like 6$

Please post a modified version of this project in which one unit can provide digital distance output for both front and back with unique alarms for each. Also, would it cost much more to measure distance ar each end of both the front and rear bumpers?

will water come through the sensor even if I cover the circuit board?

A little off topic, but why can't we just use - or add - an old web cam and tablet to make a back-up cam and display? - Just a thought.

What if change the program as inches>= 12. Will the circuit work and buzz if the distance is greater than 12 inches? I wish to use this in a blind walking stick.

Will rain interfere with performance?

Share Your Thoughts

  • Hot
  • Latest