muwerk mupplet Sensor Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications for sensors
|
mupplet-sensor analog, digital rain sensor More...
#include <mup_rain_ad.h>
Public Member Functions | |
RainAD (String name, uint8_t analogPort, uint8_t digitalPort, FilterMode filterMode=FilterMode::MEDIUM) | |
double | getUnitRain () |
void | begin (Scheduler *_pSched, uint32_t _pollRateMs=2000) |
mupplet-sensor analog, digital rain sensor
The rain_ad mupplet measures rain using a simple analog and digital MH-AD rain sensor (rain detector with analog and digital output)
topic | message body | comment |
---|---|---|
<mupplet-name>/sensor/rain | ON or OFF | state of digital rain sensor |
<mupplet-name>/sensor/unitrain | normalized rain [0.0-1.0] | Float value encoded as string |
<mupplet-name>/sensor/mode | FAST , MEDIUM , or LONGTERM | Integration time for rain values |
topic | message body | comment |
---|---|---|
<mupplet-name>/sensor/rain/get | - | Causes current value to be sent with. |
<mupplet-name>/sensor/unitrain/get | - | Causes current value to be sent with. |
<mupplet-name>/sensor/mode/get | - | Returns filterMode: FAST , MEDIUM , or LONGTERM |
<mupplet-name>/sensor/mode/set | FAST , MEDIUM , or LONGTERM | Set integration time for rain values |
Hardware: RainAD, 10kΩ resistor
Note: For ESP32 make sure to use a port connected to ADC #1, since ADC #2 conflicts with Wifi and ports connected to ADC #2 cannot be used concurrently with Wifi!
|
inline |
Instantiate an RainAD sensor mupplet
name | Name used for pub/sub messages |
analogPort | GPIO port with A/D converter capabilities. |
digitalPort | GPIO port for digital rain input |
filterMode | FAST, MEDIUM or LONGTERM filtering of sensor values of analog port |
|
inline |
Start processing of A/D input from RainAD
|
inline |
Get current unit illumance