Skip to main content

Case 06 Automatic Headlights


In this lesson, we will learn how to use cutebot pro and micro:bit to make an automatic car light. When the ambient light becomes dark, the headlights will automatically turn on, and when the ambient light is bright enough, the headlights will automatically turn off. This course will involve knowledge points such as light detection of micro:bit, RGB car light control and RGB three primary colors.

Teaching Objectives

Learn how the micro:bit detects the light intensity of the surrounding environment.

Learn about the photovoltaic effect.

Learn how to use micro:bit and cutebot pro to detect light and control LED lights.

Learn the concept of RGB primary colors and how to control RGB lights.

Teaching Preparation

Cutebot Pro × 1

micro:bit × 1

Teaching Process

Course Introduction

Hello everyone! Today we will continue our smart car production project, this time we will make a smart device that allows our Cutebot Pro to automatically turn on the lights when driving in a darker environment.

Inquiry Activities

What is the photovoltaic effect?

How is it used for light detection?

What are the three primary colors of RGB?

How to control RGB lights?

Sample Code

Tip: The light intensity threshold for turning on the lights needs to be adjusted according to the light intensity of the test environment.

Please refer to program link:

You can also download the program directly from the following web page.

Teamwork and Presentation

Students are divided into groups to complete the production and programming of the car together.

Students are encouraged to collaborate, communicate and share experiences with each other.

After each group completes, it presents its work to the class and accepts questions and suggestions from other groups.

Summary and Reflection

Review course content to remind students of what knowledge and skills they have acquired.

Guide students to discuss the problems and difficulties they encountered in the production process, and how to solve these problems.

Guide students to think about the optimization and improvement of automatic lights, such as adjusting the thresholds for turning on and off lights.

Outreach Activities

Encourage students to try to apply what they have learned to other scenarios at home, such as smart home systems.

Students are recommended to read advanced materials on the photovoltaic effect, coded motors, and RGB primary colors to improve their professional skills.