obniz Parts Library

Grove_EARTH

GitHub
Grove_EARTH
Usable Devices :
obniz_board
m5stickc

Soil Moisture Sensor - EARTH

The soil moisture sensor, EARTH UNIT for M5STACK.
It detect moisture level in soil.
It has both analog and digital outputs.

wired(obniz, { aout, dout, vcc, gnd, grove })

connect EARTH UNIT to the obniz Device.

name type required default description
vcc number(obniz Board io) no   power supply
gnd number(obniz Board io) no   power supply
dout number(obniz Board io) no   digital out
aout number(obniz Board io) no   analog out
grove object no   grove property when device has a grove interface
obniz.onconnect = async function() {
  var earth = obniz.wired("Grove_EARTH", {aout: 0, dout: 1, vcc: 2, gnd: 3});
  earth.onchange = (val) => {
    console.log(val)
  }
}

If the device has a grove interface, it can be connected with just the parameter {grove: obniz.grove0}.

// JavaScript Example
var obniz = new Obniz.M5StickC("OBNIZ_ID_HERE");
obniz.onconnect = async function() {
  var earth = obniz.wired("Grove_EARTH", { grove: obniz.grove0 });
  earth.onchange = (val) => {
    console.log(val)
  }
}

onchange = function(value)

callback function called when the value was changed.

the value indicate analog output voltage.
It will be reduced when getting water.

var obniz = new Obniz.M5StickC("OBNIZ_ID_HERE");
obniz.onconnect = async function() {
  var earth = obniz.wired("Grove_EARTH", { grove: obniz.grove0 });
  earth.onchange = (val) => {
    console.log(val)
  }
}

[await] getAnalogHumidityWait()

Measure and get current analog value once.

the value indicate analog output voltage.
It will be reduced when getting water.

// Javascript Example
var sensor = obnizStick.wired("Grove_EARTH", { grove: obnizStick.grove0 });
var value = await sensor.getAnalogHumidityWait();
console.log('Humidity Level:' + value);

[await] getDigitalHumidityWait()

Measure and get current digital value once.

// Javascript Example
var sensor = obnizStick.wired("Grove_EARTH", { grove: obnizStick.grove0 });
var value = await sensor.getDigitalHumidityWait();
if (value) {
    console.log('Humidity level is toohigh!');
}

Supported from: obniz.js 3.5.0