Introduction: Arduino Reverse Obstacle Sensor for Cars

This is an instructable for making your car reverse/backing/parking obstacle sensor. The full story in on my blog:
http://liudr.wordpress.com

With this obstacle sensor, you can find out your car's distance to another car behind it while backing. You can get as close to another car as a foot with the help of the sensor, yet not hit the car while backing.

The distance to your obstacle is displayed on an LCD monitor in foot/inch, mm, and bar graph. You will also hear an audio alert. As you get closer to your obstacle the audio alert beeps more frequently.


Step 1: Step 1 Care for Principle of Operation?

As a physicist, I have to lecture on the principle of the sonic ranger a bit. It is a rather simple device, the small cousin of the police speed gun! The sonic ranger sends a few pulses of supersonic waves and waits for the waves to bounce back from an object in front of it. Once it detects the reflected sound, it knows how much time it took the waves to travel a round trip from the ranger to the obstacle and back. With speed of sound at around 340m/s, you can calculate the distance to an object. You can also find velocity if you measure distance at two consecutive times and do distance change over time. Bats use their sonic ranger to fly in pitch black caves or catch food! Mr. English also tried the same technique with no apparent training and failed miserably. One episode of Stan Lee's super heroes also featured a blind person using his tongue clicks to tell what's around! That's it for sonic ranger intro!

Step 2: Step 2 List of Parts


I've listed the parts here:

1. One arduino Duemilanove or UNO (many vendors sell this) http://www.sparkfun.com/products/9950
2. One Phi-1 shield kit for arduino http://dipmicro.com/store/JL-PHI-1
3. One RJ11 jack and breakout board. I made some breakout boards myself and used the RJ11 jack from the Phi-1 kit. But you can buy from sparkfun: Rj11 jack http://www.sparkfun.com/products/132 and RJ11 breakout board http://www.sparkfun.com/products/193 . You have to observe which pin is which with a multimeter.
4. One four-wire phone cable. Just go to a dollar store and make sure you're not getting two-wire cables.
5. One Ping or other ultrasonic sensor from parallax http://www.parallax.com/tabid/768/ProductID/92/Default.aspx . Alternatively you can also buy this one from sparkfun http://www.sparkfun.com/products/639 . You will have to make sure you're connecting the PWM pins to arduino. I don't have this.
6. One 1uF 25V capacitor. You can get it anywhere you buy the other parts.
7. Either a car power adapter that outputs center-positive 9V to 12V or a 9V battery with a connector from here http://dipmicro.com/store/BH9V .
8. Maybe some tape to secure the sensor to the back of your car.

Step 3: Step 3 Assemble and Test the Phi-1 Shield

This is covered somewhere else. Here is its documentation so you can just follow the steps. Make sure you solder on the buzzer on top right corner, and one RJ11 jack on the bottom right corner, like in this picture:

This instructable has the steps to assemble the shield.

https://www.instructables.com/id/Arduino-alarm-clock/

After assembly, test the shield with test code found on this page: http://liudr.wordpress.com/phi-1-shield/

The test code will ask you to adjust LCD contrast, press all buttons, and test out the buzzer and real time clock. You can try the alarm clock code and Morse code translator code on that page too. they don't need any more hardware than you already have on the shield.

Step 4:

Solder the RJ11 jack on its breakout board, both of which you purchased from sparkfun.
Connect phone cord between the shield and the RJ11 jack with breakout board.
Without plugging the shield on arduino, use a multimeter to test the continuity so you know which wire goes from the shield to which spot on the breakout board. Here is the picture of the sparkfun RJ11 breakout board:

Step 5: Step 5 Connect Sonic Ranger to Arduino

You will need a cable or solder three wires to the sonic ranger. I found this connector in my drawer but if you don't have one, go to a surplus store. Old CD-roms also have these wires. Make sure you get the right pin to the sonic ranger. Test with mulitmeter. I used my own breakout board so all signals are marked. Since the cable is only 3-pin, I had to feed 5V on the X pin on my shield. I jumped the x pin to 5V. If you have a cdrom cable you have 4 pins and can switch out pin orders easily with a small jeweler's screw driver. The output of the sonic ranger should go to arduino channel 2 Y, which is connected to analog 3.

Stick a 1uF capacitor (cylinder at the left end of the red-black-white wire) between 5V and GND to filter out noise. Trust me, this is not optional! Observe polarity of your cap.

Step 6:

Download arduino IDE if you don't have one from arduino.cc

I have made two versions of the program, a fully interactive one with menu and adjustable parameters. Another version is a nutshell, if you're interested in learning how things work quick.

Full version - interactive with menu and parameters

Nutshell version - powers up and works no parameters to adjust

Step 7: Step 7 - Field Test

Now take everything to your car. Tape your wire where necessary. Tape the sensor on the rear bumper cover facing straight, not tilting up or down. Make sure when you are parked in front of a car, you can detect it. Here is test pictures:

Step 8: Step 8 - Make It More Permanent


I made a small casing for the sensor so I can stick some 3M command stuff in its back with "velcro" so I can easily attach it to my car and remove it during a rainy day!

You are done!

For more projects with arduino and the Phi-1 shield, visit me at http://liudr.wordpress.com