Modem sleep
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 2
- Joined: 19 Mar 2017, 08:13
Modem sleep
I there , is there a way to use the modem sleep with esp easy.
Esp 8266 has 3 sleep mode :
modem sleep 15 mAh
light sleep 0.5 mAh
deep sleep 10uah
with modem sleep and light sleep we can still use control of GPIO .
I've search a lot on the internet about this option in esp easy with no success.
Regards
Esp 8266 has 3 sleep mode :
modem sleep 15 mAh
light sleep 0.5 mAh
deep sleep 10uah
with modem sleep and light sleep we can still use control of GPIO .
I've search a lot on the internet about this option in esp easy with no success.
Regards
-
- Normal user
- Posts: 22
- Joined: 03 Mar 2016, 09:06
Re: Modem sleep
This would be of interest for me too!
(As well as sending the ESP to sleep via rules)
(As well as sending the ESP to sleep via rules)
-
- New user
- Posts: 2
- Joined: 19 Mar 2017, 08:13
Re: Modem sleep
For sure. I am making autonomous solar greenhouse, I could divide by 2 power consumption with this, and keep automation even when WiFi off.
Wifi only use is for sending data to my website. Unless automation control which needs to be always on wifi does not.
Wifi only use is for sending data to my website. Unless automation control which needs to be always on wifi does not.
Re: Modem sleep
I have made a highly experimental plugin to use modemsleep functionality instead deepsleep.frogmangeek wrote: ↑25 Mar 2017, 09:44 For sure. I am making autonomous solar greenhouse, I could divide by 2 power consumption with this, and keep automation even when WiFi off.
Wifi only use is for sending data to my website. Unless automation control which needs to be always on wifi does not.
In this mode, the cpu is running, only the wifi switched off. Light sleep mode can not be used for this kind of operation as the CPU is suspended, as in deepsleep mode.
http://bbs.espressif.com/viewtopic.php?t=133
Steps:
1/ Download the attached binary, unzip and flash it (image is for 4M flash)
2/ You have to start ESPEasy and enable the WiFiMan plugin
3/ After it, two commands can be used in rules:
modemsleep and settx
Example of usage:
Setting the WiFi TX power to 0:
settx,0
Setting the WiFi TX power to maximum:
settx,21
(Though I do not see any difference in power usage and RSSI remains the same with TX 0??)
Enable modem sleep & switch off WiFi:
modemsleep,1
Disable modem sleep & switch on WiFi & reconnect:
modemsleep,0
Timing can be done in rules, such as:
---
On wifisleep do
modemsleep,1 // stop wifi
timerSet 1,30 // for 30 sec
EndOn
On Rules#Timer=1 do
modemsleep,0 // then wake wifi
EndOn
---
Then you can call this event as:
http://ESP_IPADDRESS/control?cmd=event,wifisleep
I've measured near zero consumption in modemsleep mode, with a basic Charger Doctor. (as per the data sheet it's 15mA)
If IP address set to static it is faster to reconnect and it is good for battery life.
Data sending needs to be implemented when wifi is on, for example with Publish, then after some time it can be automatically go for modemsleep again.
Test results are welcomed.
- Attachments
-
- ESPEasy.ino.1024.zip
- ESPEasy Mega with ModemSleep function 1M/128k
- (403.36 KiB) Downloaded 517 times
-
- ESPEasy_modemsleep.zip
- ESPEasy Mega with ModemSleep function
- (413.17 KiB) Downloaded 630 times
Last edited by enesbcs on 17 Dec 2017, 21:38, edited 1 time in total.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Modem sleep
Whoo hoo, sounds like a cool feature. Might want to put that on the playground?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Modem sleep
I am currently awaiting my P165 plugin pull request to finish, after it i will push this P166 to the playground.grovkillen wrote: ↑28 Nov 2017, 22:28 Whoo hoo, sounds like a cool feature. Might want to put that on the playground?
I am using WiFI.setOutputPower for the TX power setting, but i am not sure, that it is working. If not, i will remove it completely.
The modemsleep function is working according to my first tests, but sometime, when wifi can not disconnect completely, the consumption stays high despite that there is no ping response.
Re: Modem sleep
Source code is on github:grovkillen wrote: ↑28 Nov 2017, 22:28 Whoo hoo, sounds like a cool feature. Might want to put that on the playground?
https://github.com/enesbcs/ESPEasyPlugi ... iFiMan.ino
Needs some testers.
Re: Modem sleep
Next test version of WifiMan plugin with modemsleep.
Plugin values:
1: "ModemSleep" = Modemsleep status 1=active, 0=not active
2: "TX" = last output power via settx
3: "Connected" = Wifi connection status, 0=disconnected,1=connected
4: "KillAP" = AP possibility status, 0=do not care,1=stop if activated
Raised events:
- Modemsleep started
System#ModemSleep=1
- Modemsleep stopped
System#ModemSleep=0
- Wifi connected
System#WifiState=1
- Wifi disconnected
System#WifiState=0
Commands:
- Disable AP mode usage:
killap,1
- Enable AP mode usage:
killap,0
- Set WiFi output power: (0-21)
settx,21
- Enter ModemSleep mode
modemsleep,1
- Exit from ModemSleep mode
modemsleep,0
Example rules code - untested, should work...
(wifiman = task name of WifiMan plugin)
Plugin values:
1: "ModemSleep" = Modemsleep status 1=active, 0=not active
2: "TX" = last output power via settx
3: "Connected" = Wifi connection status, 0=disconnected,1=connected
4: "KillAP" = AP possibility status, 0=do not care,1=stop if activated
Raised events:
- Modemsleep started
System#ModemSleep=1
- Modemsleep stopped
System#ModemSleep=0
- Wifi connected
System#WifiState=1
- Wifi disconnected
System#WifiState=0
Commands:
- Disable AP mode usage:
killap,1
- Enable AP mode usage:
killap,0
- Set WiFi output power: (0-21)
settx,21
- Enter ModemSleep mode
modemsleep,1
- Exit from ModemSleep mode
modemsleep,0
Example rules code - untested, should work...
(wifiman = task name of WifiMan plugin)
Code: Select all
on System#Boot do
killap,0 // AP mode possible for 60sec
timerSet,1,60
endon
On Rules#Timer=1 do
killap,1 // AP mode disable
endon
on System#WifiState=0 do // if no wifi connection
if [wifiman#ModemSleep] = 0 // if modemsleep not active
timerSet,2,10 // after 10sec go to timer2
endif
endon
On Rules#Timer=2 do
If [wifiman#Connected] = 0 // if no wifi connection
modemsleep,1 // enter modemsleep mode
timerSet,3,600 // for 10 minute
endif
endon
On Rules#Timer=3 do
if [wifiman#ModemSleep] = 1 // if modemsleep active
modemsleep,0 // exit from modemsleep and reconnect wifi
timerSet,2,10 // wait for 10sec then recheck wifi status
endif
endon
- Attachments
-
- ESPEasy.1024.zip
- ESPEasy 1M/128k binary with P166
- (403.54 KiB) Downloaded 438 times
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Modem sleep
Looks good! Might be able to test this week...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Modem sleep
I'm not offended if certain WiFi features will be embedded to the ESPEasy core.
Re: Modem sleep
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Modem sleep
Main code don't you think?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Modem sleep
+1 for inclusion in main code
It would be very practical if we could choose whether to use Deep sleep or Modem sleep, as the project needs it.
Deep sleep runs for a pre-defined time, but user can return from Modemsleep anytime, for example from a rule command. And of course Modem sleep could be used with timer.
There are two possible usage what i can imagine:
1. some plugin got results/alert and restore wifi connection, send the values to the controllers and returns to modemsleep until further notice (with rules maybe)
2. modem sleep timers runs off,reconnects to wifi and runs other tasks as Deep sleep does, then returns to modemsleep
Also i see an other use-case: if no wifi connection to x seconds then go to Modemsleep, retry connecting after y minutes, and so on..
This plugin uses a dirty trick manipulating global "wifiSetup" variable to prevent ESPEasy to try to connect at all when in modemsleep mode. I am sure it can be done in a more elegant way if it will be transferred to the main code. (Maybe patching WifiCheck() function)
Also there has to be a more simple solution to Disable AP mode if the users will not need it than my KillAP method, that checks every seconds and kill it on site.
-
- Normal user
- Posts: 66
- Joined: 16 Feb 2017, 09:23
Re: Modem sleep
What is the current status of this?
I want to use this functionality, but I want to know how I can implement this in the last build of esp easy
I want to use this functionality, but I want to know how I can implement this in the last build of esp easy
Re: Modem sleep
This is the last status: https://github.com/letscontrolit/ESPEasy/pull/1862
I did start to port the plugin, but then was working a lot on the WiFi instability itself.
So that's why it was not merged, I first had to make sure we're getting stable first before introducing another possible set of reported crashes.
And now it has become clear one of the crashes was caused by the reconnect of WiFi, which would have caused more crashes with modem sleep enabled.
There is now also another option in the core libraries to increase the number of beacon intervals it will skip (1 .. 10), but I guess that one also may cause issues when the ESP has to reply to requests.
It is somewhat inbetween "active" and "modem sleep".
Combined with the "eco mode" (advanced settings, somewhere bottom page) it may save quite some energy (70 mA => 20~30 mA)
I did start to port the plugin, but then was working a lot on the WiFi instability itself.
So that's why it was not merged, I first had to make sure we're getting stable first before introducing another possible set of reported crashes.
And now it has become clear one of the crashes was caused by the reconnect of WiFi, which would have caused more crashes with modem sleep enabled.
There is now also another option in the core libraries to increase the number of beacon intervals it will skip (1 .. 10), but I guess that one also may cause issues when the ESP has to reply to requests.
It is somewhat inbetween "active" and "modem sleep".
Combined with the "eco mode" (advanced settings, somewhere bottom page) it may save quite some energy (70 mA => 20~30 mA)
Re: Modem sleep
Hi,
i compiled espeasy and added the _P166_WiFiMan.ino file to the src folder with the other ino files.
i have uploaded the sketch to an esp but when i added a rule and it runs the command 'killap' it says its an unknown command.
do i need to enable the plugin or am i missing something?
Thanks
i compiled espeasy and added the _P166_WiFiMan.ino file to the src folder with the other ino files.
i have uploaded the sketch to an esp but when i added a rule and it runs the command 'killap' it says its an unknown command.
do i need to enable the plugin or am i missing something?
Thanks
Re: Modem sleep
Yes, without adding and enabling a plugin the commands inside of it will not work.
Re: Modem sleep
Thank you. I found the problem, it was an issue between keyboard and chair.
Who is online
Users browsing this forum: No registered users and 120 guests