Copyright ©

Mongoose OS Forum

ATTENTION! This forum has moved to:

Do not post any new messages.

Power Saving by Turning off Wifi Antenna with the ESP8266

Is there a way to toggle the antenna on and off to use less power?

Is there a way to bootup the way described above?

I tried to turn off the wifi antenna in order to use less energy when it is not needed with version 1.26. I tried setting station mode and ap mod and OS indicated that Wifi was off. However, when I measured the current drawn from the ESP, it still consumed 70mah.

Is this expected behavior?

I tried to add a custom method to directly modify it with the SDK, however I had mixed results where it might sometimes work, but I could never get it to turn back into STA mode without it freezing up.

int mgos_system_toggle_wifi(int mode){
    if(mode == 0){
    else if(mode == 1){
    return 0;


Thank you all for your help!


  • gordogordo Alberta Canada

    Did you have any success on this?. Im trying similar to hopefully stabilize ADC reads.

  • edited May 2018

    The first question yes, the second question, I haven't confirmed but I don't think so.

    For the power saving mode, don't call sleep mode manually, so don't call wifi_set_sleep_type or wifi_fpm_open. Use the function wifi_fpm_auto_sleep_set_in_null_mode(1) at some point prior to disconnecting and setting the opt mode, and it works as expected. This function according to the SDK docs I found, automatically turns off the antenna when set to NULL_MODE. The wifi antenna will startup again just by setting the opmode to the mode you want and then calling the connect function. If you do a custom build, you add this code and modify one of the c files used when starting up, but I still get a jolt to 70mah when starting up at least for a second or two. Good luck and hopes this helps.

  • gordogordo Alberta Canada

    Definitely helps applecrusher and thanks.
    On the ADC issue, I'm sampling a MPX5010 pressure sensor. Its connected via a voltage divider and mfg recommended decoupling and filtering. Sampling every 2 secs. In sustained operation I get approximately 1 or 2 out of 30 reads ~50% lower than the consistent values. I've seen other esp8266 related articles pointing to Wifi sleep functions interfering so might apply and test what you've figured out. The SDK documentation sketchy as it it is eludes to this as well. Ill post what i fin.
    Thanks again

Sign In or Register to comment.