The ESP8266 is certainly a versatile device. It does, however, draw a bit of power. That isn’t really surprising, though, since you would expect beaming out WiFi signals to take a little juice. The trick is to not keep the device on all the time and spend the rest of the time in deep sleep mode. [Marco Schwartz] has a good tutorial about how to use this mode to run for “years” on a battery.
[Marco] notes that even using a 2500 mAh LiPo battery, he only gets about 30 hours of operation without sleep. By putting the chip in sleep mode, the current consumption drops from about 88 mA to just over 8 mA. That’s still high, though, because the board has a power LED! By removing a jumper or cutting a trace (depending on the board), you can drop the current draw to about 0.08 mA (80 uA) when it’s not doing anything.
The code for the example is on GitHub. Of course, the real trick is to come up with a strategy that you can keep the device in sleep mode more often than not. That’s not always easy. You might need to rethink a few things. For example, if you serve out a configuration web page, you might need to add a button to wake the device up and serve the web page (be sure it times out after a certain amount of inactivity). So deep sleep mode isn’t a panacea, but with the right design, you can get a lot of battery life.
Some ESP boards require a little modification to use this trick. If you are looking for a good example of how a design might change to accommodate sleep mode, you can find one in this mailbox indicator.
The BMD-300 and the even smaller BMD-350 (both nrf52) require 5mA for continuous receiving AND continuous sending. They support BLE, the NRF24 protocol and NFC. The BMD-300 costs 11.70USD at digikey (single quantity; down to 7USD for larger quantities). There is a basic Micropython port for the nrf52. The Micropython port for the nrf51 (in large parts compatible to the nrf52) is developed and improved due to the Micro:bit. The nrf51 port supports NRF24 protocol.
The nrf52 and the the Micro:bit were mentioned but the details and possibilities are hardly covered here on hackaday. IMHO, it is pointless to promote the ESP8266 with WIFI for low power applications again and again.
“Push a button on the device to wake up the device for serving a web page”? Sounds ridiculous. For which application could/should I use this approach?
OK, choose 1:
1) low power
2) long range
3) high bandwidth
Answer #1: ISM
Answer #2: ISM or Wi-Fi
Answer #3: Wi-Fi
BLE is only good for medium power / short range. ISM is low-power, long range, but low bandwidth and proprietary protocol. Wi-Fi is long-range, high-bandwidth, standardized worldwide but is not low-power.
But anyway, when you start speaking about serving web pages, how can you expect being low-powered?
And my buying threshold for this kind of stuff is $5, with a serious trend to go down to $2, not $12. Thanks to Espressif for that!
NRF24 is ISM with 2.4 GHz. Comparable or better range than WIFI in dependence of the application but less bandwidth than 433MHz. But then, more bandwidth than 433MHz. But when do you need the dozens of Mbps that WIFI provides in an micro controller application? This bandwidth is one reason for why WIFI consumes so much power.
Power is not cheap in western Europe. Saving a few dollars on the module doesn’t help if that drives up my electricity bill.
Correction: 2.4 GHz has less range than 433 MHz.
@Squonk42:
I find the nrf5x interesting because it combines the shockburst protocol (NRF24) and ARM uCs in a single package; i am not interested in BLE.
The ESP32 will become available and will become cheaper, I agree. But when it becomes available at which price and when it will be usable with minimal bugs, nobody can say. Could be next year, could be 2018. Based on experience with Espressif, you can’t estimate anything. And even the PI foundation cannot deliver the PI zero.
“BTW, using ESP8266 in light-mode, it averages at < 1mA, i.e. ~ 3-4 months using a 2500 mAh LiPo battery. Answering to 300 ms Wi-Fi DTIM beacons and instant traffic to/from MQTT broker, no gateway required…"
Thank you for the information. Could you elaborate a little bit more? Surely the ESP8266 draws more than 1mA when in receiving mode, doesn't it?
The Dialog chip has BLE and ARM in a single package, and is much cheaper, but not for us ;-)
If you are just inerested in a proprietary RF chip with ARM CPU, check the EZR and EFR chips from Silabs, much better IMHO abd cheaper, working either in sub-GHz or 2.4 GHz.
And no, the ESP32 is not for 2018: Espressif is a commercial company, not a Charity, they do this for a living. They are also the chip designer and manufacturer, not Broadcom puppet.
Of course there will be bugs. But if you want wait to have a turnkey solution, it’s OK, I’ll move forward and face the nasty bugs for you!
Yes, the ESP8266 draws more than 1 mA when receiving, but you only need to listen and respond to beacons every 300 ms typical to stay connected and given the bitrate, the wake up time is short, thus the low average figure, see http://www.espressif.com/sites/default/files/9b-esp8266-low_power_solutions_en_0.pdf
@Squonk42: Thank you for the information about ESP8266 and low power.
Nrf24 gets about the same range as BLE, unsurprisingly. WiFi tends to get a bit more due to the protocol being more robust, and one end typically being a router with good antenna and power output.
BLE/nrf are adequate indoor in my house, but don’t penetrate to the outside well – modern European house.
And how much range has the WIFI hot spot AP of your mobile phone? Maybe not an issue of the Nrf. Did you use well designed modules with antenna (like your WIFI router) and genuine ICs? Also, the nrf51 ICs have better sensitivity than the nrf24 ICs.
No big antenna, just bog standard eBay (so probably counterfeit) modules vs generic Chinese BLE module. Both PCB antennas. I’m guessing you work for Nordic.
I would indeed love to see more about Nrf5x and less Espressif hype. Is it boring to connect 2 Micro:bit via RF because it simply works out of the box as it is supposed to? So people buy ESP32 for more money to figure out how to work around all the things that do not work?
I agree that the ESP8266 was and still is a cheap and nice so solution to have a WIFI connection and uC. But meanwhile, people are using it more and more for stuff that might be better implemented with other approaches. With the ESP32, it is worse. ESP32 modules are expensive (ESP8266 modules never were) and we can’t even look at the bugs in the firmware yet because it’s not even released (e.g. for BLE).
Nrf52 modules can be as cheap as <7USD. It is just that western industries don't have the means to package and ship single quantities for 30cents like Chinese companies.
So what is wrong with about talking a little bit more about nrf5x and about doing fair comparisons?
Me too! I’ve recently bought a couple nRF51822 boards, hoping to see if I could shoe-horn the Micro:bit code onto them. I also recently just found out that I can buy a real Micro:bit, and have placed an order.
But BTLE is not WiFi, and so I don’t see any fair comparison here. Having a WiFi-enabled network device is just a ton more convenient and hackable, so we see a lot more posts about that. BTLE is also cool, but it’s a young, niche technology in comparison. And at least in my home, it can only talk to my cell phone, and writing Android apps isn’t my idea of fun.
Elliot, I am looking forward to reading about your experiences.
A bridge is required in order to use WIFI clients with low power embedded devices. It doesn’t matter whether the embedded device is a nrf5x or another micro controller with a 433MHz module.
I agree that BTLE is not WIFI, though nrf5x supports the nrf24 protocol as well. However, this blog entry is about a battery-powered device. Comparable aspects are power consumption, complexity, usability, use cases. A non-WIFI embedded device requires a bridge (WIFI or RJ45) which is a drawback. On the other hand, you do not need a bridge for every embedded device. You could receive or send very frequently with low latency (or even continuously) and still have it battery-powered. Truly low-power devices can be efficiently operated with small capacitive power supplies. This is impossible to achieve with WIFI modules that require hundreds of milliamps every now and then.
Think of all the applications that you can implement with low-power wireless modules that respond instantaneous on commands from you or other modules. Lights, thermostats, any other actuator…
When I say ISM, I mean 433 or 869/902_928 MHz bands. Under same environmental conditions and using antenna of same size on the device side (not possible on the receiver side for Wi-Fi), I get 30 m with Wi-Fi, 10~20 m with BLE because of lower power and simpler modulation/FEC, I get 50 m+ with 869 MHz ISM, which is inherently better in indoor conditions because sub-gig is less absorbed by walls and find openings better than 2.4 GHz.
And these NRF5x are horribly expensive, you can get a TI CC2541-based module for $1.65:
https://www.aliexpress.com/item/sku/32711006709.html
I don’t know if you work for Nordic and/or you consider these Chinese boards as crap, but anyway, the Nordic BLE chips are not the best around. I used Dialog chips, they perform much better but are unfortunately not available to the mere hobbyist :-(
ESP32 are expensive because they are not available and everybody wants one. When they appeared, nobody knew the ESP8266, this is why they were cheap. When the ESP32 will become available, you can expect them < $5, only the chip is marginally more expensive, the other components are the same.
BTW, using ESP8266 in light-mode, it averages at < 1mA, i.e. ~ 3-4 months using a 2500 mAh LiPo battery. Answering to 300 ms Wi-Fi DTIM beacons and instant traffic to/from MQTT broker, no gateway required…
@Squonk42:
I find the nrf5x interesting because it combines the shockburst protocol (NRF24) and ARM uCs in a single package; i am not interested in BLE.
The ESP32 will become available and will become cheaper, I agree. But when it becomes available at which price and when it will be usable with minimal bugs, nobody can say. Could be next year, could be 2018. Based on experience with Espressif, you can’t estimate anything. And even the PI foundation cannot deliver the PI zero.
“BTW, using ESP8266 in light-mode, it averages at < 1mA, i.e. ~ 3-4 months using a 2500 mAh LiPo battery. Answering to 300 ms Wi-Fi DTIM beacons and instant traffic to/from MQTT broker, no gateway required…"
Thank you for the information. Could you elaborate a little bit more? Surely the ESP8266 draws more than 1mA when in receiving mode, doesn't it?
There are plenty of things that require a button press to go into setup mode.
Thankyou for this, making a comment here so it flags up auto email on replies
and also interested in the newer ESP series lower power versions and I
understand the new combo wifi/bluetooth chips coming out in the one
package single or dual processor. All great fun and thankyou for posting :-)
I have implemented it (from the exactly same tutorial) weeks ago, and it has been “working” since then… with the difference that it loses connection to wifi at least once a day, and never comes back; so I have to manually reset it every time it happens. I did not go deep enough in the code to figure what is happening, but it could be related to my (wery weak) internet connection.
Are you loosing local or Internet coneection? If you loose local Wi-Fi, try changing thr’timeout to math the router’s DTIM beacon period.
I don’t really know wether I am loosing local or internet, all I know is that my broadband comes to me via radio waves (not cables) at 2Mbps (very slow and unstable), so I think I may be loosing internet connection. I will look into this DTIM configuration, thank you for the tip!
Can you do something similar with the ESP-14 modules that contain an STM8S003F3P6 along with the Espressif chip?
Man, I have some day job projects (energy harvesting) that would struggle to consume 80uA at full tilt.