All packs

Sensors

Ultrasonic tape measure

Point it at a wall and read the distance in centimetres, without touching anything.

  • Easy
  • about 40 min
  • ESP32-S3
  • 6 parts
  • 8 wires
  • 61 lines of code

ESP32 packs are built on real parts: the simulator runs Arduino Uno circuits only.

Idea

It sends a click too high to hear and times the echo. Sound covers a centimetre in about 29 millionths of a second, so the sketch has to time very short moments precisely.

What you learn

Timing a pulse with pulseIn(), turning a time into a distance, and averaging readings.

How it works

  1. input

    HC-SR04 (3.3 V)

  2. decides

    ESP32-S3

  3. output

    OLED 0.96 in

Powered with 5 V through the board's USB-C port.

A reference design. The sketch is compiled with the real ESP32 toolchain, and its pins are checked against the wiring table automatically. It has not yet been built and tested on real parts by us, so wire it on the bench and run the checks before you build it into a case. Real modules vary: follow the labels printed on yours, not their position in the picture.