Ultrasonic Ranging Device


Now here's a really cool doodad, the HC-SR04 ultrasonic ranging device. Translate that as sonar, for indeed that's what it really is. The theory of operation is identical to what bats use. A ping is transmitted and the sensor detects the return echo, computing distance based upon how long it takes for the reflection from a solid object to return.

As you can see in the photo, above, I was standing 7 inches in front of the sensor when I snapped the pic. My experiments show that the unit is good for from 1 inch to 16 feet. And it's accurate!

Remarkably, you can get these for less than $2 from Amazon, which is where I purchased mine.

The circuit is a piece of cake:


The software is also a breeze, since I've written a library unit for the HC-SR04 to handle all the details. Be sure to read it over, for it's filled with additional info and comments.

In the demo, the readout is in inches, but the library unit also accommodates feet, centimeters and meters.

Click to get the source code.
Click to get the schematic PDF.

Next Project: Incandescent Lamp

No comments:

Post a Comment