Sensors

Module 3: Sensors

Sensors are what allow a robot to interact with its environment. Without sensors, a robot simply executes a fixed sequence of actions. With sensors, it can respond, adapt, and make decisions.

Over time, I’ve found that the order in which sensors are introduced makes a big difference in how well students understand them. Some sensors are very intuitive, while others require more abstraction.

The order I like to teach sensors is:

  • Touch Sensor
  • Color Sensor
  • Distance (Ultrasonic) Sensor
  • Gyro Sensor

This progression moves from simple and concrete → more abstract and powerful, while also preparing students for control systems later.

Touch Sensor

The touch sensor is the simplest and most intuitive sensor. It detects whether it is being pressed or not pressed.

This makes it a great starting point because students can immediately understand what is happening — there is a clear physical action and a clear response.

When introducing the touch sensor, I focus on building the idea that:

  • the robot is waiting for an input
  • and then responding to it

     

Task 1: Press to Move

Program the robot so that it moves forward only while the touch sensor is pressed, and stops when it is released.

Task 2: Bumper Robot

Make the robot drive forward until it hits an object, then reverse.

Task 3: Toggle Control

Use the sensor to toggle behavior — press once to start moving, press again to stop.

These tasks build a clear connection between input → action, without adding complexity.

Color Sensor

Once students are comfortable with basic input/output behavior, I introduce the color sensor.

This is usually the first time students deal with continuous or variable data, rather than a simple pressed/not pressed state. The sensor can detect different colors or measure light intensity, which makes it more powerful but also slightly harder to reason about.

At this stage, I avoid jumping straight into line following. Instead, I focus on helping students understand how the sensor behaves.

Task 1: Explore Readings

Display the sensor’s value on the screen and move it over different surfaces. Observe how readings change with:

  • color
  • distance from the surface
  • lighting conditions

Task 2: Color Reaction

Place different colored patches on the ground and program the robot to perform a different action for each color.

Task 3: Stop on Color

Program the robot to move forward and stop when it detects a specific color.


Key insight: Sensor readings are never perfect. They vary depending on lighting, distance, and surface. Students should begin thinking in terms of ranges and thresholds, not exact values.

Distance (Ultrasonic) Sensor

Next, I introduce the distance sensor, which measures how far the robot is from an object. This is the first sensor where students start working with spatial awareness — the robot is no longer just reacting to contact or color, but to its position relative to the environment.

I personally don’t usually recommend my students use this sensor for actual WRO RoboMission tasks, because it’s often less precise and less practical than other sensors. However, teaching it at this stage is extremely valuable, as it helps students develop a conceptual understanding of distances, positioning, and environmental awareness, which becomes important later when thinking about navigation and control systems.

 

Task 1: Stop Before Collision

Program the robot to drive forward and stop when it gets close to a wall.

Task 2: Maintain Distance

Make the robot stay a fixed distance away from an object.

Task 3: Gradual Control

Program the robot to slow down as it approaches an object, instead of stopping suddenly.

 

These tasks introduce the idea that sensor values can be used not just for discrete decisions (stop/go), but also for gradual control (e.g., adjusting speed based on distance).

Students also begin to notice that readings can be noisy or inconsistent, which is a useful lead-in to later discussions on control systems.

Gyro Sensor

The gyro sensor is usually the most difficult for students to understand, because it measures something that is not directly visible: rotation and orientation.

Unlike the other sensors, you cannot “see” what the gyro is measuring without interpreting the data. This makes it more abstract, but also extremely powerful.

Before I even introduce the gyro sensor, I like to first give students a challenge:
make the robot turn exactly 90 degrees using only timing or motor commands.

At first, this seems straightforward, but students quickly run into problems. What looks like a 90-degree turn is often slightly off — maybe 88 or 89 degrees. When they repeat the same movement multiple times, these small errors begin to accumulate, and the robot ends up facing completely the wrong direction.

This is an important moment, because students experience firsthand that:

  • small inaccuracies matter
  • repeated actions amplify errors
  • open-loop control (no feedback) is unreliable

Once they’ve struggled with this, the gyro sensor becomes much more meaningful.

When introducing the gyro, I focus on building intuition step by step:

  • Display the angle reading on the screen and have students rotate the robot by hand
  • Program the robot to turn exactly 90 degrees using the gyro
  • Compare this to their earlier attempts and observe the improvement in consistency

This helps students see that the gyro is not just another sensor — it provides feedback that allows for precise and repeatable movement.

Understanding this idea is a key step toward more advanced control systems, where the robot continuously corrects its motion based on sensor input.

Key Takeaways

Across all sensors, there are a few important ideas to keep in mind:

  • Sensors provide imperfect, noisy data
  • Programs should rely on ranges and conditions, not exact values
  • Robots operate using continuous feedback, not one-time decisions

 

Sensor Table:

Below I have summarised my insights on the various sensors, their functions, and their use cases in WRO RoboMission:

SensorFunction / ModeDescriptionExample Use in WRO RoboMissionNotes / Limitations
Touch SensorPressed / ReleasedDetects whether the sensor is being pressedStop robot when it hits a wall, act as a bumperSimple, very reliable, essential for beginners
Color SensorReflected LightMeasures the intensity of light reflected from a surfaceDetect lines, measure color-coded zonesHighly useful; readings vary with lighting conditions
Color SensorAmbient LightMeasures overall light levelDetect changes in lighting that might affect other sensorsLess commonly used in RoboMission tasks
Color SensorColor DetectionDetects specific colorsIdentify colored objects or zonesGood for tasks requiring object or zone differentiation
Color SensorRGB RawReturns separate red, green, blue valuesAdvanced tasks: custom color detection, fine-tuning thresholdsMore advanced; may be unnecessary for basic RoboMission
Gyro SensorAngleMeasures robot rotation in degreesPrecise turns, maintain orientation on fieldVery useful for accurate navigation
Gyro SensorRateMeasures rotational speedDetect spinning, feedback for control systemsLess commonly used for basic tasks (advanced technique used by top teams for smooth turning)
Ultrasonic SensorDistanceMeasures distance to objects in cm or inchesAvoid collisions, measure distance to walls or obstaclesCan be inaccurate at short distances or for small objects; limited use in RoboMission
IR SensorProximityMeasures approximate distance to objectRarely used in RoboMissionNot very accurate; mostly for experiments
IR SensorBeacon SeekDetects direction and distance to an IR beaconCould be used in custom tasks if allowedUsually irrelevant in standard RoboMission tasks
IR SensorRemoteReads signals from IR remoteRarely usedVery limited use in RoboMission

In the next module, we will begin combining motors and sensors through programming, starting with how to control movement and read sensor data effectively.