Skip to main content

Case 03 Dynamically adjust the light of the plant growth environment

Introduction

This course will introduce students to the use and programming of the 8-piece rainbow light ring device of the Octopus series and the programming method of the light sensor of the micro:bit V2. Students will use the 8-piece rainbow light ring to change the light of the plant growth environment, including light intensity and color, and use the micro:bit V2 to measure the light intensity of daylight.

Teaching objectives

  • Understand the connection and programming methods of the 8-piece rainbow light ring of the Octopus series.

  • Understand the programming method of the light sensor using the micro:bit V2.

Teaching preparation

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

PictureName
micro:bit
IOT:bit
3V Relay Module
3V Vertical Water Pump
8 Rainbow LED Light
Octopus Soil Moisture Sensor Brick
Octopus Light Sensor
Greenhouse Model
Double-sided Tape
Flat Screwdriver
PC
USB Cable
4P male to female Dupont line
5P female to female Dupont cable

These items will provide you with a complete experience, ensuring that you can smoothly carry out subsequent operations and learning. If you are ready for the above, we can proceed to the next step.

Teaching process

Course introduction

In the previous course, we obtained the temperature data and soil moisture data of the plant growth environment and clearly saw the changes in the data through the ThingSpeak platform. However, light is also one of the essential conditions for plant growth. Therefore, in this course, we will use the light sensor of micro:bit V2 to detect the light intensity of sunlight and use 8 rainbow light rings to change the light intensity and light color of plants.

Now, let's get started!

Exploration activities

  • How to control the color and light intensity of 8 rainbow light rings through programming?

  • How to use the light sensor of micro:bit V2 to measure the intensity of sunlight?

Assemble the smart greenhouse

Insert the micro:bit into the IOT:bit expansion board, apply traceless glue on the back of the IOT:bit expansion board, and fix it to the base of the greenhouse model, as shown below:

Place the 3V water pump and 3V relay as shown in the figure below:

Pour an appropriate amount of soil into the plant growth pool at the greenhouse base and place the seeds, and insert the soil moisture sensor into the soil.

Fix the 8 rainbow light rings to the top of the transparent cover.

Use traceless glue to stick the light sensor to the top of the transparent cover of the greenhouse model, as shown in the figure below.

Pass the connection wires of the soil moisture sensor, the connection wires of the 8 rainbow light rings, the connection wires of the light sensor, and the 3V water pump hose through the holes of the transparent outer cover of the greenhouse as shown in the figure below, and then lower it:

Connect the 3V water pump, 3V relay, soil moisture sensor, light sensor and 8 rainbow LED to the IOT:bit expansion board as shown in the following wiring diagram.

ComponentsIOT:bit corresponding pin
8 rainbow LEDP1
soil moisture sensorP2
light sensorP3
3V relayP9

Pour an appropriate amount of water into the water tank at the bottom of the greenhouse.

Connect the power supply to the IOT:bit expansion board using the USB cable, then turn on the power switch.

Coding

Add software library

Go to "makecode.microbit.org" and click "New Project".

Enter a project name in the pop-up window and click "Create".

In the opened programming interface, click "Extensions" in the programming block drawer.

After opening the extension page, enter "iot-environment-kit" in the search bar, click Search, and select the "iot-environment-kit" programming building block library in the search results.

After adding successfully, you can see "ESP8266_IoT, OLED, RTC1307, Octopus" in the programming block drawer column.

Similarly, you also need to add the official "neopixel" library file.

Similarly, you also need to add the official "neopixel" library file.

Sample Code

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

Download the program

Use a USB data cable to connect the computer and micro:bit V2.

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

Download the program

Use a USB data cable to connect the computer and micro:bit V2.

Click in the lower left corner and select Connect Device.

Click

Click

In the pop-up window, select "BBC micro:bit CMSIS-DAP", then select "Connect". At this point, our micro:bit has been successfully connected.

Click Downloader.

Teamwork and Presentation

Students are divided into groups to complete the installation and programming of the smart greenhouse.

Encourage students to cooperate, communicate and share experiences with each other.

Each group has the opportunity to show the smart greenhouse they made to other groups and demonstrate.

Expected effect: As the light intensity of the plant's surrounding environment changes, the 8 rainbow light rings emit light of different brightness and different colors.

Summary and reflection

Review the course content and remind students what knowledge and skills they have mastered.

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

Guide students to think about the optimization and improvement direction of the program, such as what interesting cases can be made using micro:bit.

Expand knowledge

Plant light adjustment: In the process of plant growth, light intensity and wavelength are very important environmental factors, which can directly affect the growth and development of plants. In order to make the plants grow best, the light intensity and wavelength need to be adjusted dynamically.

First of all, for light intensity, it needs to be adjusted according to the type and growth stage of the plant. Generally speaking, plants need stronger light intensity during their vigorous growth period to promote photosynthesis and accelerate plant growth. However, the light intensity cannot be too high, otherwise it will cause photoinhibition of plants and even cause plant death. Therefore, when adjusting the light intensity, it is necessary to decide according to the specific situation of the plant.

Secondly, in terms of wavelength, different plants have different requirements for the wavelength of light. Generally speaking, blue light and red light play an important role in the growth and development of plants. Blue light contributes to the morphological construction and photosynthesis of plants, while red light contributes to the growth and development of plants. Therefore, when adjusting the wavelength, different wavelength combinations need to be selected according to the specific needs of the plants.

In addition, in addition to adjusting the light intensity and wavelength, other environmental factors such as light time and temperature should also be paid attention to. The length of light time will also affect the growth and development of plants, and the temperature will also affect the photosynthesis and respiration of plants. Therefore, while adjusting the light intensity and wavelength, other environmental factors also need to be reasonably controlled.

In summary, in order to achieve the best growth of plants, it is necessary to dynamically adjust the light intensity and wavelength, as well as other related environmental factors. The specific adjustment method needs to be determined according to the type and growth stage of the plant.