In my current code, when one of the NodeMCUs boots, it attempts to send a time synchronisation message to the other using call_device(). If it succeeds, both devices calculate the difference between their millis() values. When the button on one is pressed, it sends a message (either ON or OFF) to the other along with its millis() value. The second one then determines when it should play or stop the buzzer based on the time difference.
Problem:
My NodeMCU devices only need to communicate when a button is pressed on one of them, or when they are synchronising time. For the most part, they are just idle. Therefore, I want to put them in sleep mode. I have read about the different sleep methods on the NodeMCU, but I cannot decide how to make it work.
The problem is that if the NodeMCUs are sleeping, they cannot detect when one starts sending the other messages. The other problem is that if I, for example, wake them up often, the power savings will be minimal. I want to run this project off a 9V battery for at least weeks. When just idle, they for some reason do not go into automatic light/modem sleep, I assume that is because of the Thinger API?
Is this possible? How do you achieve power savings when connected to Thinger?
Unfortunately you are right, if any device is running a sleep mode it won’t be able to send/receive any communication without making a reset, this is one of the limitations of this amazing processor. Actually, there are a lot of posts online about how to decrease power consumption but there are always difficult solutions…
That is an interesting idea; however, it requires the use of tools and materials I don’t have. Are there any other ways to conserve power in a smart (software?) way?
The basic problem is that WiFi is not designed to save power.
It has just a tremendous overhead and requires to send quite a lot just to be able to receive an info
A real low power solution should be based on another radio design.
Bluetooth BLE on an ESP32 should be more promising, but the king is surely Zigbee or LoRa…
Completely agree with @rin67630, you can find multichannel LoRa gateways for indoor uses under 200$ and easily connect it with TTN for example… but the problem with 0G is that we can’t send asynchronous requests to the devices ¿do you know if BLE provides low power for low-power communications?
First that comes to my mind is a “Wake On Wifi” but if wifi is down, there is no way to communicate to the uC, so the solution to use a less power demanding interface looks the more atractive way to solve the problem, and connect to wifi just when it is needed.