Speed up boot time after "deep sleep" and reduce WiFi activity

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
VladVons
Posts: 43
Joined: Sun Feb 12, 2017 6:49 pm
Location: Ukraine

Speed up boot time after "deep sleep" and reduce WiFi activity

Post by VladVons » Fri Mar 13, 2020 9:36 pm

I try to use ESP8266 with independent aku power supply, so mimimizing power consumption is important.
DeepSleep uses 0,2 mA
Wake up and WiFi activity uses 70-150 mA for a 3-6 seconds to connect to a router.
Is it possible to reduce WiFi negotiation time?
I think assign static IP address would be a solution or something else...
Last edited by VladVons on Sat Mar 14, 2020 9:53 am, edited 3 times in total.

User avatar
tve
Posts: 104
Joined: Wed Jan 01, 2020 10:12 pm
Location: Santa Barbara, CA
Contact:

Re: Speed up boot time after "deep sleep" and reduce WiFi activity

Post by tve » Fri Mar 13, 2020 9:40 pm

This is what I know on the topic: https://blog.voneicken.com/2018/lp-wifi-esp8266-1/

VladVons
Posts: 43
Joined: Sun Feb 12, 2017 6:49 pm
Location: Ukraine

Re: Speed up boot time after "deep sleep" and reduce WiFi activity

Post by VladVons » Sat Mar 14, 2020 7:31 am

loading micropython kernel and init own classes
1.7 seconds

WiFi Connection
With no parameters (previous ESP ROM data):
3.5 seconds for connect

With static IP address + 'bssid' parameter:
2.5 seconds for connect

In post above from 'tve' pointed about 0.175 sec with ssid, passwd, channel, bssid, ip, mask, gw, dns
I tried, but Net.connect() 'channel' is wrong keyword for STA_IF mode

Code: Select all

Net = network.WLAN(network.STA_IF)
Net.active(True)
Net.ifconfig(('192.168.2.206', '255.255.255.0', '192.168.2.1', '192.168.2.1'))
Net.connect('MyESSID', '1971xxxx', bssid = b'\xB8\x69\xF4\xBD\x8F\xDC')
while (not Net.isconnected()):
	machine.idle()
	time.sleep(0.25)
# read DHT sensor
# send MQTT data
# deep sleep
As i understand bssid is a MAC address (B8:69:F4:BD:8F:DC) of WiFi interface MikroTik router

https://docs.micropython.org/en/latest/ ... .WLAN.html
https://docs.micropython.org/en/latest/ ... /wlan.html

But, when i connect my notebook to WiFi router with such fixed parameters it takes 0.1 seconds
ESP connects with 2.5 sec.
25 times slower as usual notebook !

User avatar
jimmo
Posts: 1440
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Speed up boot time after "deep sleep" and reduce WiFi activity

Post by jimmo » Mon Mar 16, 2020 3:59 am

See my reply to your other thread about setting the channel. (Note you'll need to modify the C code to make this work).

GryKyo
Posts: 12
Joined: Sat Dec 15, 2018 12:43 am

Re: Speed up boot time after "deep sleep" and reduce WiFi activity

Post by GryKyo » Mon Mar 23, 2020 9:36 am

Does ESPNOW work in uPython environment? As ESP8266 devices cost so little, battery powered devices could use the ESPNOW utility for very rapid boot-tx-sleep cycles where a second device is on the same permanent power supply as the WAP infrastructure. In fact the receiving device could use a serial or serial to USB interface to relay on sensor data or what ever the case may be. This is not quite as versatile as for example LoRa for either range or low power but in an instance where typical WiFi range is acceptable but typical WiFi up-time is a power issue then this is surely a compromise.

Has anybody built a ESPNOW module for micropython?

Garry

User avatar
rcolistete
Posts: 187
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: Speed up boot time after "deep sleep" and reduce WiFi activity

Post by rcolistete » Tue Mar 24, 2020 12:19 am

GryKyo wrote:
Mon Mar 23, 2020 9:36 am
Has anybody built a ESPNOW module for micropython?
M5Stack UIFlow flavor of MicroPython has ESPNow support :
https://github.com/m5stack/UIFlow-Code/ ... ed#esp-now

Post Reply