Author Topic: Real time + Low Power (10mW) ESP8266 Expirments  (Read 9700 times)

0 Members and 1 Guest are viewing this topic.

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Real time + Low Power (10mW) ESP8266 Expirments
« on: May 18, 2017, 10:11:59 am »
Hi All,

In case anyone is interested, i have been playing around with Light Sleep modes on the ESP8266 and recently been getting some good results.
I currently have the ESP8266 waking every ~5 seconds while maintaining WiFi connectivity when asleep so it can send data immediately when an interrupt is triggered.
It will also respond to TCP requests! (While awake)
All while averaging 10mW.

My intention was to make a real time sensor network for things link alarming when someone comes up my driveway while being battery powered and possibly stay running for ever with a small solar cell.
I i think my code is at a point where this is becoming a reality.

At the current 10mW, i should be able to get ~50 days up-time from a NCR18650

I'm not sure if there are any other projects out there that do this while maintaining WiFi so you can transmit something very quickly. Has anyone seen any ?

Code uses the NON-OS SDK

Git repository here:
https://github.com/leon-v/ESP8266-NONOS-SDK-2.0-Low-Power-WiFi-Node
Its just a super rough build log...


1 - Yellow Trace: The current between the NCR18650 and the 3.3V switching regulator.
2 - Green Trace: The battery voltage.
3 -  Blue Trace: The interrupt timing capacitor (accidentally left in A instead of V)
M1 Pink Trace: Math 1 is 1 * 2. so is the wattage drawn from the battery.

Comments & recommendations welcome! They all help!
Damn forum is making me procrastinate from work!
 
The following users thanked this post: Dave_PT, thm_w, edavid, Muxr

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #1 on: May 18, 2017, 11:52:39 am »
Hello.

I'm doing something very similar, but my sensor is mobile and I need to use DHCP.
To save more energy I control the ESP with another MCU (which I really need to have) and just turn ESP on when I need to send something.

The problem is the time to get IP. Sometimes it takes more than 10 seconds to get IP ...

Some advice?

NOTE: I have been using nodemcu and also the Espressif SDK and so far I do not see any advantages (in the space of time I am using) so nodemcu has a faster development ...
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #2 on: May 19, 2017, 12:46:41 am »
That sounds like it might be more of an issue with the way the ESP8266 is requesting an IP, and how your router / DCHP server is responding.
Its likely to be the ESP8266 trying to re-use its previous IP, but the DHCP server not allowing it for various reasons. Which after time will cause the ESP8266 to try and lease a new IP instead. Or visa versa.

Install Wireshark on a PC on the same network and monitor the network traffic for DHCP packets.
Keep in mind that you will only be seeing the broadcast packets, not all of them.
This will likely tell you what is going on.

I did think it was quite impressive that the ESP8266 can re-connect to Wifi in just a few seconds.. But i wanted <= 300ms repose times for rel time events.
Damn forum is making me procrastinate from work!
 
The following users thanked this post: Dave_PT

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #3 on: May 22, 2017, 09:16:59 am »
Sorry for the delay.

I got an "airPcap" and I'm looking at all packets with wireshark.

But I have doubts about the beginning. This takes 1.8sec to do something, before starting DHCP.

From DHCP Discovery to DHCP Request takes about 1s.

I have to understand what it's doing to take 1.8sec ... but networking is not my area.


 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #4 on: May 25, 2017, 05:32:19 am »
What defines the 'beginning'?
Is it waking from deep sleep, forced or auto light sleep?
Or just power up?

1.8s sounds suspiciously like the time it takes for the ESP8266 to connect to to the WiFi access point when the SSID and password are cached, which is pretty quick!

The lowest power modes that everyone seems to use is Deep Sleep, which triggers a reset to wake, this is required since the RAM turned off in deep sleep and the CPU needs to start from scratch.

This is why i started experimenting with Auto Light Sleep. Since only the CPU gets turned off, and WiFi maintains connectivity.

Another thing that i have found to be super useful is the debugging serial port.
It took me a while to realise what the garbled text that i was getting though the serial port was.
It turned out that the ESP8266 has info that gets put through UART0 at 74880bps.
This includes boot information before the uploaded software is run.



Also, Sorry for the late reply.
I did start a reply but then i realised i had my SSID and WiFi password in the git repository  |O :-DD
I must say its not like me to forget about that stuff, but at least that password was one of my more generic public ones.

So to anyone writing source for the ESP, just put your SSID and Password in a header file out of the main repository.
Damn forum is making me procrastinate from work!
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #5 on: May 25, 2017, 09:01:38 am »
In this case ESP always starts from power-up. That's the way to keep it at "zero" consumption.
The time between power-on, can take from a few times to a few times per hour. It is not predictable.
In the case of a few times per hour, it compensates the Light Sleep, but in case of a few times per day no compensates.

1.8s I find plenty of time for the connection. There are not so many packets to be sent ... should not connect faster?
I say this because I have here an old work, using a wifi module from Microchip, which can register in 0.4s (I did not do it nor did I see it working, I only have wireshark log).

It also seems to me (see previous image) that ESP is trying to do something up to 0.584s. Failing, after 1.8s does deauthentication and repeats all over again.
This process always takes place this way every time. Could there be an error in the SDK related to the connection?

Also, Sorry for the late reply.
I did start a reply but then i realised i had my SSID and WiFi password in the git repository  |O :-DD
I must say its not like me to forget about that stuff, but at least that password was one of my more generic public ones.
:-DD :-DD :-DD :-DD |O |O |O :-DD :-DD :-DD :-DD
 

Offline bitseeker

  • Super Contributor
  • ***
  • Posts: 9057
  • Country: us
  • Lots of engineer-tweakable parts inside!
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #6 on: May 25, 2017, 10:06:46 pm »
Leon, thanks for the info on your project. I had not seen this kind of low-power setup before where Wi-Fi is kept running during sleep for faster response upon waking. I like it and will be considering doing something similar for a network-enabled thermostat.
TEA is the way. | TEA Time channel
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #7 on: May 27, 2017, 08:25:15 am »
Thanks for the interest  :)
I had read a number of things in the Low Power Solutions PDF for the ESP8266, but i had not seen anyone implement it.
And this became more obvious when researching how to use the ESP8266 in these ways.

The silicon has quite a few quirks when used like this, so most of the time was spent learning those, but in the end, i believe the proof of concept is there. ~10mW and mostly real time.

Feel free to ask anything if you do use this method.
I will eventually be adding basic a web client to transmit JSON data along with the server, and adding an 8 channel analogue switch with some limit detection that is configurable by sending JSON data to the ESP8266.

Do let me know how you get on if you do use this technique :-) The more quirks i know, the easier this thing is to get stable when run for years on end.
Damn forum is making me procrastinate from work!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #8 on: June 03, 2017, 02:36:47 am »
Just an update for this project.

I have decided to implement a reasonably standard REST server. It still needs some tidying up, but its working, and endpoints are modular.
Currently only has dummy response at endpoint /adc/0

I still have an issue where the ESP8266 stays awake for no apparent reason, So power consumption changes daily. Some days it will sleep when expected, and some days it wont.
Anyway, still the most efficient real time solution i have found.
Damn forum is making me procrastinate from work!
 

Offline bitseeker

  • Super Contributor
  • ***
  • Posts: 9057
  • Country: us
  • Lots of engineer-tweakable parts inside!
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #9 on: June 05, 2017, 03:27:25 am »
Feel free to ask anything if you do use this method.
...
Do let me know how you get on if you do use this technique :-) The more quirks i know, the easier this thing is to get stable when run for years on end.

I shall. The module with ESP8266 and relay just arrived. My work schedule is kind of crazy now, but I will post any interesting results, quirks, or other findings.
TEA is the way. | TEA Time channel
 

Offline alexluke

  • Newbie
  • Posts: 2
  • Country: us
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #10 on: June 05, 2017, 05:32:27 am »
I still have an issue where the ESP8266 stays awake for no apparent reason, So power consumption changes daily. Some days it will sleep when expected, and some days it wont.

I just finished debugging an issue where writing past the end of a buffer was preventing the ESP8266 from deep sleeping. It appeared to sleep, but power consumption remained high. Not sure if that's related at all to your issue, but it might be something to double check.
 

Offline Muxr

  • Super Contributor
  • ***
  • Posts: 1369
  • Country: us
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #11 on: June 05, 2017, 05:47:29 am »
Sorry for the delay.

I got an "airPcap" and I'm looking at all packets with wireshark.

But I have doubts about the beginning. This takes 1.8sec to do something, before starting DHCP.

From DHCP Discovery to DHCP Request takes about 1s.

I have to understand what it's doing to take 1.8sec ... but networking is not my area.


Some DHCP servers will actually ping the IP address they are trying to issue via DHCP in order to make sure there is no IP conflict. I would first check your DHCP server that's issuing the IP. See if it's sending any ICMP packets to the IP it ends up issuing.

If that's the source of your delay, perhaps don't release the DHCP address when you go offline and try reusing it before attempting to request a new lease.
 
The following users thanked this post: Dave_PT

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #12 on: June 05, 2017, 10:14:28 am »
Updated repository with working REST server, but not actually attached to the ADC. Still need to make the REST client to finish off that stuff.

The stability issues were caused by the sudden current draw on GPIO14 to charge the interrupt capacitor.

My testing now involves making REST requests to the ESP8266 every 60 seconds.

Current power consumption is 86mW, but i can see that it is staying awake a lot! So there may well be some buffer overflows or something happening.
Resetting the sleep states sometimes helps with this, will try again tomorrow.

The readme.md is also more useful for people trying to use this source.
Let me know of anything that i missed since i have no idea what is it like starting from scratch with this repository.

Cheers!
Damn forum is making me procrastinate from work!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #13 on: June 06, 2017, 10:18:34 am »
Pushed another version.. Read the notes in Git.

Has unstable, but working REST client now, still messy and ugly.. But proof of concept is working.
Damn forum is making me procrastinate from work!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #14 on: June 07, 2017, 08:44:10 am »
Also forgot to mention that i had a play with the sleep settings again and managed to get 37.2mW RMS / 18mW Average after close to 7 hours of testing.
This could be halved by the wake delay. And this is still with the IC receiving REST requests every 60 seconds.


1 / Yellow: Current
2 / Green: Supply voltage
M1 / Pink: Power (Current * Voltage)
Blue trace is the capacitor on GPIO14 used to wake the IC.

 
Damn forum is making me procrastinate from work!
 
The following users thanked this post: bitseeker

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #15 on: June 07, 2017, 10:58:02 am »
maybe I'm overlooking something, but what is mW RMS?
We Are The Watt - Resistance Is Futile!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #16 on: June 07, 2017, 10:04:39 pm »
maybe I'm overlooking something, but what is mW RMS?

Milliwatt, measured using RMS value of the full screen of the scope (Not per cycle) - DC RMS - FS
I also have the average value for comparison.

I will check my scope for area calculations as well, that would be more useful than RMS.
RMS isn't really the right method to use, but it was yielding good enough numbers for me to compare power consumption between modifications.

Edit - Added quote of what i am replying to
Damn forum is making me procrastinate from work!
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #17 on: June 08, 2017, 04:05:12 pm »
maybe I'm overlooking something, but what is mW RMS?

Milliwatt, measured using RMS value of the full screen of the scope (Not per cycle) - DC RMS - FS
I also have the average value for comparison.

I will check my scope for area calculations as well, that would be more useful than RMS.
RMS isn't really the right method to use, but it was yielding good enough numbers for me to compare power consumption between modifications.

Edit - Added quote of what i am replying to
Root Mean Square is only valid for voltages and currents, when you want to compare power consumption, then the average function is the right one. The averaging function should be actually doing just what you want: it calculates the surface area of your trace, and divides it by the time interval. That is not to confuse with display averaging, where the scope calculates a pixel wise average.
We Are The Watt - Resistance Is Futile!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #18 on: June 09, 2017, 05:11:11 am »
maybe I'm overlooking something, but what is mW RMS?

Milliwatt, measured using RMS value of the full screen of the scope (Not per cycle) - DC RMS - FS
I also have the average value for comparison.

I will check my scope for area calculations as well, that would be more useful than RMS.
RMS isn't really the right method to use, but it was yielding good enough numbers for me to compare power consumption between modifications.

Edit - Added quote of what i am replying to
Root Mean Square is only valid for voltages and currents, when you want to compare power consumption, then the average function is the right one. The averaging function should be actually doing just what you want: it calculates the surface area of your trace, and divides it by the time interval. That is not to confuse with display averaging, where the scope calculates a pixel wise average.
I don't know why i didn't just think about that earlier. That makes perfect sense.
I guess i was just trying to get relative data and didn't really care too much about the actual data, which i need to now..
I will be using mW/s area calculations going forward.
Annoyingly though, I think i am getting a lot of noise that is not showing up because i am using high resolution mode, and it is causing the baseline current to be ~-800uW/s.
Which is skewing the results, since the power consumption i am reading is about 4mW/s (without REST requests), but realistically closer to 5mW/s.
And i need to watch my ground paths, might need to only run it from a battery going forward since i don't have any fancy active or current probes.
Damn forum is making me procrastinate from work!
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #19 on: June 09, 2017, 05:57:59 am »
maybe I'm overlooking something, but what is mW RMS?

Milliwatt, measured using RMS value of the full screen of the scope (Not per cycle) - DC RMS - FS
I also have the average value for comparison.

I will check my scope for area calculations as well, that would be more useful than RMS.
RMS isn't really the right method to use, but it was yielding good enough numbers for me to compare power consumption between modifications.

Edit - Added quote of what i am replying to
Root Mean Square is only valid for voltages and currents, when you want to compare power consumption, then the average function is the right one. The averaging function should be actually doing just what you want: it calculates the surface area of your trace, and divides it by the time interval. That is not to confuse with display averaging, where the scope calculates a pixel wise average.
I don't know why i didn't just think about that earlier. That makes perfect sense.
I guess i was just trying to get relative data and didn't really care too much about the actual data, which i need to now..
I will be using mW/s area calculations going forward.
Annoyingly though, I think i am getting a lot of noise that is not showing up because i am using high resolution mode, and it is causing the baseline current to be ~-800uW/s.
Which is skewing the results, since the power consumption i am reading is about 4mW/s (without REST requests), but realistically closer to 5mW/s.
And i need to watch my ground paths, might need to only run it from a battery going forward since i don't have any fancy active or current probes.
it is important for such a measurement to let the scope either measure an integer multiple of intervals (variable time base available?) or, if not possible (or if waveform is not cyclic), a large number of intervals.
We Are The Watt - Resistance Is Futile!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #20 on: June 13, 2017, 05:02:46 am »
maybe I'm overlooking something, but what is mW RMS?

Milliwatt, measured using RMS value of the full screen of the scope (Not per cycle) - DC RMS - FS
I also have the average value for comparison.

I will check my scope for area calculations as well, that would be more useful than RMS.
RMS isn't really the right method to use, but it was yielding good enough numbers for me to compare power consumption between modifications.

Edit - Added quote of what i am replying to
Root Mean Square is only valid for voltages and currents, when you want to compare power consumption, then the average function is the right one. The averaging function should be actually doing just what you want: it calculates the surface area of your trace, and divides it by the time interval. That is not to confuse with display averaging, where the scope calculates a pixel wise average.
I don't know why i didn't just think about that earlier. That makes perfect sense.
I guess i was just trying to get relative data and didn't really care too much about the actual data, which i need to now..
I will be using mW/s area calculations going forward.
Annoyingly though, I think i am getting a lot of noise that is not showing up because i am using high resolution mode, and it is causing the baseline current to be ~-800uW/s.
Which is skewing the results, since the power consumption i am reading is about 4mW/s (without REST requests), but realistically closer to 5mW/s.
And i need to watch my ground paths, might need to only run it from a battery going forward since i don't have any fancy active or current probes.
it is important for such a measurement to let the scope either measure an integer multiple of intervals (variable time base available?) or, if not possible (or if waveform is not cyclic), a large number of intervals.
I usually use the scopes statistics feature as pictured in screen shots in earlier posts. Then once i think i have something working as i wanted it, i will leave it running for around 12 hours to get a large sample size then look at the mean.
I do get variations based on the battery voltage. But my main concern is the tiny below zero readings i am getting which could skew the results far too much.
This was happening when i used two probes over a resistor and subtracting them together to get the voltage difference on the high side. And also when using a single probe across the shunt resistor common with a single ground and USB powered.
Ill be adding a separate RS232 to USB to it which will just be for listening to the ESP8266 as the output lines on the one used for programming does all sorts of crazy things to the ground and also feeds current into the RX pin on the ESP8266 which does skew the power readings.
Damn forum is making me procrastinate from work!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #21 on: September 11, 2017, 11:45:16 am »
UPDATE:

I have started back on this, and i have just grabbed the MQTT example code and mashed my sleep code into it and it seems to work well!

If you need a low power sensor that can fire an MQTT message in real time, this should do the trick.
MQTT is working both ways, but only client -> broker can be real time while sleep is enabled.


https://github.com/leon-v/ESP8266-Real-Time-Low-Power
Damn forum is making me procrastinate from work!
 

Offline LeonVTopic starter

  • Contributor
  • Posts: 39
  • Country: nz
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #22 on: August 13, 2018, 04:08:22 am »
UPDATE:

The ESP8266 was only capable of using the low power i wanted when using a router that had configurable DITM intervals and felt like using them.
This was not a good solution since i can't expect anyone who may use this to buy a new router.

So i have made a router that routers MQTT data from radio modules to an MQTT server.
Currently working on re-coding the router into the RTOS for the ESP8266, and polishing my NRF24L01+ drivers.

https://github.com/leon-v/MQTT-ESP8266-nRF24L01-Solar-Battery-I-O-Network
Damn forum is making me procrastinate from work!
 

Offline ZigmundRat

  • Regular Contributor
  • *
  • Posts: 122
  • Country: us
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #23 on: August 14, 2018, 02:32:24 pm »
I know this reply doesn't contribute anything exactly, but there's  folks out here watching the thread, so thanks for the update. I will continue to watch the thread- and hopefully have more time to work on this kind of stuff before long.
 

Offline bitseeker

  • Super Contributor
  • ***
  • Posts: 9057
  • Country: us
  • Lots of engineer-tweakable parts inside!
Re: Real time + Low Power (10mW) ESP8266 Expirments
« Reply #24 on: August 14, 2018, 09:06:53 pm »
Thanks for the update, Leon.

For my project, the relay module with onboard ESP8266 that I got wasn't designed with sleep in mind. So, it'll need some bodging to get it to work, or I might make my own PCB. Not sure which road I'll take, yet, as other projects jumped ahead of the line.
TEA is the way. | TEA Time channel
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf