Re:ESP 8266 Wi-Fi Repeater with Mesh Networking
by rcarmo on Tuesday December 26, 2017 @03:30PM
(#16010812)
On the topic of deep sleep, I've done it half a dozen times already on the ESP-01:
https://taoofmac.com/space/blog/2017/11/05/2130
There are hacks to trigger wake with auxiliary circuitry, but it would be nicer (if more demanding in terms of current) to monitor a GPIO pin.
Re:ESP 8266 Wi-Fi Repeater with Mesh Networking
by sitkack on Tuesday December 26, 2017 @09:15PM
(#16012382)
You need something with a counter/timer, sum the anemometer into a register. Wakeup when it overflows. Some chips can run the counters while the MCU is in sleep.
Your idea to offline sensor handling to an ATTiny is perfect. I'd use
https://www.microchip.com/wwwproducts/en/ATtiny85
as it has timer/counter.
I believe that the other two sleep modes (modem sleep and light sleep) support waking on GPIO activity, but they don't save as much power.
Modem sleep just disables WiFi between DTIM beacon intervals. In this sleep it draws between about 15 mA and 16 mA current average, depending on the DTIM beacon interval.
Light sleep is like modem sleep, but also turns off the system clock. That gets you down to an average of between 0.5 mA and 2 mA, depending ton the DTIM beacon interval.
In deep sleep, everything is off except the real time clock. That cuts current down to around 0.02 mA.
Two of the sensors I have don't fit in well with that kind of deep sleep.
One is a cup anemometer. It briefly closes a switch once per revolution. Wind speed = rotation rate times a constant. If I just wanted to check the average wind speed every so often, it would be fine--the ESP8266 could wake up and stay awake for a few resolutions to get the speed, send it, and go back to sleep.
It could be hooked up to reset the ESP8266 each time the switch closes, but in high wind that could generate resets so fast that the ESP8266 would not have time to connect to WiFi and send data.
Also, I'd like to get more information on wind gusts, and so really want to record the time of each switch closure.
The other is a tipping rain gauge. It briefly closes a switch for every 0.01" of rain. That one probably could be used directly with the ESP8266 by making it generate a reset on each switch closure. I don't think my area ever gets rain intense enough to make those resets happen fast enough to cause problems.
What I'm thinking of do is relegating the ESP8266 to just dealing with WiFi, and using something like an ATiny84 to handle the sensors.
The ATiny84 and ESP8266 can be connected via I2C or SPI or similar. The ESP8266 can then spend most of its time in deep sleep, being woken every so often by the RTC. When it wakes it can get the accumulated data from the ATiny84 and upload it.