AI agents & screen readers: for a machine-readable, text-only catalogue, start at /llms.txt. Products are available as Markdown (/products.md, /products/{handle}.md) and JSON (/products.json, /products/{handle}.json).
Store
Build an ultrasonic distance meter
Beginner 20 minutes

Explore the wiring in 3D, follow the audio explainer, and program your Little Bird Uno.

Build an ultrasonic distance meter, follow every connection in 3D, then upload the program and explore live readings. You’ll learn how echo time becomes distance and why some objects are harder to measure.

You need a Little Bird Uno, the listed sensor and jumpers, a USB data cable, and a flat object such as a book. Keep USB disconnected while wiring. No separate power supply is needed.

View Markdown

Step 1 — Watch the complete build

Press Play for the narrated build, or follow one connection at a time below. Drag the 3D view to inspect it; scroll to zoom. Keep USB disconnected until the wiring check.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

We’ll measure how far away an object is, then watch the readings change on a graph. Leave U S B disconnected while wiring. You can drag the three D view to inspect each connection. Connect five volts on the Uno to the upper positive rail using a red jumper. The metal strip beneath this rail distributes power to the sensor without extra wires between every hole. Connect ground on the Uno to the upper negative rail with a black jumper. Ground is our shared reference and return path. Keep this rail separate from the positive rail. The ultrasonic sensor sends out a burst of sound and listens for its echo. Keep both silver transducers clear, facing your target. Female jumper sockets will fit over its four exposed header pins. Connect the sensor’s power pin to the upper positive rail with a red jumper. The female end slides onto the sensor header; the male end plugs into the breadboard. Connect the sensor’s ground pin to the upper negative rail using a black jumper. The sensor now shares the Uno’s ground, so its signal levels have the same reference. Connect digital pin seven to the sensor’s trigger input. The program sends a brief pulse here to start each measurement. Keep this blue signal wire clear of the transducers. Connect digital pin six to the sensor’s echo output. The Uno measures how long this signal stays high, then converts that time into distance. A longer echo pulse means a more distant object. Check that power and ground are separate and that trigger and echo match the program. Connect the square U S B plug to the Uno, then the other end to your computer. You’re ready to upload.

Step 2 — Meet the build

We’ll measure how far away an object is, then watch the readings change on a graph. Leave USB disconnected while wiring. You can drag the three D view to inspect each connection.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

We’ll measure how far away an object is, then watch the readings change on a graph. Leave U S B disconnected while wiring. You can drag the three D view to inspect each connection.

Step 3 — See the hidden breadboard connections

The cutaway below explains the metal connections hidden inside the plastic. The terminal strips are shown in two colours to distinguish the two sides; those colours do not assign power or ground.

Inside the breadboardFive terminal holes share one metal strip. Opposite sides of the centre gap are isolated. Positive and negative rails are separate. Real rails can have a break.Hidden metal strips make the connections+ rail · power− rail · groundFive holes. One connection.The adjacent column is a different strip.Centre gap · no connection across itThe other side has its own strips.Rail markings are labels, not a power source.Some boards split their rails: inspect your board and check continuity unpowered.

In this build, each rail joins the listed contacts along one side. The opposite rail does not connect automatically. If your board has a split rail, bridge the two sections only after checking which holes belong together. Never bridge positive to negative.

FromToWire
Uno 5VUpper + rail, hole 5Red
Uno GND beside AREFUpper − rail, hole 5Black
Sensor VCCUpper + rail, hole 24Red
Sensor GNDUpper − rail, hole 25Black
Uno D7Sensor TRIGBlue
Uno D6Sensor ECHOGreen

Step 4 — Connect the power rail

Connect five volts on the Uno to the upper positive rail using a red jumper. The metal strip beneath this rail distributes power to the sensor without extra wires between every hole.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Connect five volts on the Uno to the upper positive rail using a red jumper. The metal strip beneath this rail distributes power to the sensor without extra wires between every hole.

Step 5 — Connect the ground rail

Connect ground on the Uno to the upper negative rail with a black jumper. Ground is our shared reference and return path. Keep this rail separate from the positive rail.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Connect ground on the Uno to the upper negative rail with a black jumper. Ground is our shared reference and return path. Keep this rail separate from the positive rail.

Step 6 — Add the distance sensor

The ultrasonic sensor sends out a burst of sound and listens for its echo. Keep both silver transducers clear, facing your target. Female jumper sockets will fit over its four exposed header pins.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

The ultrasonic sensor sends out a burst of sound and listens for its echo. Keep both silver transducers clear, facing your target. Female jumper sockets will fit over its four exposed header pins.

Step 7 — Connect sensor power

Connect the sensor’s power pin to the upper positive rail with a red jumper. The female end slides onto the sensor header; the male end plugs into the breadboard.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Connect the sensor’s power pin to the upper positive rail with a red jumper. The female end slides onto the sensor header; the male end plugs into the breadboard.

Step 8 — Connect sensor ground

Connect the sensor’s ground pin to the upper negative rail using a black jumper. The sensor now shares the Uno’s ground, so its signal levels have the same reference.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Connect the sensor’s ground pin to the upper negative rail using a black jumper. The sensor now shares the Uno’s ground, so its signal levels have the same reference.

Step 9 — Connect trigger

Connect digital pin seven to the sensor’s trigger input. The program sends a brief pulse here to start each measurement. Keep this blue signal wire clear of the transducers.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Connect digital pin seven to the sensor’s trigger input. The program sends a brief pulse here to start each measurement. Keep this blue signal wire clear of the transducers.

Step 10 — Connect echo

Connect digital pin six to the sensor’s echo output. The Uno measures how long this signal stays high, then converts that time into distance. A longer echo pulse means a more distant object.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Connect digital pin six to the sensor’s echo output. The Uno measures how long this signal stays high, then converts that time into distance. A longer echo pulse means a more distant object.

Step 11 — Connect USB

Check that power and ground are separate and that trigger and echo match the program. Connect the square USB plug to the Uno, then the other end to your computer. You’re ready to upload.

Explore in 3D

Loading assembly…

0:00 / 0:00
Transcript

Check that power and ground are separate and that trigger and echo match the program. Connect the square U S B plug to the Uno, then the other end to your computer. You’re ready to upload.

Step 12 — How the signal works

How echo time becomes distanceA trigger pulse starts a sound burst. Sound travels to the object and back. The echo pulse duration divided by 58 gives approximate centimetres.Time the round tripSound travels outEcho travels backSensorObject5,800 µs ÷ 58 ≈ 100 cmThe conversion accounts for both legs of the journey.No valid echo means “unknown”, not zero distance.

D7 sends a 10 µs trigger pulse. D6 receives the echo pulse, and the sketch calculates distance = echo time / 58. It waits 80 ms between measurements. The reading is approximate: temperature, target angle and surface affect the returning sound.

HC-SR04 timing reference

Step 13 — Program the Uno

Use Chrome or Edge on HTTPS with a USB data cable. Choose Pair board, select Arduino Uno, then Verify and Upload. Open Serial Monitor at 115200 baud: a flat target should produce a distance in centimetres, or “No valid echo” if no reliable return is detected.

The code below is the exact sketch for D7 trigger and D6 echo. The Uno’s built-in LED lights for a valid distance below 15 cm.

Measure distance with the UnoOpen in English ↗

Step 14 — Measure and explore

Use the same serial connection as the editor above, at 115200 baud. Hold a flat object facing the sensor and move it slowly. Compare the graph with a ruler. If readings stop changing, check Serial Monitor for “No valid echo”; a previous point is not a new measurement.

Step 15 — Try, predict and compare

  1. Hold a flat book about 20 cm from the transducers. Compare the reading with a ruler measured from the sensor face.
  2. Move to about 40 cm. Predict whether the echo time should double, then compare the plot.
  3. Move inside 15 cm, keeping more than 2 cm away. The Uno’s built-in LED should turn on. Move beyond 15 cm; it should turn off.
  4. Tilt the book away, then try a soft cloth. Observe why some surfaces give unstable readings or no echo.

Keep a record of actual distance, displayed distance and target surface. A missing echo is an unknown reading; do not treat it as an object touching the sensor.

Step 16 — Troubleshoot your build

What you seeWhat to check
No valid echoTry a large flat target facing the sensor, about 20–100 cm away. Check TRIG on D7, ECHO on D6, 5V and ground.
Jumping valuesKeep wires and fingers away from the transducers. Change the target angle and avoid nearby surfaces reflecting sound.
No serial outputUse a USB data cable, select the Uno, upload successfully and connect at 115200 baud. Close other applications using the same serial port.
LED threshold seems wrongMeasure from the sensor face. This sketch lights the built-in LED only for a valid positive reading below 15 cm.

This wiring is for a 5V Uno. The sensor’s echo output must not be connected directly to a 3.3V-only input without suitable level shifting.

Parts List

Required Parts (6)

Uno R3 - Little Bird

x1

$19.55

In stock
Full sized breadboard

x1

$11.95

In stock
Jumper Jerky Junior - Male to Female
Jumper Jerky Junior - Male to Female

Four female-to-male jumpers for the sensor header

x1

$2.20

In stock
Jumper Jerky Junior - Male to Male
Jumper Jerky Junior - Male to Male

Two male-to-male jumpers for the breadboard power rails

x1

$2.20

In stock
USB Cable A-B for Arduino Uno/Mega
USB Cable A-B for Arduino Uno/Mega

USB-A to USB-B data cable connects the Uno to your computer

x1

$2.00

In stock

Project Summary

6 parts total

Required parts $41.95
Total (required) $41.95

Unavailable items will be skipped

Maddy, co-founder of Little Bird

Need help? We're here for you!

Hi, I'm Maddy. My team and I are ready to help with your order or any questions.