2.2 Moisture Sensor
The moisture sensor detects the water content in the soil. It outputs analog values depending on how wet or dry the soil is.
Example Applications:
- Automatic plant watering systems
- Agricultural field monitoring
- Soil dryness detection for gardening
2.2.1 Example Code for the Moisture Sensor
- Connect the moisture sensor to one of the expansion pins using the provided Type-C cable.
- Drag the
read
block from the code blocks section to the workspace. - From the dropdown in the
read
block:- Select moisture as the sensor type
- Select the correct pin that corresponds to where the sensor is plugged in
- Drag a
ScreenDisplay
block onto the workspace. - Insert the configured
read moisture
block inside theScreenDisplay
block. - This setup will:
- Continuously read soil moisture levels from the sensor
- Display the values in real time on the screen module

Figure 2.2.1a: Moisture sensor reading displayed using block-based code