Ultrasonic distance sensor

The HC-SR04 ultrasonic distance module is an inexpensive device to detect distances with centimeter accuracy, up to a few meters.

The device emits ultrasonic pulses of sound and listens for an echo. The echo time depends on the distance of the object that reflected the sound.

As you might expect, this device works best with large, solid, flat surfaces (like walls) which readily reflect sound. It will be much less useful for detecting soft objects like carpets, pillows, and animals. It also will not reliably detect narrow objects such as the legs of chairs and tables.

To use the HC-SR04 in your Arduino sketches, you can use a library called NewPing: https://bitbucket.org/teckel12/arduino-new-ping/downloads/


 MENU