[HM-RD] Added leak/water detection sensor with ESP32 deep sleep / sensor wake (#1615)

Added leak/water detection sensor with ESP32 deep sleep / sensor wake
This commit is contained in:
Die Peter Pan authored and GitHub committed 2023-04-25 17:14:49 -05:00
1 parent e3e700449b
commit abeef870c7
9 files changed
+252 -21

No files matched your search

+2
View File
@@ -8,6 +8,7 @@
|BH1750|Digital light|[parts list](https://compatible.openmqttgateway.com/index.php/parts)|
|BME280|Temperature, Humidity, Pressure|[parts list](https://compatible.openmqttgateway.com/index.php/parts)|
|BMP280|Temperature, Pressure|[parts list](https://compatible.openmqttgateway.com/index.php/parts)|
|C-37, YL-83, HM-RD|Leak, Water|[parts list](https://compatible.openmqttgateway.com/index.php/parts)|
|HTU21|Temperature, Humidity|[parts list](https://compatible.openmqttgateway.com/index.php/parts)|
|GPIO Input|Inputs|-|
|GPIO KeyCode|Keycode|[parts list](https://compatible.openmqttgateway.com/index.php/parts)|
@@ -24,6 +25,7 @@
|BH1750 SCL|A5|D1|22|
|BME280/BMP280 SDA|A4|D2|21|
|BME280/BMP280 SCL|A5|D1|22|
|C-37, YL-83, HM-RD|A0 + D14|A0 + D14|A7 + D14|
|DHT11/22|<a href="img/OpenMQTTgateway_Arduino_Addon_DHT.png" target="_blank">D8</a>|<a href="img/OpenMQTTgateway_ESP8266_Addon_DHT.png" target="_blank">D1</a>|16|
|HC-SR501/HC-SR505|7|D5|5|
|HTU21 SDA|A4|D2|21|
+9 -6
View File
@@ -92,19 +92,22 @@ OpenMQTTGateway support a low power mode for ESP32, this mode can be set by MQTT
The low power mode can be changed also with a push to button B when the board is processing (top button on M5stickC, M5stickC Plus and middle button of M5stack).
If you are already in low power mode 1 or 2 with M5Stack you can wake up the board by pressing the red button.
### Low power mode (deepSleep) for ESP8266 boards
In certain use cases where power is severly limited you can use the ESP8266 deep sleep capability.
### Low power mode (deepSleep) for ESP8266 & ESP32 boards
In certain use cases where power is severly limited you can use the ESP8266 or ESP32 deep sleep capability.
* e.g. measuring a pool temperature every 5 minutes using an ESP8266 and DS18B20 probe where the ESP8266 is powered by very limited battery backed solar power.
* e.g. as a water/leak detector which wake-up based on sensor state an ESP32 and C-37 YL-83 HM-RD sensor where the ESP32 is powered by very limited battery power.
During deep sleep everything is off and (almost) all execution state is lost.
Consumption is about 20 µA.
Consumption is about 20 µA on an ESP8266.
Use this when you want the device to sleep for minutes or hours.
Use this when you want the device to sleep for minutes, hours woken by external sensor state.
You only have to define the macro `ESP8266_DEEP_SLEEP_IN_US` with the number of microseconds.
You only have to define the macro `DEEP_SLEEP_IN_US` with the number of microseconds, this works for both ESP8266 and ESP32.
A hardware jumper is required connecting RST to a GPIO (not to CH_PD) defined by the macro `ESP8266_DEEP_SLEEP_WAKE_PIN` and defaulted to D0.
For an ESP8266 a hardware jumper is required connecting RST to a GPIO (not to CH_PD) defined by the macro `ESP8266_DEEP_SLEEP_WAKE_PIN` and defaulted to D0.
On an ESP32 we can also use an external sensor state to wake-up the ESP and this is defined by macro `ESP32_EXT0_WAKE_PIN` and which state it must toggle to by macro `ESP32_EXT0_WAKE_PIN_STATE` defaulted to 1 (high).
And the sensor code must set variable `ready_to_sleep` to true after publishing the measurement to MQTT and the main loop will then enter deep sleep.