Electronic – arduino – how to initialize wifi settings in a production IOT device

arduinoesp8266raspberry piwifi

I want to build an IOT product that logs/polls values from a server. The problem is that all of the arduino/esp8266 and similar modules that I have found require the user to initialize the device with a wifi username/password. If I want to sell this device to people, what's the best way for them to upload the right username/password to the device?

I'm looking for options/libraries/best practices. The only option I can think of so far is to write a cellphone app that communicates with the IOT device via Bluetooth and is used to upload the wifi settings to the device. This way seems cumbersome, and I'd rather not write a iphone/ios app just for the purpose of connecting the module to the web.

Best Answer

There are Arduino libraries available that start a simple Access Point application with a Captive Portal when the ESP can’t find a local Wifi network to connect to.

The Captive Portal allows a user to log on to the AP created by the ESP from a different device like a phone or laptop, with a preconfigured Wifi password, open a simple web page, search for a local Wifi network to connect to, and enter its credentials.

Once configured, it will from then on use these SSID / credentials.

The library is called “WifiManager” and there are several varieties (for the ESP8266 and the ESP32).