Which Robot Sensors Answer Which Question

Each robot sensor answers one question, so the fastest way to choose is to name the question first and then pick the sensor that answers it. Range sensors tell a robot how far away something is. An IMU tells it how its own body is moving, and a torque or force sensor tells it how hard it is pushing.

These readings feed the sense, decide, act loop described in our guide to the parts of a robot. That guide covers every component class across a whole machine, while the comparison below narrows the sensing step to four sensor types.

In our read of the Elecfreaks datasheet, we mapped each sensing question to the sensor that answers it and to the way that sensor most often fails. The failure-mode column is Bot Scout analysis. The ultrasonic figures come straight from the datasheet.

Range sensors fill the first two rows, an IMU fills the third and a torque sensor fills the fourth. A robot that crosses a room and also handles objects therefore needs at least three sensor types, because each one covers a gap the others leave open.

The HC-SR04 recommendation flips in four cases, and the datasheet itself defines each one.

Table note: Bot Scout analysis of four sensor types. HC-SR04 figures from the Elecfreaks datasheet, retrieved 2026-11-29.

  • The target covers less than 0.5 square meters or has an uneven face, which the datasheet warns will affect the measurement.
  • The object sits closer than 2 cm or farther than 4 m, outside the published minimum and maximum range.
  • The robot needs a fresh distance reading more often than the suggested measurement cycle of over 60 ms allows.
  • The robot needs the shape of a whole room rather than one distance inside a 15 degree cone, which is the job lidar does.
Question the robot asksSensor that answers itWhat it reportsTypical failure mode (Bot Scout analysis)Pick something else when
How far is the nearest object, close up and on a budget?Ultrasonic (HC-SR04)Echo time of an eight-cycle 40 kHz burst, converted to distance across 2 cm to 400 cm in a 15 degree conePoor readings on targets under 0.5 square meters or with uneven surfacesThe robot needs a room map, or the object is under 2 cm or beyond 4 m away
How far is everything around me, so I can map the room?LidarDistance to many points, measured with light, that the robot stitches into a mapHigher parts cost and more data to process than a single ultrasonic moduleThe robot only needs to stop before one obstacle straight ahead
How is my body moving and tilting?IMU (accelerometer plus gyroscope)Acceleration, direction of gravity and rotation rateDrift, because small errors add up when readings are summed over timeThe robot needs its position in a room over long periods, so pair it with range sensing
How hard am I pushing?Torque or force sensorTwisting load at a joint, or push and pull at a contact pointReports nothing until contact happensThe robot must avoid an object before touching it, so add a range sensor

How the HC-SR04 Ultrasonic Sensor Measures Distance

The HC-SR04 measures distance by timing an echo: it sends a burst of sound, waits for the reflection and reports the round-trip time as a pulse on its echo pin. The datasheet describes the module as ultrasonic transmitters, a receiver and a control circuit on one board measuring 45 by 20 by 15 mm.

The datasheet lays out the measurement in four steps.

Table note: HC-SR04 electrical and timing figures as printed in the Elecfreaks datasheet.

  • Hold the trigger pin high for at least 10 microseconds.
  • The module sends eight cycles of 40 kHz ultrasound and listens for a return signal.
  • If the sound comes back, the echo pin stays high for the time the sound took to travel out and back.
  • Convert that high-level time to distance with the datasheet formula.
ParameterDatasheet value
Working voltage5 V supply
Working current15 mA
Burst frequency40 kHz (parameter table prints 40Hz, text says 40 kHz)
Range2 cm to 400 cm
Measuring angle15 degrees
Trigger input10 microsecond pulse
Ranging accuracyCan reach 3 mm
Suggested measurement cycleOver 60 ms
Dimensions45 by 20 by 15 mm

Reading the HC-SR04 Datasheet Formula and Pins

The HC-SR04 datasheet gives the distance conversion two ways. Multiply the echo pin's high-level time by the speed of sound, which the datasheet lists as 340 m/s, and divide by 2, because the sound covers the distance twice. The shortcut is echo time in microseconds divided by 58 for centimeters, or divided by 148 for inches.

In our internal calculation from the datasheet formula, we worked out what a robot would see at three distances. The assumptions are the datasheet's 340 m/s speed of sound, the 2 cm to 400 cm range and the 60 ms measurement cycle it suggests. Echo time is distance times 2, divided by 340 m/s, and the datasheet's shortcut of 58 microseconds per centimeter lands within about 1.5 percent of it.

The counterexample comes from the same numbers. At the far end of the range the echo takes about 23.5 ms to return, so one reading fits inside a 60 ms cycle, but only about 16 or 17 readings are possible each second. A robot driving at 1 meter per second covers about 6 cm between those readings, and an obstacle that appears inside that gap is not seen until the next one. A robot that moves fast enough for that gap to matter needs a faster range sensor, which is where the lidar section below picks up.

One datasheet line needs care. Its parameter table prints the working frequency as 40Hz, while its own text twice describes a 40 kHz burst, so this page uses 40 kHz.

The module has four pins: 5 V supply, trigger input, echo output and ground. The datasheet advises against connecting the module to a powered circuit, and if it is connected that way, the ground pin should go on first so the module works normally.

The datasheet suggests a measurement cycle of over 60 ms so the next trigger does not run into the previous echo. A robot that polls the HC-SR04 faster than that risks mixing up readings, so a fast-moving robot may need a different range sensor.

The 3 mm accuracy figure is a best case. The datasheet ties good results to a target of at least 0.5 square meters with a surface as smooth as possible, so a small or rough object can read badly even inside the 2 cm to 400 cm window.

Our guide to Arduino robot kits covers the starter builds where readers meet the HC-SR04 in practice, wired to a board that sends the trigger pulse and times the echo.

Table note: Bot Scout calculation from the Elecfreaks HC-SR04 datasheet formula (340 m/s, distance x 2 / 340). Not a bench measurement.

ScenarioDistance to targetEcho time at 340 m/sDatasheet shortcut (58 microseconds per cm)What it means for a robot
Closest readable target2 cmAbout 118 microseconds116 microsecondsLower edge of the datasheet range. Anything nearer is outside the rated window.
Mid-range wall100 cm (1 m)About 5,882 microseconds5,800 microsecondsOne reading in well under a tenth of the 60 ms cycle the datasheet suggests.
Far edge of range400 cm (4 m)About 23,529 microseconds (23.5 ms)23,200 microsecondsEcho still fits the 60 ms cycle, which caps readings near 16 or 17 a second.

Lidar for Mapping and Obstacle Detection

Lidar measures distance with light, and it takes many readings across a wide view so a robot can build a picture of the space around it.

Coverage is the main gain over ultrasonic. The HC-SR04 returns one distance for whatever reflects first inside its 15 degree cone, and a single echo time carries no information about where in that cone the object sits. Lidar returns a distance for each point it scans, so the robot sees the outline of walls, doorways and obstacles.

A robot uses that point picture in two ways. For mapping, it stitches scans into a floor plan it can plan routes on. For obstacle detection, it checks the latest scan for anything new in its path.

Lidar costs more and asks more of the robot's computer. A lidar unit is a more complex part than one ultrasonic transmitter and receiver, and its stream of points needs more processing before the robot can act on it. For a robot that only needs to stop before bumping a wall, an ultrasonic module answers the question at lower cost.

Range, field of view and scan rate differ from one lidar model to the next, so this page gives no lidar figures. Those numbers belong to the datasheet of the exact unit a build uses.

IMU Robot Sensors for Balance and Motion

An IMU tells a robot how its own body is moving by combining an accelerometer and a gyroscope in one part.

The accelerometer measures changes in speed along each axis, and because it also senses the pull of gravity, it shows which way is down. The gyroscope measures how fast the body is turning.

Drift is the weak point of an IMU. To estimate how far it has turned or traveled, the robot adds up IMU readings over time, and every small error gets added too, so the estimate slowly wanders away from the true value.

Builders correct drift by checking the IMU against another sensor. Gravity gives the accelerometer a fixed reference for tilt, and a range sensor or a lidar map gives a fixed reference for position.

Legged robots depend on IMUs for balance. A humanoid robot standing on two legs, or one of the robot dogs on four, has to notice a tilt and correct it before it falls, and the IMU is the sensor that reports that tilt.

A wheeled robot on a flat floor relies on its IMU less, since it does not have to balance. It still uses one to track how far it has turned between range readings.

Torque and Force Sensors in Robot Arms and Hands

Torque and force sensors tell a robot how hard it is pushing, which is the one question range and motion sensors cannot answer once the robot touches something.

A torque sensor measures twisting load at a joint, and a force sensor measures push or pull at a point such as a wrist or fingertip. A small torque sensor at a joint lets an arm feel the load it is carrying. Without that reading, a gripper cannot tell a firm grip from one that crushes a soft object.

Force sensing also connects to safety. Industrial robot arms that read an unexpected jump in force at a joint can treat it as a collision and stop or back off instead of pushing through a person or object. That reaction depends on how the controller is programmed as well as on the sensor, so the arm maker's documentation is the place to confirm it.

Timing is the limit. A torque sensor reports nothing until contact happens, so a robot that must avoid an object before touching it pairs force sensing with a range sensor such as ultrasonic or lidar.

Who This Robot Sensors Guide Is Not For

A reader who needs a specific part number or a purchase quote should go straight to the maker's datasheet and a seller. Lidar, IMU and torque sensors differ by model, and this page quotes no prices for any of them.

Builders who already know they want an HC-SR04 can use the datasheet table above or open the Elecfreaks HC-SR04 datasheet directly.

Anyone choosing sensors for a safety-rated industrial cell needs the arm maker's documentation and the safety requirements that apply to that site. A sensor-by-question overview does not replace either one.

What Would Change Our Answer

Our sensor-by-question map would change if the datasheet behind it changed. A revised HC-SR04 datasheet, or a different module revision with other figures, would replace the 2 cm to 400 cm range and 15 degree angle used throughout this page.

A use case outside the four questions would also change it. A robot that must recognize what an object is, rather than how far away it sits or how hard it presses, needs a sensor type the table does not cover.

If a lower-cost range sensor reached lidar's coverage, the ultrasonic pick for budget distance sensing would weaken too, and the first two table rows would merge.

Bottom Line

Start from the question the robot must answer, then pick the sensor: ultrasonic for cheap close-range distance, lidar for mapping, an IMU for motion and a torque sensor for contact force. Based on our reading of the Elecfreaks datasheet, the HC-SR04 suits close-range distance on large, smooth targets between 2 cm and 400 cm. Pass on the HC-SR04 when targets are small, rough or outside that window, and move to lidar when the robot needs a map. Before buying robot sensors, write down the one question each must answer, then open the datasheet for the exact part before you design around it. Conditions: HC-SR04 figures are the Elecfreaks datasheet values captured 2026-11-29 and apply to that module. Lidar, IMU and torque sensors are described qualitatively with no numbers, and real parts differ by model.

Our Arduino robot kits buying guide covers the starter builds where readers meet the HC-SR04 ultrasonic sensor in practice. Browse Arduino Robot Kits.

FAQs

What is the range of the HC-SR04 ultrasonic sensor?

The Elecfreaks datasheet rates the HC-SR04 for 2 cm to 400 cm with a 15 degree measuring angle. Those limits assume a target of at least 0.5 square meters with a surface as smooth as possible. A small or rough object can return a poor reading even inside that window.

How accurate is an ultrasonic sensor on a robot?

The HC-SR04 datasheet says ranging accuracy can reach 3 mm, which is a best case. The same datasheet warns that small target areas and uneven surfaces affect the result. Other ultrasonic modules publish their own figures in their own datasheets.

What is the difference between lidar and an ultrasonic sensor?

Lidar measures distance with light across many points, while an ultrasonic sensor such as the HC-SR04 times one sound echo inside a cone. Ultrasonic tells a robot how far the nearest thing ahead is at low cost. Lidar tells it what the space around it looks like, which a robot needs to build a map.

What does an IMU sensor do on a robot?

An IMU reports how the robot's body is accelerating, tilting and turning. Its accelerometer senses changes in speed and the direction of gravity, and its gyroscope senses rotation. Legged robots use it to stay balanced, and wheeled robots use it to track turns.

Why do IMU readings drift over time?

IMU readings drift because the robot adds up small measurements to estimate angle or position, and each small error gets added along with them. Over time the estimate wanders from the true value. Robots correct it by comparing the IMU with a fixed reference such as gravity, a range sensor or a lidar map.

What makes some robot sensors cost more than others?

Sensor cost tracks how much the sensor measures and how much processing its output needs. The HC-SR04 datasheet describes one board with ultrasonic transmitters, a receiver and a control circuit that returns a single distance. A lidar unit that scans many points, or a torque sensor in each joint of an arm, is a more involved part with more data to handle.

Where do torque sensors go on a robot?

Torque sensors sit at the joints of robot arms, where they measure the twisting load each joint carries. Force sensors sit at points of contact such as a wrist or fingertip. Both tell the robot how hard it is pushing, so it can grip without crushing and stop when it hits something unexpected.

Primary Sources