One of the biggest advantages of using the ESP8266 in your projects is how easy it is to get WiFi up and running. Just plug in the WiFi library, put the SSID and encryption key in your source code, and away you go. It authenticates with your network in seconds and you can get on with building your project. But things get a little trickier if you want to take your project someplace else, or distribute your source code to others. Quickly we learn the downside of using static variables for authentication.
While there are already a few solutions to this problem out there, [Martin Raynsford] wasn’t too thrilled with them. Usually they put the ESP8266 in Access Point mode, allow the user to connect, and then ask which network they should authenticate with. But he didn’t want his projects to require an existing network, and figured he could do just as well making a field-configurable AP.
Using it is simple. Once the ESP8266 starts up it will create a new network in the form of “APConfig XXXXXX”, which should be easy enough to find from your client side device. Once connected, you can go to a simple administration page which allows you to configure a new AP name and encryption key. You even have the option to create an open AP by leaving the “Password” field blank. Once rebooted, the ESP8266 will create a new network with the defined parameters.
[Martin] has also included a “backdoor” to let anyone with physical access to the ESP8266 board create a new open AP that can be used to reconfigure the network settings. During boot up there is a brief period, indicated with specific blinks of the LED, wherein you can hit the reset button and trigger the open AP. This keeps you from getting locked out of your own project if you forget what key you gave it.
If you’re not one to go the austere route, take a look at some of the more robust solutions we’ve seen for easier end-user setup of the ESP8266.
19 thoughts on “Easy Access Point Configuration On ESP8266”
I’m trying to understand… This article is about someone putting up a web interface to configure the esp8266’s AP settings??? Really? Plenty of existing esp8266 projects have had that feature for a long time…
As he sasy in the article, he is aware of other solutions but they dont fit his requirements for simplicity so he did his own.
Personally I typically hard code my creds in code and then keep records against the MAC.
Sometimes I sent out such info on serial at boot, knowing it’s secure enough since if you are reading the serial port you either own or pwn the device anyway.
Yes. Use [https://github.com/tzapu/WiFiManager](https://github.com/tzapu/WiFiManager). Done.
This indeed seems a bit like reinventing the wheel.
OK so I have found myself wanting something a bit nicer than WiFi manager, but tbh it does the job. The NodeMCU boards I use have a flash button that is not used by anything. I set my projects up so that pressing the button puts it back into wifi config mode.
I happily fork WifiManager, pretty the template file, fix the md5 issue and use it my projects…
I would be interested in a write-up on using the smart config stuff with an android or ios app, no access point required and much more non-tech friendly!
Exactly, though I suspect that is not safe – or is it (auth data transferred via packet length!)?
For me, I am mainly interested in setting up a virgin device for the first time. I would completely disable smart config once setup or until I force a factory reset through MQTT/protected webpage/physical button. I don’t feel this would be too dissimilar to the setup of devices such as a Chromecast.
I did this with corona sdk. Quite simple to use and the code to connect to esp and configure it is really simple with luasocket.
But it’s not too late to fix it: just add an comparative overview of the existing implementations, alternatives (ESP config app) and if you’re after even more content, you could also expand the topic with how to catch any traffic via that network and force the browser to the configuration page (i.e. no need to know the IP).
It’s Arduino code. Please put an Arduino tag, or at least mention it in the article, to let people not interested in Arduino filter this.
The title of the article is literally AP configuration code for the ESP8266. That should have been enough to know if you’re interested or not.
Surely you’re aware there are other OSes for the ESP? Ones that aren’t Arduino, but can still act as an AP?
So… it is a hardcoded AP to create an user defined AP. Nice! :-D
OK, so I was confused as well initially. This is solely for an ESP8266 that you want to configure in AP mode always- not one that starts in AP mode, then gets reconfigured into STA mode.
I forked WiFiManager and made something like this
Notably, AP and WIFI are always connected
So, even without WIFI, you can configure the device with the AP
How to include proxy settings and user credential in the program?
Please be kind and respectful to help make the comments section excellent. (Comment Policy)