-->
Page 1 of 2

Can I compile an ESP8266 program without including WiFi?

PostPosted: Sun Jul 09, 2017 6:16 am
by Robin2
I'm new here but I have been participating in the Arduino Forum for a while.

As I understand it the normal usage of an ESP2866 requires the "WiFi side" to be called at regular intervals. That could interfere with precise timing of other things. If I did not need the WiFi capability could I compile an ESP2866 program without any of the WiFi capability so that I could use it as a cheap simple 80MHz microprocessor?

Thanks

...R

Re: Can I compile an ESP8266 program without including WiFi?

PostPosted: Mon Jul 10, 2017 10:37 am
by johnnyfrx
Yes...you can run the ESP without running the WiFi on it.

Re: Can I compile an ESP8266 program without including WiFi?

PostPosted: Mon Jul 10, 2017 11:16 am
by rudy
Even if you compile without wifi included it may still be active due to retained previous settings. So make sure you turn wifi off in the code rather than just excluding it.

I think you need to include the following.

#include <ESP8266WiFi.h>

add the following lines at the beginning of your setup()

WiFi.disconnect();
WiFi.mode(WIFI_OFF);

Re: Can I compile an ESP8266 program without including WiFi?

PostPosted: Mon Jul 10, 2017 5:16 pm
by QuickFix
You can also turn off WiFi RF completely, but then the watchdog will kick in after a few ms, so you'll have to reset it every once in a while in your code as well.

Turn off WiFi RF, eg. in setup():
Code: Select allWiFi.forceSleepBegin();

Then, in your loop, regularly reset the watchdog using:
Code: Select allwdt_reset();


Note, that you can also double-clock your ESP, so it will run on 160MHz instead of 80MHz.
In setup() do:
Code: Select allsystem_update_cpu_freq(160);