mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-22 10:42:10 +10:00
updated Readme
This commit is contained in:
@@ -1,29 +1,40 @@
|
|||||||
# WiFiManager
|
# WiFiManager
|
||||||
ESP8266 WiFi Connection manager with save to EEPROM and web config portal
|
ESP8266 WiFi Connection manager with fallback web configuration portal
|
||||||
|
|
||||||
Captive portal should also work, I have tested it only on iOS.
|
The configuration portal is of the captive variety, so on various devices it will present the configuration dialogue as soon as you connect to the created access point.
|
||||||
|
|
||||||
First attempt at a library. Lots more changes and fixes to do. Adding examples also needs doing.
|
First attempt at a library. Lots more changes and fixes to do. Contributions are welcome.
|
||||||
|
|
||||||
This works with the ESP8266 Arduino platform https://github.com/esp8266/Arduino
|
|
||||||
|
|
||||||
> v0.1 works with the staging release ver. 1.6.5-1044-g170995a, built on Aug 10, 2015 of the ESP8266 Arduino library.
|
|
||||||
|
|
||||||
> **v0.2 and newer need the latest staging version (or at least a recent release of the staging version) to work**
|
|
||||||
|
|
||||||
## How It works
|
## How It works
|
||||||
- when your ESP starts up, it sets it up in Station mode and tries to connect to a previously saved Access Point
|
- when your ESP starts up, it sets it up in Station mode and tries to connect to a previously saved Access Point
|
||||||
- if this is unsuccessful (or no previous network saved) it moves the ESP into Access Point mode and spins up a DNS and WebServer (default ip 192.168.4.1)
|
- if this is unsuccessful (or no previous network saved) it moves the ESP into Access Point mode and spins up a DNS and WebServer (default ip 192.168.4.1)
|
||||||
- using any wifi enabled device with a browser (computer, phone, tablet) connect to the newly created Access Point
|
- using any wifi enabled device with a browser (computer, phone, tablet) connect to the newly created Access Point
|
||||||
- because of the Captive Portal and the DNS server you will either get a 'Join to network' type of popup or get any domain you try to access redirected to the configuration portal
|
- because of the Captive Portal and the DNS server you will either get a 'Join to network' type of popup or get any domain you try to access redirected to the configuration portal
|
||||||
- choose one of the access points scanned, enter password, click save, ESP will reboot and retry the whole flow above
|
- choose one of the access points scanned, enter password, click save
|
||||||
|
- ESP will try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure.
|
||||||
|
|
||||||
|
## Still left to do
|
||||||
|
- ~~remove dependency on EEPROM library~~
|
||||||
|
- cleanup and streamline code
|
||||||
|
- add ability to configure more parameters than ssid/password
|
||||||
|
- maybe allow setting ip of ESP after reboot
|
||||||
|
|
||||||
|
This works with the ESP8266 Arduino platform https://github.com/esp8266/Arduino
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
>
|
||||||
|
> **v0.2 and newer need the latest staging version (or at least a recent release of the staging version) to work**
|
||||||
|
|
||||||
|
> v0.1 works with the staging release ver. 1.6.5-1044-g170995a, built on Aug 10, 2015 of the ESP8266 Arduino library.
|
||||||
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
- Make sure you have a recent *staging* package of the ESP8266 for Arduino IDE
|
||||||
|
|
||||||
- Checkout library to your Arduino libraries folder
|
- Checkout library to your Arduino libraries folder
|
||||||
|
|
||||||
- Include in your sketch
|
- Include in your sketch
|
||||||
|
```cpp
|
||||||
```Arduino
|
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
#include <WiFiClient.h>
|
#include <WiFiClient.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
@@ -32,20 +43,19 @@ This works with the ESP8266 Arduino platform https://github.com/esp8266/Arduino
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Initialise library, in your setup function add
|
- Initialise library, in your setup function add
|
||||||
```
|
```cpp
|
||||||
//parameter is eeprom start
|
//parameter is eeprom start
|
||||||
WiFiManager wifi;
|
WiFiManager wifi;
|
||||||
```
|
```
|
||||||
|
|
||||||
- Also in the setup function add
|
- Also in the setup function add
|
||||||
```
|
```cpp
|
||||||
//parameter is name of access point
|
//parameter is name of access point
|
||||||
wifi.autoConnect("AP-NAME");
|
wifi.autoConnect("AP-NAME");
|
||||||
```
|
```
|
||||||
or if you want to use and auto generated name from 'ESP' and the esp's Chip ID use
|
or if you want to use and auto generated name from 'ESP' and the esp's Chip ID use
|
||||||
```
|
```cpp
|
||||||
wifi.autoConnect();
|
wifi.autoConnect();
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
After you write your sketch and start the ESP, it will try to connect to WiFi. If it fails it starts in Access Point mode.
|
After you write your sketch and start the ESP, it will try to connect to WiFi. If it fails it starts in Access Point mode.
|
||||||
@@ -55,7 +65,7 @@ Also see examples.
|
|||||||
|
|
||||||
### Timeout
|
### Timeout
|
||||||
If you need to set a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure, you can add
|
If you need to set a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure, you can add
|
||||||
```
|
```cpp
|
||||||
wifi.setTimeout(180);
|
wifi.setTimeout(180);
|
||||||
```
|
```
|
||||||
which will wait 3 minutes (180 seconds). When the time passes, the autoConnect function will return, no matter the outcome.
|
which will wait 3 minutes (180 seconds). When the time passes, the autoConnect function will return, no matter the outcome.
|
||||||
@@ -63,18 +73,18 @@ Check for connection and if it's still not established do whatever is needed (on
|
|||||||
|
|
||||||
### Debug
|
### Debug
|
||||||
Debug is enabled by default on Serial. To disable add before autoConnect
|
Debug is enabled by default on Serial. To disable add before autoConnect
|
||||||
```
|
```cpp
|
||||||
wifi.setDebugOutput(false);
|
wifi.setDebugOutput(false);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom IP Configuration
|
### Custom IP Configuration
|
||||||
This will set your captive portal to a specific IP should you need/want such a feature. Add the following snippet before `autoConnect()`
|
This will set your captive portal to a specific IP should you need/want such a feature. Add the following snippet before `autoConnect()`
|
||||||
```
|
```cpp
|
||||||
//set custom ip for portal
|
//set custom ip for portal
|
||||||
wifi.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
wifi.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||||
```
|
```
|
||||||
|
|
||||||
####Inspiration
|
#### Inspiration
|
||||||
- http://www.esp8266.com/viewtopic.php?f=29&t=2520
|
- http://www.esp8266.com/viewtopic.php?f=29&t=2520
|
||||||
|
|
||||||
To be continued...
|
To be continued...
|
||||||
|
|||||||
Reference in New Issue
Block a user