Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create switch between sleep and "live" modes #5

Open
oliemery opened this issue Jun 16, 2022 · 1 comment
Open

Create switch between sleep and "live" modes #5

oliemery opened this issue Jun 16, 2022 · 1 comment

Comments

@oliemery
Copy link
Contributor

Sleep was implemented after sending measurements through MQTT to save battery (measurements every 5min with sleep in between). This also allows to fully charge the NCR18650B (up to 4.12V) with the solar panel/charger (without sleep, the battery could only be charged at a max of 3.8V even in full sun, presumably because the current drawn for WiFi limits the current to charge the battery; Charging using a USB charger did allow to reach 4.12V).
However when in sleep, it is not possible to interact with the ESP32-c3 through the serial commands / MQTT requests except if doing it exactly when the ESP32 wakes up briefly to connect and send measurements.
Ideally the switch should be in node red, allowing to go to "live" mode (no sleep) at the next wake up, with a maximum period of inactivity set before returning to sleep mode to avoid battery drain by permanent live mode (without charging and full battery, the system lasted 39h42 min).

@lpatiny
Copy link
Member

lpatiny commented Jun 16, 2022

Need to think about the best way to implement sleep because adding it in MQTT task does not seem general enough.

It should only be placed at this level:

esp32-c3/src/main.cpp

Lines 34 to 37 in 0df1009

/**
esp_sleep_enable_timer_wakeup(15 * 1e6);
esp_deep_sleep_start();
**/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants