Light Sensor and Robot Behaviour

This lesson introduces students to light sensors and their importance in allowing robots to perceive and react to light. Students will learn how to connect light sensors, program them using word blocks, and create robot behaviours based on varying light levels.

Materials required

  • Lesson slides
  • Otto Starter robots
  • Light sensor from Sense Expansion
  • Computers with internet and Bluetooth connection

Optional materials

  • Lesson worksheets 

Learning Objectives

  • Identify environmental sensors (temperature, humidity, light) and/or interactive sensors (microphone, tilt) and their roles in robotics.
  • Recognize real-world applications of sensors in robotics (e.g., smart devices, environmental monitoring, assistive technologies).
  • Write and upload programs to read data from environmental and/or interactive sensors.
  • Modify robot actions based on environmental data.

  • Debug programs to resolve sensor inaccuracies or unexpected behaviours.
  • Refine robot responses through testing and user feedback.
  • Propose creative improvements or new applications for sensor integration in robotics.

Why are light sensors important for robot-environment interaction?

Discuss with students how light sensors help robots “see” light and adjust their behaviour accordingly (slide #3). Draw real-world parallels, such as automatic lighting systems that turn on in the dark or robots that avoid direct sunlight to protect their components.

Explain the importance of programming in making these sensor-driven decisions possible and introduce light sensors as a way for robots to interact with their surroundings based on light levels.

Light sensors help robots “see” by detecting ambient light levels, allowing them to adjust their behaviour accordingly. Just as automatic lighting systems turn on when it gets dark, robots can use light sensors to make decisions—like moving towards or away from light sources or protecting sensitive components by avoiding direct sunlight. These sensors allow robots to interact intelligently with their surroundings, but programming is essential to interpret the sensor data and trigger specific actions based on the light detected. Through programming, robots can be instructed to react in ways that mimic real-world behaviours, such as navigating based on brightness or optimizing energy use.

Understanding Light Sensors

⚠️Important: the blocks to use the Sense Expansion are not added by default to Word Blocks app, you must add them by:

  1. Click the configuration icon
  2. Click the option: 🤖 select Otto kit
  3. Click the option: Expansion sense

The app will reload and there will be new blocks added to the Sensing section in the software.

Introduce the light sensor as a key component for detecting light intensity (slide #4). 

Short explanations

Light sensors help robots “see” light by detecting the amount of light in their environment and converting it into electrical signals. These signals allow the robot to adjust its behaviour based on the detected light levels. For instance, a robot with a light sensor might stop moving when it detects too much sunlight to prevent its components from overheating or turn on an LED when it’s in a dark area, similar to how automatic lighting systems work in real life.

⚠️ Important: Show students how to connect the sensors to their circuit boards. Guide them through the wiring process (slide #5).

Once the sensor is connected, explain how light is measured in terms of intensity, and how these measurements can be translated into behaviours for the robot. For example, if the sensor detects a high value (bright light), the robot could be programmed to move away from the light source to protect its components. Alternatively, if the sensor detects a low value (dim light), the robot could be instructed to move toward the light source or activate its own lights.

Activity: Attaching the Light Sensor and Testing

Have students follow along as you demonstrate how to code their robot to detect and display light intensity using word blocks (slide #6).

  • Guide students to write code that reads the light sensor’s data and displays it on the serial monitor.

This code continuously monitors and displays readings from a light sensor. It runs in an infinite loop, printing lines of equal signs to separate each reading for easier viewing. After each separator line, it prints the label “Light value:” followed by the current value from the light sensor (in the connector 7). The program waits for 1 second between each reading, ensuring that the light levels are updated in real-time. This setup allows you to view how the light sensor’s data changes over time in a neatly formatted way on the serial monitor.

Activity: Light Seekers and Avoiders Challenge

In this activity (slide #7), students will work in pairs to program their robots with contrasting behaviours—one robot will be coded to seek light, while the other will avoid it. Both robots must use movement, sounds, and light effects to demonstrate their behaviour.

  • Light Seeker: This robot will move toward brighter areas. As it approaches the light, it can flash its color lights in bright colors, such as green or blue, and play a happy sound when it reaches a high light intensity (close to 100%).

  • Light Avoider: This robot will move away from bright light sources. When it detects higher light levels, it will flash its color lights in warning colors like red or yellow, and emit a sound to indicate it is moving away.

Encourage students to experiment with light thresholds, deciding at what value their robots should change direction or behaviour. Both robots should integrate movement with servo motors, light effects using the color lights, and sound cues using the robot’s buzzer.

At the end of the activity, pairs can compare how each robot reacts to light, refining their code to improve their robots’ light-seeking or avoiding behaviours.

Lesson Evaluation

  • Students actively participate in class discussions and hands-on activities.
  • Students correctly connect and program the light sensor to detect light levels.
  • Students demonstrate understanding of how to code the robot to respond to varying light levels and can explain their robot’s behaviour based on sensor input.

The duration of this lesson is approximately one hour. You can find the definition of learning objectives at the bottom of this guide to align with your curriculum requirements.

Materials required

  • Lesson slides
  • Lesson worksheets
  • TV, projector, or big screen to display the class videos
  • Big paper or cardboard (white)
  • Tape (black)
  • Scissors

Computers, tablets or smartphones are optional, they can be used as digital tools for students to do further research and take additional notes.

Connect

The class begins by displaying the first slide and asking the students “What do you see here?’“
[Pause and wait for students to provide answers, which may include mentions of a robot arm and two wheeled robots moving boxes].

The teacher will then guide the class in a conversation about the nature of robots, exploring questions such as: ‘What is a robot?’ ‘When does something turn into a robot and when is it just a machine?’

Moving on to the second slide, the teacher will introduce the topic of the usefulness of robots to humans. Students should share their ideas about how robots can be useful.

[This conversation is expected to last approximately 4-5 minutes]
Afterwards, on the third slide, the students will watch a video that explains the concept of what a robot is. Following the video, they will have the opportunity to share their personal experiences with robots. The teacher can guide the conversation by asking specific questions, such as: ‘Have you ever played with a robot or built one?’ ‘Do you have any robotic devices at home, like a vacuum cleaner, that you consider to be a robot?’

[The video has a duration of 4 minutes, and the discussion about personal experiences is expected to take an additional 3-5 minutes]

On the next slide, the teacher will organize small groups consisting of 2-3 students. Each group will be assigned a specific robot to investigate. The students can conduct their investigation by using the internet or through provided materials, either digital or physical. Some popular real-life robots for the students to explore are:

As a teacher, feel free to research other robots to add to the list. By the time you teach this lesson, there could be some new and popular robots.

During this activity, students will gather information about their assigned robot and gain knowledge about how robots are being utilized in daily life. At the end of the investigation, each group will give a brief presentation about the robot they investigated.

Here the students will use the first worksheet

[This activity is expected to take approximately 10-15 minutes in total, allowing sufficient time for research and presentations]

Make

On the fifth slide, the teacher will introduce the HP Otto robot by showing a video about its features and capabilities. After watching the video, the teacher will demonstrate a built robot to the students, showcasing its physical components and explaining how they contribute to its functionality.

[To further engage the students, the teacher can connect the robot to the Otto web control app, demonstrating how to operate and control the robot using the app’s interface.]

On the next slide, a diagram displaying the internal connections of the robot will be shown. Using the web control app, the teacher will demonstrate how each component of the robot works.

To engage the students, the teacher can actively involve them in the activity. For example:

  • Buzzer: The teacher can play various sounds available on the app and ask students to suggest or choose which sound they would like to hear.
  • LED ring: The teacher can ask students (up to a maximum of 12) about their favorite colors and display them on the LED ring.
  • Ultrasonic sensor: The teacher can activate the avoidance function and make the robot move around the classroom. Students can participate by intercepting the robot’s path with their hands, observing how the robot changes its direction in response.
  • Line sensors: Although the line tracking activity will be conducted later, the teacher can explain how the infrared sensors work at this stage.

In the next activity, the entire group will work together to define a racing track circuit for the robot to navigate. The teacher will guide the students in this process, but it is important to allow the students to make the decisions in order to foster their creativity and engagement. The goal is to define a circuit that includes specific landmarks or areas within the classroom for the robot to move around.

For example, the students may decide to start the circuit in front of the teacher’s desk, then describe a square around James’ seat, move in a zigzag pattern between Eva and Raidy’s seats, and finally return to the teacher’s desk. [To maintain efficiency, the teacher should encourage the students to make quick decisions, aiming to complete the circuit definition within 1-2 minutes]

[Optional]: As an additional challenge, the teacher can allow students to take turns controlling the robot and measure their individual completion times. This can add an element of friendly competition among the students.

The next activity is similar to the previous one, but this time the students will create a line track using ‘tape’ on a large white piece of paper or cardboard.

Lorem ipsum

Scroll to Top
This will be available with the release of this product.