Modal Title

Off-The-Shelf Hacker: Hot Rodding the Ultrasonic Range Sensor

Jan 9th, 2016 11:49am by
Featued image for: Off-The-Shelf Hacker: Hot Rodding the Ultrasonic Range Sensor

A couple of weeks ago in the Off-The-Shelf Hacker column, we looked at re-purposing my v1.0 Steampunk badge to a portable ultrasonic range finder. One of the best parts of being an Off-The-Shelf Hacker is taking old stuff and making it do new things. Some call it hardware modding or if you are a gear head, hot rodding. In any event, using bits and pieces from one prototype and engineering them into another project, can be useful and fun.

That story focused on the mechanics of using an HC-SR04 sensor with an Arduino Pro-Mini.

ultrasonic-sensorThis week we’ll explore a few application projects of the ultrasonic sensor, from around the Web. It’s good to get out and see how other hackers build their prototypes once in a while.

Garage Door Sensor

Although, this story is a couple of years old it’s a great way to check if your garage door is up. The idea is to mount the ultrasonic rangefinder above the garage door so that when the door is up, the sensor will detect a relatively short distance. When the door moves down to the closed position, the sensor is ranging the garage floor, which is much further away. It’s a simple and easy way to detect a door or panel’s position.

Water Level Sensor

Perhaps finding the liquid level in a tank is your thing. That’s easy enough, just point an ultrasonic sensor at the liquid and measure the distance.

A few things to keep in mind.

Any condensation or liquid that gets on the sensor will probably affect its accuracy. This would suggest that this type of sensor might be suitable for an “open-air” environment, as opposed to measuring in an enclosed space. Obviously, dampness is an issue when your ultrasonic sensor is on the front of an all-terrain robot, too.

Another challenge is errant reflections of the ultrasonic beam, giving inaccurate readings. In the article, the author talks about getting possible beam reflections, from the sides of the tank. This situation might suggest situating the sensor in the middle of the tank, instead of around the edge. Again, an “open-air” environment might be applicable here.

Long Range Sensor

How would you like to double the distance of the basic distance sensing device? Take a look at this long-range ultrasonic sensor mod with a directional reflector. I was able to measure up to about 140 inches, reliably, with my unaided HC-SR04 range finding module. The author of this Instructable said he could get about 9 meters from his rig. That’s around 29.5 feet!

One notable challenge the author faced was accounting for the first echo of the sound wave, giving him the distance from the sensor to the reflector surface. He was able to hack around this problem by adding a “blanking” circuit to the design. He just ignored the return pulse for a short period of time (corresponding to the return time from the reflector) and waited for the one coming back from the distant object. We like to see suitable technical solutions to interesting problems, right?

I was thinking that maybe a better reflector could increase the distance even further. Surely, a frying pan doesn’t offer the optimum parabolic shape. This project is certainly a great starting point for further refinement.


Could we possibly incorporate an ultrasonic range finder into a wearable?

I’ve thought about putting an ultrasonic sensor on one of my Steampunk conference badges and have it change the color of the LED “ozone tube”, depending on how close a person gets in front of me. One of the main reasons for the badge is to attract attention when I walk around a show floor. That might add a new dimension. Couldn’t resist that pun.

The current version of the badge is running a Raspberry Pi 2, which has 3.3-volt GPIO pins. The standard HC-SR04 is a 5.0-volt device. There would definitely have to be some voltage dividers, so I don’t damage the Pi.

Here’s a ModMyPi article, spelling out how to hook a Pi up to the ultrasonic device. The story also discusses a Python script to read the distance.

What’s Next

Ultrasonic range finding modules are cheap and pretty easy to use. Why not order a couple and build an interesting gadget of your own. Be sure to share your project with other Off-The-Shelf Hackers.

Feature image via Pixabay, available under the CC0 license.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Shelf.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.