HC-SR04 Proximity Sensor

HC-SR04 is a low-cost but highly accurate proximity sensor that can be used as a stand-alone unit or as an integration to Arduino. Users can add this to their tech projects, while its concept is now being applied to next-generation systems, such as self-driving cars and obstacle avoidance systems on Raspberry Pi DIY robots!

How Does a Proximity Sensor Work?

The term “proximity sensor” is actually very broad. It refers to any sensor that can determine the “presence” of a target. A proximity sensor measures the distance from the unit without coming into contact with the target, which can range from things to even humans. 

Infrared radiation sensors can fall under proximity sensors. The only difference is the mechanism in which it identifies distance. 


There are several factors on how proximity sensors work:

  • A capacitive proximity sensor can detect the distance of any object that produces an electrical charge. It is commonly used in industries that need to measure levels of liquids.
  • An inductive proximity sensor is ideal for metallic objects since it uses the item’s electromagnetic field to determine its distance. If it doesn’t register any output, the sensor can suggest that the target is most likely non-metallic.

The HC-SR04 proximity sensor uses ultrasonic waves or SONAR (sound navigation and ranging). If this technology sounds familiar, it’s because it is the same one used by ships to measure the depth of waters and locate objects underneath oceans. SONAR also describes how bats and dolphins communicate.

How Does HR-SR04 Work?

The concept of echolocation, ultrasonic waves, or SONAR is simple. When an object is within a sensing distance, the sensor then releases sound waves or ultrasonic impulses. These sounds are usually above human hearing. You have to use special tools to hear it and monitor the frequencies.

The sensor then waits for the echo or the bouncing back of the sound. While doing so, it automatically calculates the elapsed time.

Benefits and Applications of HR-SR04

Proximity sensors have a variety of industrial applications:

  • A phone can include one to automatically control the screen display. For example, when it detects a person’s face or when an ear is near the device, the proximity sensor would then disable or shut down the display. This way, it prevents accidentally running applications in the background. It also helps save battery life. The most popular smartphones have this feature.
  • Proximity sensors can automate production lines. It can determine the distance of objects in the assembly, for instance.
  • Self-driving cars definitely need these types of sensors. Proximity sensors are the eyes of autonomous vehicles. It helps with the steering, lane centering, braking, and acceleration. In the near future, a self-driving car’s radars and cameras would “see” better than a human eyesight.


Features of HC-SR04 Proximity Sensor

  • Works at +5V DC
  • 3 cm resolution
  • Broad distance range between 2 cm and 400 cm
  • Effectual angle of less than 15 degrees
  • Measuring angle of 30 degrees
  • 45mm in length, 20mm in width, and 15mm in depth
  • Comes with four pins: VCC, echo, trigger, and ground
  • Possible integration with Arduino
  • Excellent accuracy at 3mm
  • Operating current at less than 15mA
  • Operating frequency at 40Hz

This article has only covered the basics and we hope it sheds some light on HC-SR04 distance and proximity sensor and its potential applications in the real world. Keep an eye on more related topics in the coming weeks. To buy this product or other related proximity sensors, use our manufacturer's part number tool at the top of this page for real-time price data and inventory availability. For bulk orders, go to our BoM Tool and upload your list for free! 

Oemsecrets.com is a search engine for electronic parts for hobbyists and professionals alike with over 120+ distributors and thousands of manufacturers, and a total inventory of over 30 million parts listed and updated every day.

Author: Sherly Mendoza
Published: March 15, 2021