Skip to main content

Case 09: Automatic headlights

Introduction

This course aims to guide students to create a case of automatic headlights, combining the functions of micro:bit to create cases.

Teaching objectives

Combining the functions of micro:bit to achieve more extended cases

Teaching preparation

Before starting teaching, please make sure you have prepared the following necessary materials:

PictureNameNumberNote
TPbot Edu1
USB Cable1
micro:bit1Prepare Yourself
PC1Prepare Yourself

Course Introduction

Hello everyone! In this course, we will explore a very practical project - an automatic car light system. Imagine that when your car is driving in a well-lit environment, the lights are off; but when it enters a darker area, such as a tunnel or at night, the lights will automatically light up to ensure driving safety and visibility. In this class, we will learn how to make the car have this intelligent behavior.

Exploration Activities

What are the applications of light sensors in life?

Software

Microsoft MakeCode

Programming

Click Advanced in the code drawer of MakeCode to view more code options.

In order to program TPbot Edu, we need to add an extension library. Find Extensions at the bottom of the code drawer and click it. A dialog box will pop up, search for tpbot, and then click to download this code library.

Sample Program

Program

Please refer to the program link: https://makecode.microbit.org/_dM7hMu0W5iKe

You can also download the program directly from the following website.

Conclusion

After turning on the power, the car moves forward, and the lights will automatically turn on when the car drives to a dark place.

Extended knowledge

Application of light sensors in life Light sensors, also known as photosensors, are devices that can detect the intensity of ambient light. They play an important role in many daily applications. Here are some examples of light sensors in life:

  1. Automatic dimming lamps Light sensors can be used to automatically adjust the brightness of indoor or outdoor lights. Reducing the brightness of the light when the light is sufficient and increasing the brightness when the environment is dark not only improves energy efficiency but also improves comfort.

  2. Smartphones and computers Modern smartphones and computer screens automatically adjust the screen brightness according to the brightness of the surrounding environment to provide better visual effects and reduce power consumption.

  3. Street lights and street lights In many cities, street lights and street lights are equipped with light sensors so that they can automatically turn on after sunset and turn off at dawn, saving energy and improving public safety.

  4. Cameras and Photography In photography and video equipment, light sensors help automatically adjust exposure and white balance to adapt to different lighting conditions and ensure image quality.

  5. Agriculture In modern agriculture, light sensors are used to monitor the light conditions for plant growth and automatically adjust the light intensity in greenhouses to promote healthy plant growth.

  6. Environmental Monitoring Light sensors are used to monitor light levels in different environments, which is very important for studying light pollution, urban planning, and wildlife protection.

  7. Security Systems In security monitoring systems, light sensors can trigger motion-sensitive lights or cameras, which automatically activate when light changes or movement are detected to enhance security.

  8. Smart Homes In smart home systems, light sensors are linked to other smart devices, such as automatic curtains, smart blinds, etc., which automatically adjust according to light intensity to optimize the living environment.

  9. Cars In cars, light sensors are used to automatically adjust the brightness of interior lights and dashboards, as well as activate or turn off headlights to improve driving safety.

  10. Wearable devices In some smart watches and fitness trackers, light sensors are used to adjust the brightness of the display screen under different lighting conditions for easier reading by users.

Light sensors are widely used. They provide information about the ambient light level to help various devices and systems automatically adapt to environmental changes, improve efficiency and user experience.