The ESP-01 module based on the ESP8266 is all the rage with IoT folks at the moment – and why not. For about 5 bucks, it can’t be beat on price for the features it offers. The one thing that such radios do a lot is suck power. So, it’s no surprise that ways to cut down on the juice that this device consumes is top priority for many people. [Tim] figured out a simple hardware hack to get the ESP-01 to go to deep sleep, effectively reducing its current draw to 78uA – low enough to allow battery powered deployment.
While [Tim] was working on understanding the ESP8266 tool chain (NodeMCU firmware > Lua interpreter > ESPlorer IDE), he realized that some essential pins weren’t accessible on the ESP-01 module. [Tim] built a Dev board on perf board that let him access these pins and also added some frills while at it. We’re guessing he (or someone else) will come up with a proper PCB to make things easier. But the real hack is on the ESP-01 module itself. [Tim] needed to hardwire the ‘post-sleep-reset-pin’ on the MCU to the Reset terminal. That, and also pry off the indicator LED’s with a screw driver! That sounds a bit drastic, and we’d recommend pulling out your soldering iron instead. If you’re one of the unlucky one’s to receive the “magic smoke” releasing ESP8266 modules, then you don’t need the LED anyway.
21 thoughts on “Hack Allows ESP-01 To Go To Deep Sleep”
There are many discussions about deep sleep and the issues involved at http://www.esp8266.com will be real interesting to see if we can get good battery life with this.
Bloody Fritzling picture instead of schematic diagram. Bloody, bloody, bloody.
If the module resets after deep sleep, it loses its RAM contents. I am trying to understand what happens when it wakes up again. Ofcourse it loses RAM state, but then what good is the sleep mode for? Every time the module wakes up, it needs to reconfigure its state.
can you please post some documentation on that claim?
if it loses ram content, is the code from the esp gone? or is the lua code you sent to it actually stored somewhere else? is the code actually in the esp, or can lua commands just be sent to it through a serial link?
The lua code is stored in flash. NodeMCU provides a simple file system to store your work.
You can use the rtc memory for saving the state. The Espressif SDK programming guide has an example at the very end of the document on how to use it.
Who wakes up the module after deep sleep? Can an internal timer do it, or does it have to be external?
If it has to reset and start from scratch, why not power down the whole module?
An internal timer pulls XPD_DCDC/GPIO16 down. If this is tied to EXT_RSTB, the module restarts. If you powered down the module, you would need an external timer.
For simple sensor setups, this is rather easy to use. Each time the module starts up, you query your sensor and report it. The dsleep is just a convenient timed restart mechanism.
Sleep modes are documented in the datasheet: http://www.mikrocontroller.net/attachment/231858/0A-ESP8266_Specifications_v4.pdf
You basically have 3 options relevant to battery powered:
1. 10uA = shutdown, need external micro to turn it on. Everything starts from scratch.
2. 60uA(or the 78 achieved here) = RTC running and can wake up the thing periodically, no interrupt available. State can be saved to turn on from where you left.
3. 310uA = lowest power state where something can wake up the chip (like GPIO)
With 2 you might get a year of battery powered temperature sensor, because you can read that from time to time. Maybe 2 years if you don’t read it often.
With 3 you will get some months for something like a motion sensor that needs to wake up the thing.
Of course you can try combining these modes. I think the greatest drawback of this chip is that it cannot be woken up by GPIO in that 60uA
Just curious: When only option 3 can wake up the chip by GPIO, how would a external micro turn the chip on in option 1? If I need an external Micro, I could even power off the whole ESP with 0uA power consumption and then switch it on whenever I feel like, right?
There is an enable for the chip. But if you really want 0u, you have to put switch the power supply as well.
Ti’s tpl5010 is specifically for this type of applications. Its current consumption is 50nA (max) 35nA (typ) while its timer is active. The timer accuracy is +/-0.5%. It uses a one time sampling of an external resistor to pick the digital delay which can be 100ms to 2 hours. Pretty hard to beat on the power consumption.
With some extra mosfet(s) + passives, you can probably use it to periodically power up the ESP8266. Alternatively, you can watchdog timer chip or RTC with an alarm output if you want more accurate interval.
Probably not worth going in the nA scale here. The instantaneous current consumption of the chip requires reasonable size batteries, which would also get you reasonable endurance in standby. If you want to use something external, probably an external micro is the best choice. A lot of them could keep a low power RTC for 1-2uA, which is already little for even a coin cell.
On the other hand, yes 60u si a lot for a simple RTC, so is 310u needed for external interrupt. There are maybe 2 reasons while it is this high: the design of the chip is bad(fixable later) or the technology is bad which cannot be fixed, also probably the reason for the low cost of the chip. The chip is pretty hungry compared to others, like TI’s offering, but when power is not that big an issue, you cannot beat it.
With an extra micro, there are hidden cost – firmware, programming tools etc. It might not seem much to the average hobbyist if he/she has the parts and his/her time cost $0. There are markets for specialized chips like these because of a commercial high volume need. This chip is neat because the timer values are programmable – a trimpot measured with a multimeter can set the time accurately without going through the code/compile/download cycle.
Even when they fixed the ESP chip, you won’t find the newer rev filtering down for a long time. The old chips has to go somewhere, the board makers would get a good deal on the obsoleted ones that are destined into the disposal.
Well, i have to say it depends. I think the tpl5010 is not your standard part in a hobby bin, but a micro might be.
Has anyone seen an arduino board with one of the ESP wifi chips built in? Ideally something like an arduino nano.
The radino sounds pretty much like that: wiki.in-circuit.de/index.php5?title=ESP8266EX#radino_WiFi_-_ESP8266EX_combined_with_Arduino_Micro
I am not a user of arduinos, but if someone makes something like a nano with the ESP on it, coupled with OTA software load, that might be attractive. It will cost something like 30 in the beginning, but it should drop to under $10 on ebay soon. On the other hand, you could make your own, it will just not be that compact.
Gee, it is almost impossible to solder the wire to the chip. My finest soldering tip seems huge through the magnification glass compared to the pin. I need another set of tries tonight.
Just a thought, if you can keep the current down to 10ma, you could use a “D” size LiSOCL2 (Lithium Thionyl Chloride) for a long term temperature monitor. The one I have is a 19aH 3.6V. Yes, 19,000mAh. Given this configuration, an average of 10ma/hr would end up being just a little over 79 days. (Theoretically). Get the current down to 1mA and you’ve got yourself over 2 years. (Yes, I know that is stretching it thin, we need to have ambition right?)
Pros: Works well in -60C, so it’s great for outdoor winters, 19aH capacity for extremely long life. I have seen higher than 30ah “D” cells also.
Cons: Expensive, can take no more than a 200mah load, and it’s not rechargeable.
I’m planning on giving one a go in one of my forest sensors. I’ll have solar in other battery powered areas. I challenge someone here to squeeze a year out of one with just a simple temperature monitor, 15 minute updates until dead.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)