Easily Setup Wifi on NodeMCU using Enduser Setup

I’ve been trying out the NodeMCU DevKit boards and found that it’s a great choice for projects that need wifi access. The boards are based on the ESP8266 chip and it’s easy to connect to wifi when the board is connected through a serial interface to Esplorer (following code is from the NodeMCU examples).


This is great if your wifi details are never going to change, but if it does or you want to use the board on a different network you will need to reconnect to the board using the serial interface to change the details. Fortunately there is a module which can help the Enduser Setup module.
To get this running you will need to build the NodeMCU firmware with the end user setup module included and flash it to your board. Upload the following file to the dev kit as connect.lua

The init.lua file needs to include the following:

connect = require("connect")

Now if the board is switched on and cannot connect to wifi it will create it’s own wifi network named “SetupGadget_XXXXXX” Connect to this network and then navigate to which should show a wifi login page which will allow you to input the details of your wifi network. The board will now remember the network details and reconnect to that network if it is available next time it is switched on.

Add a Comment

Your email address will not be published. Required fields are marked *