Creating a WiFi Configuration Tool
/One of the problems with any WiFi enabled device is the initial configuration. How do you tell your device the settings for your WiFi when you can’t talk to it via WiFi? It’s a “chicken and egg” situation, even though it doesn’t involve any chickens or eggs.
One answer is to make your device set up as a WiFi access point of its own, and then connect to this from a WiFi enabled phone or computer to configure all the settings. There are quite a few libraries of routines out there that will help you do this, but none of them did exactly what I wanted, so I’ve built my own.
You can see the configuration screen it generates in the screenshot above. You connect to it via your browser and then fill in the various options. It has support for five different access points and also lets you configure all the MQTT settings for a sensor as well.
I’ve got it working with my MQTT Mini Air Quality sensor. To configure the WiFi you simply turn the sensor upside down, plug it in and it starts up in “configure” mode. You then connect to the access point and perform the configuration. Then flip the sensor the right way up, restart it and away you go.
I’m very pleased with how well it works. I’ll have the code for the new, super configurable MQTT Mini device on GitHub before the end of the week. Then I’ll port the configuration mechanism over to larger, ESP32 based sensor.
Great fun.