ESP32-8266-Sensor-Monitor icon indicating copy to clipboard operation
ESP32-8266-Sensor-Monitor copied to clipboard

Feature request : Low power sensor network.

Open happytm opened this issue 5 years ago • 7 comments

I am very impressed with your simple yet powerful code. I also recognize that you have been testing low power sensor devices over last few years. I was interested in simple low power ESP devices and tried several protocols for wireless battery powered devices but in the end used totally different protocol which I do not see used very much but yet it is very power efficient to collect data from network of battery powered device.

I do not have equipments to measure battery power consumption of ESP devices using my code. I would appreciate your testing and feedback.

I also would like to see this protocol implemented in your code if possible. I am not a programmer so I am not well equipped to do it myself. Link to my code is below:

https://github.com/happytm/BatteryNode

Thanks.

happytm avatar Dec 06 '19 20:12 happytm

I would like to get the ESP32 or 8266 power consumption down, but to be honest it’s not a software issue that needs to be implemented or changed, the real problem is the highly inefficient radio transmitters and receivers used (as admitted by Espressif) by the ESP devices, they are the major consumer of power, for example when the ESP32 is transmitting data packets by whatever protocol either MQTT or HTTP or whatever, that 100mA of the power consumption is used by the RF stages (40mA for the ESP core and 100mA for RF), for the ESP8266 the situation is not as bad, but the ratio is about the same, 15/60mA when transmitting. There are much better devices on the market like the Microchip devices that use a fraction of the power on RF, but unfortunately do not offer the same coding capabilities or ease of access to inexperienced programmers. Another major issue is that the use of high overhead protocols takes a relatively long time to send relatively small amounts of data. The reason I’ve tried to get power consumption down when using the ESP devices is that they are marketed (or were) as IOT devices and yet what we see is that they are most inappropriate for a typical IOT device because of their high power usage that is not conducive to battery powered equipments and that is the irony of these problems.

Thank you for your comments and contributions and I hope you are able to progress your ideas further.

There is no easy way to determine total power used by an ESP and the only way to do it is to use a digital storage oscilloscope and a current probe, conversely when an ESP is running a simple programme the power consumption is constant and therefore easy to measure, so in conclusion power has to be measured over time and integrated which is tediously difficult as you allude to without specialist test equipment.

What you can do with your code is to set a variable that times the total on-time, e.g. at the start a variable called starttime = millis(); and then just before sleep endtime = millis(); leading to an on-time = endtime - starttime and then multiply this by 145mA for the ESP32 or 75mA for the ESP8266, the result is in mAHr and battery duration can be estimated to be e.g. 3000/on-time and the result in hours is typically 100-days or more.

Now at this stage in my explanation, I should point out that Espressif employed what’s called a class-A RF / transmitter design, which always consumes maximum power, this design flaw also applies to the receiver which again is not optimised for power consumption, so that ironically it in most circumstances consumes more power than the transmitter, the combination is a (relatively) high power device!

I hope all this makes some sense and please trust me that the problem cannot by be solved by software. Incidentally, the very lowest power solution is to use low cost 433Mhz modules typically used by every remote sensor module in the world and to use the plethora of suitable protocols developed for that purpose with the ESP devices being used for computing only and their RF stages turned off. I have done extensive tests on Instructables in response to worldwide criticism of my efforts and despite being challenged no-one has been able to get better results than I have, unless they use store and forward techniques but that’s not real-time or even near real-time and thereby useless. Most proposed taking a reading, storing it, then say every 24/hrs uploading data, but for most applications what use is that when data is up to 24-hour ms old what value is it!

That’s enough from me, I’d value your comments in response to what I have said. Incidentally, I don’t know your name, mine is David.

G6EJD avatar Dec 06 '19 22:12 G6EJD

David, Sorry my name is Ken and I am in USA.

Thank you for your detailed response. As you mentioned to calculate power consumption without proper equipment next best option for me was to calculate time it requires to send data successfully to receiver of the data. In my case it is around 60 milliseconds to send 12 bytes of data which identify the device, send device's voltage and 4 different sensor values. By calculating power consumption using your excellent solar calculator I have total device mAHr demand (per-hour) = 0.0135 mA. Following are numbers I used for estimate:

sleep time = 30 minutes time awake = 0.06 seconds sleep current = 0.011mA wake current = 75mA

Am I right in calculating 0.0135mA hourly demand ?

If I am right with above calculation is it possible to keep sensor running infinitely with following parts and connecting it to bare bone ESP8266 & HT7333 regulator?

If above is possible then that will be very compact & thin sensor node which an be placed in some remote area and we can forget about replacing the battery for lifetime of solar panel or battery. Eventually goal is to have sustain the device for lifetime of battery of smallest size possible used.

https://www.ebay.com/itm/10pcs-5V-30mA-Micro-Mini-Power-Solar-Cells-Panel-Board-Set-For-DIY-Toy-53-30mm/352673192324?_trkparms=aid%3D555018%26algo%3DPL.SIM%26ao%3D1%26asc%3D61112%26meid%3D200eec1edfcf4fbcbb5b66d5e3fa5118%26pid%3D100005%26rk%3D3%26rkt%3D12%26mehot%3Dpf%26sd%3D333302663283%26itm%3D352673192324%26pmt%3D1%26noa%3D0%26pg%3D2047675&_trksid=p2047675.c100005.m1851

https://www.ebay.com/itm/16-pcs-LIR2450-Li-ion-3-6V-Volt-Rechargeable-Button-Cell-Coin-Battery-US-Stock/153292477462?hash=item23b0f19416:g:P6cAAOSwAuNW6njZ

https://www.ebay.com/itm/2X-1A-5V-TP4056-Lithium-Battery-Charging-Module-USB-Board-Electronic-Componen-LL/372528382545?hash=item56bc6c0251:g:UHIAAOSwmRNauwg0

I agree with you that 433Mhz modules are most power efficient but it is extra device hardware wise. I think bare bone esp8266 is simplest for hardware implementation. Another benefit of ESP8266 is to be able to use OTA update feature in case of remote location.

Please advice.

Thanks.

happytm avatar Dec 06 '19 23:12 happytm

David,

Can you give your feedback regarding battery power consumption calculation in my earlier post?

In theory is it possible to sustain battery for it's life using above setup and calculation or I am miscalculating something ?

Please give your valuable feedback.

Thanks.

happytm avatar Dec 27 '19 04:12 happytm

This is your data: sleep time = 30 minutes time awake = 0.06 seconds* sleep current = 0.011mA wake current = 75mA Am I right in calculating 0.0135mA hourly demand (* 60mS seems very low)

The power consumption in sleep mode = 2 * 30 * 0.011mA = 0.66mAHr The power consumption in wake mode = 2 * 0.06/60 * 75mA = 0.15mAhr The total power required per hour = 0.66+0.15 = 0.81mAHr

A typical 2600mAhr battery will last for 2600/0.81 = 3095hours or 129 days

This result is entirely consistent with what's expected. Can't get something for nothing!

G6EJD avatar Dec 27 '19 14:12 G6EJD

Hi David,

Thank you for your valuable feedback.

(* 60mS seems very low) - yet that is my "uptime'" in real world. All I am doing this in code to count "uptime":

upTime = millis(); Serial.println(upTime); ESP.restart(); // For testing only.

As for 0.0135mA hourly demand calculation I used your battery capacity estimator spreadsheet plugging same 4 data points above. Is there any other input I missed to enter there?

If I enter 100 mAHr LIR2450 battery the estimator give me 309 days of battery life.

Please advice.

Thank you.

happytm avatar Dec 27 '19 17:12 happytm

OK, despite the uptime not doing anything, now I understand why it is so short, then the power consumption is very low. Really the only power consumed is during sleep so thats 0.011mAHr, you may have missed that a sleep time of 30-mins is actually twice per hour so demand has to be doubled, in other words the totol demand assumes wake-up never happended as its so small.

I'm not sure if you have actually measured sleep current, it is not easy to do, as the bare ESP8266 consumes ~10uA but there is always a Flash storage device on the board that holds your programmes and this usually increases to power demand to about 40uA as the flash is always on.

Using a 100mAHr cell sleep time would be 100/0.011 = 9090hrs or 378 days or 1-year in your example the ESP is doing nothing, so I'm not sure of the value of the test. I don't know your board type, but I'd actually expect the battery to last for 104-days.

G6EJD avatar Dec 27 '19 19:12 G6EJD

Thank you for your feedback. As I said earlier i don't have sophisticated equipments like guy with swiss accent to measure low current in deep sleep but made some assumptions based on this video of his:

https://www.youtube.com/watch?v=6NsBN42B80Q&t=386s

So even if I use your calculation of 104 days of battery life and charge it with micro solar panel I linked we have solution in very small device (approximate size 53mm x 30mm x 15mm ) which can sustain itself for life of battery or solar panel.

Thank you for your help.

happytm avatar Dec 27 '19 21:12 happytm