Does network.WLAN.deinit() turn off WiFi radio part of ESP32 in 1.6.13.b1?



  • I am trying to figure out if network.WLAN.deinit() turns off WiFi radio part of ESP32 in 1.6.13.b1.

    I am using following method for power consumption measurement:
    http://community.silabs.com/t5/32-bit-MCU/How-to-use-an-STK-to-measure-current-consumption-on-your-own/td-p/98363

    boot.py:

    import os
    from machine import UART
    uart = UART(0, 115200)
    os.dupterm(uart)
    

    main.py:

    import pycom
    from network import WLAN
    
    pycom.heartbeat(False)
    wlan = WLAN()
    wlan.deinit()
    

    After connecting STK board as power source to Expansion Board 2.0 with LoPy through battery JST connector I observed current spike immediately:
    alt text

    Or after some time:
    alt text
    alt text

    In case of not calling wlan.deinit() in main.py current spikes appear immediately and are repeating periodically:
    alt text

    It seems that network.WLAN.deinit() makes some difference in power consumption patter. What could be causing those remaining spikes in case WLAN is initialized?



  • @jmarcelino With pycom.wifi_on_boot(False), I started using rshell, which I truly enjoy.

    It allows me to keep on writing code with vim (instead of atom) whilst rendering the upload and running of scripts really easy.

    The rshell command line tool definitely also merits mentioning in the documentation.



  • @jmarcelino That did it. Thanks!
    I was reading the WLAN section of the documentation where this is not mentioned. As a newbee, it never crossed my mind to also look in the pycom section.

    Perhaps a cross link in the WLAN documentation section would easy the path for others to come…

    I definitely looking forward to BLE support. I do hope it will be possible to switch off WLAN whilst keeping BLE.



  • @on4aa
    Yes WLAN.deinit() powers off WIFi radio.

    You now also have pycom.wifi_on_boot([enable]) to disable WiFi even before deinit is called: https://docs.pycom.io/chapter/firmwareapi/pycom/pycom.html

    BLE is currently very similar in energy to WIFi this will be addressed in the next major update of the ESP-IDF low level libraries



  • I am also interested in turning WLAN completely off. Have you found an answer in the meantime?

    I might be mistaken, but Bluetooth BLE might be employing the same radio and antenna but with less power.



  • Last sentence should be:
    What could be causing those remaining spikes in case WLAN is NOT initialized?


 

Pycom on Twitter