HC-SR04 Distance Sensing

Animals such as bats and porpoises use ultrasound for locating prey and obstacles.  If you have an electronic device that needs to sense distances from objects (like a robot or an automatic door opener) you might consider using an HC-SR04 Sensor Module.

HC-SR04 Ultrasonic Sensor


No one can sneak up on you with a couple of these and a buzzer attached to your favorite Arduino board. 🙄

The HC-SR04 module sends out an ultrasonic ‘PING’ and then detects its return after ‘bouncing off’ something in the distance. By measuring the round trip time (and knowing the speed that sound travels), a calculation can be made to determine the distance of the object from the HC-SR04.

Here is a public domain Ardunio sketch (the comments show the math involved to calculate the distances, they also show how the HC-SR04 is wired):


Leave a Reply

Your email address will not be published.