Soil moisture experiment video
Watch this video about to see how to conduct a soil moisture experiment for plants.
This project will use 2 pins on the micro:bit to measure the voltage between the 3V pin and the pin 0 as the current travels through the soil. Wires or alligator clips are used to connect to the micro:bit. In the soil nails or larger wires are used as probes in the soil. The nutrients along with the moisture in the soil will allow an electrical current to travel through the soil. The more moisture in the soil the greater the voltage that is measured. Wet soil should have a reading around 1000
on a scale of 0 - 1024. Dry soil will give a reading of around 250
.
The micro:bit has a analog to digital converter (ADC). This allows the microbit to read the analog voltage that is sent from the battery power supply (3 volts) through the soil. When the value is received it is converted to a digital value between 0-1024. This can allow the programmer to write the program to make decisions based on the reading returned to the display.
This project will use a micro:bit to collect data using the voltage that can be passed through a soil sample.
"SOIL MOISTURE TESTER"
in the quotes. ||input:Input||
toolbox add an ||input:on button "A" pressed||
block to the code. ||basic:Basic||
toolbox add a ||basic:show number||
block.||pins:Pins||
toolbox add an ||analog read pin P0||
block to the end of the the ||basic:show number||
block. // Soil Moisture Tester
basic.showString("SOIL MOISTURE TESTER")
// The analog read will return a value of the voltage
// between the 3v pin and the P0. Values will range
// from 0-1024.
input.onButtonPressed(Button.A, () => {
basic.showNumber(pins.analogReadPin(AnalogPin.P0))
})
Collect data from several different types of soil and moisture amounts and record it on the Data Collection sheet. Make modifications to the experiment and code as needed. Create a report to share your findings from the experiment.
A conditional statements that would return messages based on the reading received from the probes.
if (condition) then
display (“WET”)
else if (second condition)
display (“MOIST”)
else
Display (“DRY”)
Add code that would sound an alarm (play music) if the soil dries out below a certain point. The microbit could be left in a pot of soil with plants. It could be programmed to only sample the moisture every hour or so and then play the alarm when it is dry. This would help conserve the battery on the microbit.
NEXT: Resources
Adapted from “Soil Moisture Tester“ by C Lyman