Chat freely about anything...

User avatar
By villTech
#11167
shantanu wrote:e.g., I make a few end product devices and distribute to my non-programmer friends to use. They have to configure their wifi SSID/pwd for this. How can I make it simple for them so that they can do it once on their own (best way is like normal routers through a web page, settings thus done being saved into the flash)

make a firmware that has built in webpage to configure esp module to which wifi router it should connect.

on power up, their smartphone/pc/tablet with connect to esp ap, so they can access the esp webpage, and from there, you can set up esp to connect to which router
User avatar
By new299
#11168 For SSID/Password setting only there are a few projects that have implemented ways of persisting this to flash. I've implemented this for a project I've been working on here:

https://github.com/Safecast/bGeigieNano_ESP8266

Basically the device starts in AP mode, the user connects to the AP and then goes to 192.168.4.1 in their browser. They can then enter a SSID/Password which will be stored in the devices flash memory. I have some notes on using the device flash here:

http://41j.com/blog/2015/01/esp8266-wri ... lue-store/
User avatar
By EadF
#11174
shantanu wrote:Thanks. But this still requires recompilation of firmware and flashing it completely again. I'm looking at some way to provision the device without having to recompile/reprovision the firmware.
e.g., I make a few end product devices and distribute to my non-programmer friends to use. They have to configure their wifi SSID/pwd for this. How can I make it simple for them so that they can do it once on their own (best way is like normal routers through a web page, settings thus done being saved into the flash)


No - it does not require recompiled firmware. The config module of esp_mqtt can change persistent settings.
You can for example compile and flash an esp with default setting that match your local SSID.

Then send a command to it, at runtime, "change SSID to XXX".
Every time the device reboots it will use the new setting XXX as SSID.

This, of course, requires the firmware to subscribe to "change your SSID" messages in the first place, something it does not do in the default esp_mqtt demo.
But it is possible to change persistent settings at runtime. And the config module is a utility that facilitates just that.

Edit: Maybe SSID isn't a good example, as it will brick the device (until reflashed) if set wrong, but you get the idea.
And the type of data stored is very limited (hardcoded), but it's a starting point for an extended library.

Edit2: Just looked at the mqtt config code again, there seems to be some flag (saveFlag.flag) in CFG_Save() that prevents the module to operate exactly as i described. But as an example on how to store and retrieve persistent data it's still viable.