September 2019 Update

New! We're moving to the new forum!

ALL new Blog posts will be on the forum.

Please join us there.

This Blog will no longer be updated...

Saturday, May 25, 2019

WiFi and MySql login info

Right now, the login credentials for both the WiFi Network, and the MySql Database are hard coded in the software which is uploaded to each module. This works for me, but it does mean having to recompile and reinstall the software on every module if something changes.

For some time, I've been thinking about this, and the solution seemed to be, if you cannot connect to WiFi, then create your own network, and allow your smartphone to join its network and configure the module with the proper credentials...

I've kept putting it off fo a couple reasons, first, it's not critical, I can easily recompile and reinstall whenever I like, and second, and more importantly, if the router is rebooting, you don't want all your modules switching to AP mode and waiting forever, meanwhile, you're fast asleep for the night....

So now, I think I might have a solution...

If you've already configured a module, and it cannot connect, chances are, it's a network issue, the module does not need to be reconfigured...

If the module is new, and you just plugged it in for the first time, they why not have a button to press and hold while booting, and if it is pressed, then go into Soft Access Point mode, create a network with a default username/password and a web interface to do the configuration.

I think that's a brilliant solution...   I'll have to check to see how I'll do this on the ESP8266 but I think there is a GPIO pin on the ESP-01 board I can use...

If I want to, I think the Wemos Mega 2560 exposes a bunch of pins directly from the built-in ESP8266 as well.

This will be a significant change, so I'll break it into smaller tasks...

I think I'll start with adding a button to all my existing modules. This will be fairly simple, all I need it a pushbutton, a resistor, some wire, and a connector for each module. A bit of solder, and I'm all set. I may mount the pushbutton on a tiny piece of perfboard so it can be mounted (with two sided tape) somewhere on or near the module.


Next, I'll update the code to check for the button at startup, and then to run the AP mode, serving up the config pages... This will be the harder part, and I'm not really sure how long it will take, perhaps I can create some shared code for all the modules.


No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed