srSARVODAY
ROBOTICS
← All field guides

THE BIG IDEA

How do robots work? Sense, decide, act.

Understand the connection between sensors, a program, and movement—with a simple stopping-distance experiment.

A useful way to understand a programmable robot is a loop: it receives information, follows instructions, and produces an action. In a mobile robot, that might mean measuring distance, comparing it with a threshold, and changing motor speed. Many robots repeat this loop as their surroundings change.

1. Sense: turn the world into a reading

A sensor measures something. A distance sensor may report how far away a surface appears to be. A light sensor responds to light. A button reports whether it is pressed. These readings are inputs; they do not tell the robot what to do on their own.

Readings also have limits. The shape, angle, and material of an object can affect a sensor. Before writing a complicated behavior, display the reading and move a simple object in front of it. Compare what the screen reports with what you expect.

2. Decide: follow a rule

A program connects an input to an action. Consider this simplified rule:

repeat:
  read distance
  if distance < 20 cm:
    stop
  else:
    move slowly

This is pseudocode, not a program to paste into a specific robot. The rule uses a threshold of 20 centimeters. That number is a choice made by the programmer. It is not a property all robots share, nor a guaranteed safe braking distance.

3. Act: make something happen

Motors can turn wheels or move an arm. A light or speaker can provide feedback. These are outputs. The robot needs a suitable power source and physical connections as well as a program. Correct instructions will not move a disconnected motor.

4. Repeat: respond to change

A single reading is only a snapshot. Repeating the measurement lets the robot notice that an obstacle has moved. The time between readings, the robot’s speed, and its stopping behavior all matter in a real machine. Our homepage demo deliberately simplifies these effects so you can concentrate on the decision rule.

A tabletop-free experiment

Use the interactive sensor lab before connecting hardware. Set the obstacle distance above 20 centimeters, then below it. Predict which branch of the rule will run. Finally set it to exactly 20: the example uses “less than,” so equality takes the other branch.

On physical hardware, start slowly in a clear floor area. Observe the distance reading while the robot is stationary first. Use a broad cardboard obstacle and keep an adult ready to stop the robot. A simulated condition does not validate physical stopping performance.

Does a robot need AI?

No. A useful robot can follow explicit rules without a machine-learning model. AI becomes relevant when a task benefits from learned patterns, such as interpreting images. Learning the basic input–program–output relationship makes it easier to understand what an AI component adds later.

For a concrete educational controller, the micro:bit Foundation’s feature overview describes buttons, sensors, a processor, and outputs. For a next activity, try our mBot2 challenge ideas.

KEEP EXPLORING

Find your next field guide ↗