-->
Page 1 of 3

Configure SSID and password first time?

PostPosted: Thu Jun 11, 2015 6:58 am
by ReNNo_BiH
I started using Arduino IDE and looks good for me but cannot find any solution to setup wireless information.

My device needs to boot in AP mode for first time so I can enter SSID and password and then it should restart, continue in client mode and connect to router. Is there any working example that can help me for this purpose?

Re: Configure SSID and password first time?

PostPosted: Thu Jun 11, 2015 7:21 am
by reaper7
I think that this is good option for You:
https://github.com/tzapu/WiFiManager

Code: Select all#include <WiFiClient.h>
#include <EEPROM.h>
#include <ESP8266mDNS.h>
#include <WifiManager.h>

WiFiManager wifi(0);

void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.println("INIT");
 
  wifi.autoConnect("AP_FOR_CONF");

  Serial.println("DONE");
}

void loop() {
}

Re: Configure SSID and password first time?

PostPosted: Thu Jun 11, 2015 8:18 am
by ReNNo_BiH
Thank you. That is exactly what I need.
But it doesn't work as expected.

It starts in AP mode, and I successfully enter SSID and Password. It resets by itself, reads ssid and password from EEPROM and connects to network successfully. But as soon as I reset my ESP-01 manually it reads false data from EEPROM and starts AP again.
Hmmmm...

EDIT:

Here is what I get when I restart module manually:
Code: Select allAutoConnect
Reading EEPROM SSID
SSID:
��?�ntX<script>function
Reading EEPROM Password
Password:
 c(l){document.getElementById('s').value=l.innerText||l.textCont
Waiting for Wifi to connect
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

Could not connect to WiFi
Started Soft Access Point

WiFi connected
0.0.0.0
192.168.4.1
mDNS responder started
Server started


Looks like reading from EEPROM is not good.

Re: Configure SSID and password first time?

PostPosted: Thu Jun 11, 2015 10:18 am
by ian
I think you'll find that the EEPROM functionality was broken in a recent release :(
Write a little program to write to the EEPROM (don't forget the EEPROM.commit())
Power down & up
Write another little program to read from the EEPROM.

I think you'll get garbage :(