Soil Moisture
Overview
In this lesson, students will combine external inputs and outputs to create a plant moisture control system. Students will combine knowledge gained from the control lessons to convert an analog value into a percentage value as well as programming LED outputs.
Aims
- Understand how a control system works.
- Learn how to convert an analog value into a percentage value using the ‘map’ function in MkakeCode.
Download the Code
MakeCode Editor
Click the button below to download the MakeCode editor code for this lesson. The hex file is contained in a zip folder.
Kindly refer to our download the code page for instructions on how to upload your code onto the micro:bit. Please use instructions set A.
This code can also be uploaded into the MakeCode editor.
Kit Required
Micro:bit
Innovation Board
LED Red/Green
Moisture Sensor
- Micro USB Cable
- 1 x House Plant
- 2 x Connector Cables
Preparation
- Connect the micro:bit to the Innovation board via the edge connector.
- Use the connector cables to connect the moisture sensor to the ADC1 connector on the Innovation board and the LED to ADC2.
- Connect the micro:bit to a computer via the microUSB cable.
- Go to the MakeCode website on your computer and open a new project.
Time to Code
What Will Happen
The micro:bit will continually monitor the moisture level of the soil that the moisture sensor is inserted into. If the moisture level drops below 50% the red LED will light up alerting that the plant needs to be watered.
Button A can be pressed at anytime to view the current moisture level of the soil.
Taking it Further
- Design a casing for the soil moisture sensor.
- Investigate how to turn this into a fully autonomous system using a water pump controlled by the micro:bit.
Keep in touch
We would love to keep you up to date with all of our latest news, offers and new products.
If you would like to subscribe to our mailing list please click the button below.
Contact Us
ScienceScope Limited
Downside School
Stratton-on-the-Fosse
Radstock
BA3 4RJ
enquiries@sciencescope.uk