AI Lab for the Internet of Things

From sensors to intelligent self-deciding systems: lessons, projects, architectures, interactive simulation labs and a specialist AIoT assistant.

20Lesson

HC-SR04 ultrasonic

An ultrasonic sensor that measures distance by the round-trip time of a sound wave.

BeginnerMotion and vibration

Illustration of HC-SR04 ultrasonic
A schematic illustration created for this section for teaching purposes; it is not a photograph of the part or of any specific product.

Educational content in scientific-draft form; a specialist should review it before it is adopted as an academic reference. No measurement or performance result that was not actually obtained is shown here.

Facts

Measured quantityDistance to an object
Data typeDigital (pulse time)
Units of measurementcm
Examples of common partsHC-SR04

How it works

It sends an ultrasonic pulse and measures the echo's return time, then the distance is computed from the speed of sound.

How to connect

A trigger pin and an echo pin with power and ground; watch the echo voltage level with 3.3-volt microcontrollers.

AIoT applications

  • Measuring a tank's level
  • Avoiding obstacles

Measurement and calibration issues

  • Affected by air temperature
  • Absorbent or slanted surfaces give wrong readings

Simulations and labs run inside your browser. Nothing you enter and none of the conversations is stored on the server. Privacy policy