Turn WIFI Off On ESP8266 Boards
Turn WIFI Off On ESP8266 Boards
Is there a way to turn the WIFI off on 8266 boards using MicroPython? Turning the WIFI off when using Arduino is discussed here: https://github.com/esp8266/Arduino/issues/644
Re: Turn WIFI Off On ESP8266 Boards
Is this what you are after?
http://docs.micropython.org/en/latest/e ... networking
http://docs.micropython.org/en/latest/e ... sleep-mode
Code: Select all
import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(False)
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)
http://docs.micropython.org/en/latest/e ... sleep-mode
Re: Turn WIFI Off On ESP8266 Boards
Yes, thank you mcauser. At least with the Arduino, it sounds like sometimes the 8266's WIFI capability isn't shut down properly and still continues to draw full power. I'll need to double check to see if that happens with this board.
Re: Turn WIFI Off On ESP8266 Boards
Only the interfaces are deactivated. There is no reduction in RF power usage implemented as far as i do understand from the source code.
Re: Turn WIFI Off On ESP8266 Boards
Ok, thanks. The power reduction is the main thing I'd like to have.
Re: Turn WIFI Off On ESP8266 Boards
The radio can be disabled using sleep modes and deep sleep.
http://docs.micropython.org/en/latest/e ... y/esp.html
Get / set sleep modes. SLEEP_MODEM is the default.
This wraps wifi_set_sleep_type() in the SDK.
Sleep until the reset button is pressed.
These wrap system_deep_sleep_set_option() and system_deep_sleep() in the SDK.
Sleep for 2 seconds (2,000,000us) then wake.
You need to have GPIO16 connected to RST for the board to wake.
After waking, you can check the reset cause.
Mode info on sleep modes: http://www.espressif.com/sites/default/ ... s_en_0.pdf
http://docs.micropython.org/en/latest/e ... y/esp.html
Get / set sleep modes. SLEEP_MODEM is the default.
This wraps wifi_set_sleep_type() in the SDK.
Code: Select all
>>> import esp
>>> esp.sleep_type()
2
>>> esp.SLEEP_MODEM
2
>>> esp.sleep_type(esp.SLEEP_NONE)
sleep disable
>>> esp.sleep_type()
0
>>> esp.sleep_type(esp.SLEEP_MODEM)
sleep enabled,type: 2
>>> esp.sleep_type(esp.SLEEP_LIGHT)
sleep enabled,type: 1
These wrap system_deep_sleep_set_option() and system_deep_sleep() in the SDK.
Code: Select all
>>> import esp
>>> esp.deepsleep()
You need to have GPIO16 connected to RST for the board to wake.
Code: Select all
>>> import esp
>>> esp.deepsleep(2000000)
Code: Select all
>>> import machine
>>> machine.reset_cause()
5
>>> machine.DEEPSLEEP_RESET
5
Re: Turn WIFI Off On ESP8266 Boards
Awesome, thank you. That's very helpful.
Re: Turn WIFI Off On ESP8266 Boards
I did recon that the OP wanted to have the CPU be active and only the WiFi be powered down completely.
Browsing the ESP documentation's I have seen that the ESP can be booted this way by juggling with some registers.
Browsing the ESP documentation's I have seen that the ESP can be booted this way by juggling with some registers.