EARTH unit is a Soil Moisture Sensor for measuring the moisture in soil and similar materials.

The soil moisture sensor is pretty straight forward to use. The two large exposed pads function as probes for the sensor, together acting as a variable resistor. The higher moisture that is in the soil means the better the conductivity between the two so that the sensor will result in a lower resistance, and a higher SIG out.

You can read the moisture in soil by ADC. Inside this Unit we put an extra potentiometers to change the measurement range. 

Product Features

  • Adjustable threshold, including 10K adjustable resistor
  • Analog & Digital output
  • Program Platform: Arduino, UIFlow(Blockly, Python)
  • Two Lego-compatible holes

Kit includes

  • 1x EARTH unit
  • 1x GROVE Cable


  • Potted soil moisture monitoring




1. Arduino IDE

The code below is incomplete. To get the complete code, please click here.

#include <M5Stack.h>

void setup() {
  dacWrite(25, 0);//disable the speak noise

  pinMode(26, INPUT);// set digital pin

uint16_t analogRead_value = 0;
uint16_t digitalRead_value = 0;

void loop() {
  analogRead_value = analogRead(36);// read analog value of EARTH
  digitalRead_value = digitalRead(26);// read digital value of EARTH

2. UIFlow

To get the complete code, please click here.


More information




M5Core(GROVE B) GPIO36 GPIO26 5V GND EARTH Unit AnalogSignal Pin DigitalSignal Pin 5V GND

Add projectSign up / Login