Case 03: Artificial Light for Agriculture
4. Case 03: Artificial Light for Agriculture#
In order to improve the crop yield, we could take measures such as prolonging the lighting time, making rational close planting, adding the concentration of the CO2 and ect., here we can make an artificial light device to give enough light to crops automatically.
Detect the ambient light intensity with the micro:bit, and turn on the light automatically if the light intensity is too weak.
4.5. Hardware Connection#
Connect the rainbow LED to P1 port on IoT:bit.
4.6. Software Programming#
Click “Advanced” in the MakeCode to see more choices.
For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “neopixel” in the dialogue box to download it.
Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.
Drag the on start block from the drawer, initialize the strip connecting to P1 with 1 led.
Judge if the light level is below 100, if yes, program to light on; or turn it off.
Detect the ambient light intensity with the micro:bit, if the light intensity is too weak, turn on the light automatically ; or it turns off.