Maker Pro
Custom

HC-SR04 Datasheet | Ultrasonic Proximity Sensor

May 10, 2019 by Daniel Hertz
Share
banner

This article focuses on the HC-SR04 ultrasonic proximity sensor, highlighting its specs and common applications.

Hardware

The HC-SR04 is a proximity sensor that’s very popular amongst makers. Here, we explain how the module works, what you need to know to use one in your projects safely, and discuss the operating basics. Links to the full datasheets are available at the end of the article.

About the HC-SR04

The HC-SR04 is an ultrasonic proximity sensor that tells you whether an object is in front of it, and also provides the distance between the sensor and the object. These sensing abilities make it particularly useful for robots that need to know how far they are away from an object or obstacle, for example, a wall or a piece of furniture that they shouldn’t hit.

The module is readily available as a finished breakout board that connects to your existing projects. You can get it from many different manufacturers and suppliers, like Adafruit and Geekreit, and they are usually fully compatible. The only difference is the price and shipping time.

Important Specs

  • Length: 4.5 cm (1 ¾ in)
  • Width: 2.0 cm (¾ in)
  • Height: 1.4 cm (½ in)
  • Typical price: Around $4
  • Supply voltage: 5V
  • Operating voltages: 3V or 5V (trigger), 5V all other I/O ports
  • Working current: 15mA
  • Operating range: 2 cm to 400 cm (1 in - 13 ft)
  • Claimed precision: 0.3cm, more realistically: 1cm
  • Measuring angle: 15 degrees

Principle of Operation

As described above, the main job of the HC-SR04 is adding ultrasonic distance measuring capabilities to projects. But how does that work? The principle, as well as the usage of the module, are both surprisingly simple.

The HC-SR04 gets triggered by a ten microsecond high signal on the trigger pin. Once it gets pulled low again, the module sends out eight 40kHz sound pulses. If an object is present in the detection range, the sound pulses get reflected by that object, and the module receives the echo. The time between sending the eight pulses and receiving the echo can be used to calculate the distance to the object that reflected the sound.


HCSR04_DH_MP_image2.png

HC-SR04 timing diagram. Image taken from product datasheet.

Checking how long the output pin of the module (usually labeled echo) is high calculates the measured distance. If it is high for longer than 30mS, no object was detected. Please refer to the datasheet of your module for the exact formulas. The recommended time between trigger pulses is 60mS.

HC-SR04 Datasheets

There are many HC-SR04 datasheets available on the internet. However, I found these to be the most helpful and the ones that contained the most information:

Projects That Use the HC-SR04

Final Thoughts

The HC-SR04 is a readily available, cheap, and easy to use ultrasonic proximity sensor module that can be used for a wide variety of projects. Due to its small physical size, it’s also useful for mobile applications, like robots.

Cover image courtesy of Banggood.com

Author

Avatar
Daniel Hertz

Hi! I am a software engineer and owner of nerdhut.de who loves to experiment with electronics, gadgets and tech in general.

Related Content

Categories

Comments


You May Also Like