I'm creating (nearly complete with the hardware/circuit actually) a project that connects to the internet via mqtt and also allows for configuration of the "device" via a wifi network configuration menu (similar to many projects it seems these days). In other words, when the device starts up it creates a wireless network that allows you to connect and configure the device.
But, I've had VERY unreliable and mostly unusable connection with my setup. You can see my code here: https://github.com/develpr/mitchine
Basically what seems to happen is I connect to the wireless network (which sometimes works, sometimes doesn't and I have to reconnect a few times before it "sticks"), and then generally when I try to get to the appropriate page (say 192.168.4.1/config.html) the ESP will seem to reset or just not respond. I say "reset" but I'm not sure that's what's really happening. I get kicked off the wireless network and have to reconnect, generally, and perhaps it is resetting, but theother code running seems to start back up quickly and I'm generally able to reconnect to the network almost immediately).
EVENTUALLY, with luck, I can connect to the thing and actually configure things. But by "eventually" I sometimes mean after trying 15 times (literally). And sometimes I can't connect at all.
I'm wondering if there is an issue with my code perhaps?
I want to point out that if I manually (via code) configure my wireless network then the board runs super reliably, connecting to an MQTT server every 5 seconds and sending a "heartbeat" - so wifi on the board seems to work, and the connection seems semi-reliable.
Also, I made a custom PCB and here is the schematic: http://i.imgur.com/BXTPrhe.png
At this point I'm guessing/wondering if it's a problem with my code. Possibly because I keep the wifi network going at the same time I'm trying to connect to mqtt and do a bunch of other things? Would I have less issues if I, say, for the first 5 minutes ran the web server, then shut it off after 5 minutes and went about doing the "normal" activities?
Any advice on making things with the web server/wifi network more reliable?
Another option is to very much simplify the wifi configuration part so that that it's a single step process where I just configure everything via a single GET request/query string parameters (i.e. http://192.168.4.1?ssid=my_ssid&pass=password or whatever)
Thank you!