Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By tavalin
#14515 I'm aware of low power modes and battery sensors, I'm currently using an Arduino Pro Mini with an RFM69 in a sensor. My question is specifically that when using deep sleep on my ESP-01, on wake up it seems to reset the sketch rather than resume where it went to sleep. I wanted to know if this is expected behaviour or not.
User avatar
By danbicks
#14516
AcmeUK wrote:It means that those of us that are developing battery powered sensors can put the esp8266 into minimal power mode between measurement & reporting cycles. For example I only want to check soil moisture levels once per hour.


Hi AcmeUK,

I would love to see an example if you get time of a sketch using the A>D to sample water moisture, upload data periodically and alert if level falls bellow specific level. Using deep sleep mode and MQTT. Have some nice house plants that would benefit from this.

Keep up the super work.

Dans
User avatar
By uhrheber
#14542
tavalin wrote:I'm aware of low power modes and battery sensors, I'm currently using an Arduino Pro Mini with an RFM69 in a sensor. My question is specifically that when using deep sleep on my ESP-01, on wake up it seems to reset the sketch rather than resume where it went to sleep. I wanted to know if this is expected behaviour or not.


You're right, it does indeed reset every time it wakes up.
I inserted a counter, and it gets reset every time at wake.
When you set the baud rate to 74880, you can read the startup message.
When it wakes up from deep sleep, the message says: 'rst cause:2, boot mode:(3,7)'
A normal power on reset yields: 'rst cause:1, boot mode:(3,0) '
I guess that this behavior is wanted. It seems that the software has to save it's state to the rtc RAM, then go into deep sleep. At startup, it has to check the reset cause (I guess that's stored anywhere) and react accordingly.
Meaning, not doing a full setup, but initialize only what's necessary , and restore it's state from the rtc RAM.

That's not really that useful, If you need really low power, you're maybe better off using an external rtc with wake function, and power off the ESP completely during sleep.
User avatar
By torntrousers
#14627 Does anyone have deep sleep working well on an ESP-01? I was feeling quite pleased with my fat fingers managing to solder the wire on to the ESP-01s tiny reset pin but i can't get the wake up to work very reliably. Waking up every 30 seconds within half an hour it always ends up in the zombie mode others have I reported. I've tried 4k7 pull up resistors on gpio0 and gpio2 with no luck. An ESP-12 seems to work fine, i wonder if the ESP-12s shielding helps?