- Module 6
Light Control with Light Sensor
Programming & Natural Sciences
Module Identity
TitleLight control with light sensorSubject AreasComputer Science Natural Sciences RoboticsFormatExperiential and exploratory learning; Small group work (3-5 students); Interaction with FOSSBot sensors and environmental variables.Preparation RequirementsFOSSBot connection to local network; Browser setup (Chrome/Firefox); Testing of light sensor functionality.Estimated Duration45 minutesAge Range13-14 years old (Lower Secondary)KeywordsAlgorithmic Thinking, Conditions, Repetitions, Sensors, Automation, Light/Dark Detection, Robot Behaviour.SummaryThis educational scenario bridges the gap between computer science and natural sciences by using educational robotics to detect environmental changes. Students focus on the FOSSBot's light sensor to guide the robot's behavior through the continuous alternation of light and darkness. By experimenting with varying light conditions, students observe how algorithms make decisions and adapt in real-time. The lesson emphasizes the distinction between different algorithmic repetition structures (loops) and connects visual feedback (LED colors) to system states, fostering a deeper understanding of automation.
Introduction
Automation relies heavily on a machine's ability to sense and react to its environment. In this lesson, students explore this concept using the FOSSBot's light sensor. The core challenge is to understand how a robot can "see" darkness or light and trigger specific actions, such as movement or visual signals.
Through a series of five activities, students progress from discussing everyday sensors to programming complex logic. They will implement conditional structures that allow the robot to decide when to turn, when to stop, and what color to display based on light intensity. This hands-on approach demystifies how automated systems—like streetlights or smart home devices—operate in the real world.Prerequisite Knowledge
- • Basic familiarity with visual programming environments (e.g., Scratch)
- • Understanding of basic programming concepts (loops and conditions)
- • Knowledge of what a sensor is and how it is used
- • Basic experience using FOSSBot
Learning Outcomes
By the end of this module, students will be able to:
Conceptual Understanding
- ✓ Connect environmental conditions (light/dark) with visual and kinetic behavior
- ✓ Interpret a robot's behavior based on sensor data
- ✓ Understand the use of conditions for decision-making by a robot
Programming & Implementation
- ✓ Use and program the FOSSBot light sensor
- ✓ Design and implement algorithmic repetition structures
- ✓ Distinguish between different types of repetitions (while/until) in the same algorithm
Engineering & Problem-Solving
- ✓ Enhance understanding of the relationship between sensors and automation
- ✓ Develop algorithmic and computational thinking through observation and reflection
- ✓ Connect LED colors to system states (e.g., Red for Dark/Warning)
📐 Key Logic & Control Concepts
Conditional Logic (If Dark/Light):
REPEAT WHILE (Is it dark?)
DO [Turn Right] [Set Color Red]The robot continues an action only while the condition (darkness) is true.
Loop Types Explained:
- • Repeat While: Runs as long as the condition is TRUE.
- • Repeat Until: Runs as long as the condition is FALSE (stops when it becomes true).
- • Repeat N Times: Runs for a specific number of counts (e.g., 10 times).
Students learn to switch the LED to Green when light is detected, indicating a "Normal Operation" status.


