Watering Unit

Watering is a capacitive soil moisture detection and adjustment unit. The product integrates water pump and measuring plates for soil moisture detection and pump water control. It can be used for intelligent plant breeding scenarios and can easily achieve humidity detection and Irrigation control. The measurement electrode plate uses the capacitive design, which can effectively avoid the corrosion problem of the electrode plate in actual use compared with the resistive electrode plate.

Support the following products:

WateringUnit

Micropython Example:

 1import os, sys, io
 2import M5
 3from M5 import *
 4from unit import WateringUnit
 5
 6
 7label0 = None
 8label1 = None
 9label2 = None
10label3 = None
11watering_0 = None
12
13
14def setup():
15    global label0, label1, label2, label3, watering_0
16
17    M5.begin()
18    Widgets.fillScreen(0x222222)
19    label0 = Widgets.Label("Voltage:", 50, 80, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
20    label1 = Widgets.Label("ADC:", 50, 140, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
21    label2 = Widgets.Label("label2", 150, 80, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
22    label3 = Widgets.Label("label3", 150, 140, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
23
24    watering_0 = WateringUnit((8, 9))
25
26
27def loop():
28    global label0, label1, label2, label3, watering_0
29    M5.update()
30    label2.setText(str(watering_0.get_voltage()))
31    label3.setText(str(watering_0.get_raw()))
32    if (watering_0.get_raw()) > 30000:
33        watering_0.on()
34    else:
35        watering_0.off()
36
37
38if __name__ == "__main__":
39    try:
40        setup()
41        while True:
42            loop()
43    except (Exception, KeyboardInterrupt) as e:
44        try:
45            from utility import print_error_msg
46
47            print_error_msg(e)
48        except ImportError:
49            print("please update to latest firmware")

UIFLOW2 Example:

example.png

cores3_watering_example.m5f2

class WateringUnit

Constructors

class WateringUnit(port: tuple) None

Initialize the Fader.

参数:

port – The port to which the Fader is connected. port[0]: adc pin, port[1]: pump pin.

UIFLOW2:

init.png

Methods

WateringUnit.get_voltage() float

Get the voltage of the sensor.

返回:

The voltage of the sensor.

UIFLOW2:

get_voltage.png

WateringUnit.get_raw() int

Read the raw value of the ADC.

返回:

The raw value of the ADC.

UIFLOW2:

get_raw.png

WateringUnit.on() None

Turn on the pump.

UIFLOW2:

on.png

WateringUnit.off() None

Turn off the pump.

UIFLOW2:

off.png

WateringUnit.set_pump(state: int) None

Set the state of the pump.

参数:

state (int) – The state of the pump.

UIFLOW2:

set_pump.png