Moisture sensor

With the class set for SEK I there is the possibility to develop a plant station. Here, for example, the moisture sensors can be used to check the moisture in a flower pot and water can be added with a pump (or a small container attached to a servo motor) as soon as it is determined that the plant in the pot is too dry.

Further information to the sensor you will find here.
Moisture sensor can be ordered here.

port: A1
interface: analog
output values

dry soil: 0 - 300
damp soil: 300 - 700
Water: 700 - 950

Makecode

To work with the values of the humidity sensor, the respective value of the pin on which the sensor sends the data must be queried. In this case this is pin C16.
To get the current value shown on the LED display, the block "show number 0" from the "Basics" category can be used. To see the values of the sensor there, we need the right block from the "Pins" category.
The individual pin blocks can be found under the "Advanced" category. There the block "analog values of pin P0" must be selected and "P0" must be changed to "C16". This block is inserted instead of the "0" in the "show number" block.


video hex

Open Roberta Lab

In the overview gallery in the Open Roberta Lab you can find the shown example program with documentation of the humidity sensor.
The best way to open the example program in the gallery is to enter "Grove_MoistureSensor" into the search mask.


video xml