How to Help Plants Get More Light? | DFRobot Science Lab

0 227 Easy


The shortage of sunlight often significantly slows down plant growth. In this lesson, students will discuss how to solve the problem of a lack of sunlight in a greenhouse during winter or rainy days. They will also try making an automatic light-fill device with a micro:bit to help plants grow better!



5-PS3-1 Use models to describe that the energy in animals’ food (used for body repair, growth, movement, and to maintain body warmth) was once from the sun.

3-LS3-2 Use evidence to support the explanation that traits can be influenced by the environment.

Connect Hardware

Connect the light-sensitive sensor to monitor changes in ambient light intensity. Split the signal using the splitter module into two branches: one for displaying data on the OLED display, and the other, through the expansion board, connects to the micro:bit for data reading. The micro:bit controls the ultra-bright LED, lighting it up according to variations in light.


1. Connect the light sensor to the input side of the mainboard.

2. Connect the splitter module to the output side of the mainboard.

3. Connect the 1st branch of the splitter to the OLED display.

4. Connect the 2nd branch of the splitter to the P0 pin of the expansion board.

5. Connect the ultra-bright LED to the P8 pin of the expansion board.

6. Insert the micro:bit into the expansion board and connect the USB cable.

7. Switch the OLED display mode to i4 Analog Data.

Start Programming

Go to the MakeCode editor to start writing code for the micro:bit:

Step 1: Define Insufficient Light Condition

Print out the sensor reading from the micro:bit P0 pin.

After uploading the code to your micro:bit, click on "Show data" below the simulator, you will observe the sensor data being read and the graph being drawn in the editor.

Cover the light sensor with your hand, and you'll notice the sensor reading dropping dramatically. Remember this value when the surroundings become dark, and use this number later to control the light, turning it on or off.

Step 2: Control the Light

We set a threshold based on the recently measured light value. If the light value exceeds the threshold, the light turns off; if it falls below the threshold, the light turns on to supplement the plants.

Use “if…else” in Logic to assess the intensity of light.

Use “digital write” to control the ultra-bright LED. In digital control mode, 1 represents ON, and 0 represents OFF.

While controlling the light, display icons of the sun and moon on the micro:bit LED matrix to indicate the current light conditions.

Sample Code:



Design the Structure

You can use cardboard or Lego to construct a structure for your plant light. This will enhance its ability to provide better supplementary light for your plants

All Rights