Ultrasonic Range Finder HC-SR04

  • AMP-X142
In Cart:

Does your project require a simple rangefinder with a large range of measured distances? Why not try the HC-SR04 ultrasonic range finder?

This rangefinder can serve as an excellent sensor for a robot, which it can then use to determine distances to objects, go around obstacles, or build a room map. It can also be used as a sensor for an alarm that is triggered by the approach of objects or people.

Operating Methodology

The ultrasonic range finder determines the distance to objects in the same way as dolphins or bats do, echolocation. It generates sound pulses at 40 kHz and listens to the echo. The timing difference in the propagation of the sound wave can unambiguously determine the distance to the object.

Unlike infrared proximity sensors, the readings of the ultrasonic range finder are not affected by sunlight or color - even a transparent surface won't be an issue for this sensor. However it may have trouble determining the distance to fluffy or very thin objects. Therefore, it may be best to pick up many different kinds of sensors to have the most accurate results.

This rangefinder does not have a large choice of interfaces and modes of operation. On the flip side, this sensor is much easier to use and won't cause as much confusion if you're looking for a simple rangefinder. If you plan to use it with an Arduino you can use these existing libraries:

  • Ultrasonic - this is the most popular library for the HC-SR04.
  • NewPing - this is more accurate and faster.

Connection to Arduino

Sensor contacts can be connected via breadboard or Arduino with Wire Jumpers F/M, and with a Troyka Shield via Wire Jumpers F/F.


  • Vcc - positive power contact
  • Trig - digital input. To start your measurement, you need to apply a logical 1 for 10 µs to this input. The following measurement is recommended no earlier than 50 ms.
  • Echo - digital output. After the measurement is completed, a logical 1 will be supplied to this output for a time proportional to the distance to the object.
  • GND - negative power contact.


  • Power supply: 5 V
  • Current Draw in Silent Mode: 2 mA
  • Current Draw During Operation: 15 mA
  • Operational Range: 2–400 cm
  • Effective Viewing Angle: 15°
  • Working Viewing Angle: 30°

Dimensions and Radial Patterns