Configure your ESP8266 WiFi module with new WiFi Manager
2017-05-10 | By Maker.io Staff
One thing is for sure, the ESP8266 is one of the most popular WiFi module available in the market, allowing makers to develop IoT products with ease. However, a lot of projects require hard coding the WiFi credentials into the device module, which is fine for prototyping but if your devices are sent to remote locations then the WiFi credentials will have to be changed resulting in reprogramming the device. This issue is further increased if you are developing a commercial product for the open market of IoT.
WiFi Manager has since been designed to resolve these issues. Initially when you power up your ESP8266 module you will see it as an access point, which you can then connect to it using wither your smart phone or computer device. Then you can configure the WiFi credentials and connect it to your local WiFi network using the web interface. This method is not uncommon on IoT devices but it is one which hasn’t featured on the ESP8266 module before.
How it Works
- When your ESP starts up, it sets it up in Station mode and tries to connect to a previously saved Access Point
- If this is unsuccessful (or no previous network saved) it moves the ESP into Access Point mode and spins up a DNS and WebServer (default ip 192.168.4.1)
- Using any wifi enabled device with a browser (computer, phone, tablet) connect to the newly created Access Point
- Because of the Captive Portal and the DNS server you will either get a 'Join to network' type of popup or get any domain you try to access redirected to the configuration portal
- Choose one of the access points scanned, enter password, click save
- ESP will try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure.
How to install
By far the easiest method of installing the WiFi Manager is to use the Arduino Library Manager. In the Arduino IDE go to Sketch > Include Library > Manage Libraries, then in the search bar type "wifimanager". You should see the following:
WiFi Manager Library
Click install, which will download and install the WiFi Manager library for use. Once installed you can go to the Arduino Library Folder to see the example sketches to upload to your ESP8266 module.
After you have written your sketch and have started the ESP8266, it will then try to connect to WiFi if it has previously successfully connected. Otherwise it will fail to connect and then start up an AP mode. Once in AP mode you can connect to it openly and then in your web browser navigate to the default IP address which is 192.168.4.1, to configure the WiFi, it should then begin to proceed to connect to your WiFi.
How it looks
You can find out further information regarding the WiFi Manager library from their GitHub page. Part of the information in this article is under MIT license, Copyright 2015 tzapu.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum