Microbit Robotics & Engineering Teacher Training
15 mins
+95 XP
What you need:
Chromebook/Laptop/PC
Microbit

Light Sensor

Explore the world of light sensors, understand their mechanism, and learn how they're used in robotics. Discover how a microbit senses light through code examples.
Learning Goals Learning Outcomes Teacher Notes

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Introduction to Light Sensors

    Light sensors are devices that detect and measure the intensity of light. They play a crucial role in robotics by enabling robots to perceive and react to their environment. In this lesson, you'll learn about the basics of light sensors and how they're employed in robotics.


    2 - Mechanism of Light Sensors

    Light sensors work by converting light energy into electrical signals. The most common type of light sensor is the photoresistor, which changes its resistance based on the amount of light it receives. When the light intensity increases, the resistance decreases, and vice versa. This change in resistance can be measured and used to determine the light levels in the environment.

    3 - Applications in Robotics

    Light sensors have multiple applications in robotics, such as:

    • Obstacle detection: Robots can use light sensors to detect obstacles and navigate around them.
    • Line following: Robots can follow a line on the ground by detecting the difference in light reflected from the line and the surrounding area.
    • Light tracking: Robots can track a light source, such as a flashlight or the sun, and move towards it.
    • Ambient light sensing: Robots can adjust their behavior based on the ambient light levels, such as turning on lights when it gets dark.

    4 - Microbit Light Sensing

    The microbit has a built-in light sensor that can be accessed through its LED display. Although it's not as accurate as a dedicated light sensor, it's still useful for basic light sensing applications.


    5 - Microbit Code Example

    Here's an example of how to use the microbit's built-in light sensor to display the light level on the LED matrix:

    basic.showNumber(input.lightLevel())

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more