A little curiosity. A whole lot of making.Robotics, CNC & connected ideas
robodatech.
← Learning library
Sensors

Help your robot understand its surroundings.

Distance, motion, position, and vision sensors turn physical events into useful measurements. Learn what each can tell you—and what it cannot.

SENSORTargetTransmitReturnMeasure a round tripdistance = speed × time ÷ 2
Concept illustration. Check the component datasheet before wiring.
Try it yourself

Change an input.
See what follows.

A simplified learning model. Values describe the model, not a connected robot.

A sensor reading is a measurement with uncertainty.

Every reading has units, a timestamp, a useful operating range, and possible errors. Before using it to command motion, check whether it is valid and fresh. A missing ultrasonic echo is an unknown distance, not proof of an empty path. Filtering can reduce noise, but adds delay; a smooth old reading can be less useful than a noisy fresh one.

Choose by the quantity you need

SensorMeasuresApplicationLimitation
UltrasonicSound travel timeLow-cost obstacle distanceAngled or soft surfaces may lose the echo. Temperature changes sound speed.
Multizone ToF: VL53L8CXOptical distance in up to 8 × 8 zonesNear-field obstacle maps and occupancyRead status and confidence; ambient light, cover glass, and targets affect useful range.
IMU: BMI270 exampleAcceleration and angular rateTilt estimation and short-term motion trackingGyro bias drifts when integrated. Acceleration contains gravity and motion.
Wheel encoderShaft increments and directionSpeed feedback and odometryWheel slip changes real travel without changing encoder counts.
CameraImage intensity and colorInspection and visual landmarksLighting, calibration, processing delay, and privacy matter.

Read an 8 × 8 depth sensor

A depth map, not a photograph8 × 8 zonesNear: darkerFar: lighterIllustrative data
Illustrative depth cells; this is not a live sensor feed.

The VL53L8CX provides multiple distance zones rather than a conventional image. Transform zone directions into your robot frame, reject invalid zones, and group nearby returns. Do not interpret every low-confidence cell as a free path.

Build a trustworthy measurement pipeline

1 · Calibrate

Measure known targets at several distances. Record bias and repeatability; mount the sensor rigidly and repeat the test after moving it.

2 · Validate

Store value, units, timestamp, and quality together. Reject impossible jumps and stale samples before passing them to the motion controller.

3 · Combine

Use wheel encoders for fast local motion and another sensor for correction. Correlated measurements can share the same error; more sensors do not automatically mean better estimates.

Try a distance experiment

At approximately 20°C, use a sound speed of 343 m/s. A 40 cm target produces a round trip of about 2,332 µs. The simulation divides round-trip time by two. Compare a flat board with fabric and an angled surface, and record failed readings instead of replacing them with zero.

For an HC-SR04, check the exact module requirements. Its usual 5 V echo output needs appropriate level shifting before a 3.3 V GPIO.

Go to the source

Manufacturer and project documentation. Reviewed 20 September 2026; check your exact board revision and software release.

Keep building

Good ideas start here.

Free robotics lessons, CNC build notes and product updates. Confirm your email to join. Unsubscribe anytime.