## Current development going on here :arrow_right: [Development Branch](https://github.com/tzapu/WiFiManager/tree/development)
# WiFiManager
ESP8266 WiFi Connection manager with fallback web configuration portal
[![Build Status](https://travis-ci.org/tzapu/WiFiManager.svg?branch=master)](https://travis-ci.org/tzapu/WiFiManager)
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. Contributions are welcome.
#### This works with the ESP8266 Arduino platform with a recent stable release(2.0.0 or newer) https://github.com/esp8266/Arduino
## Contents
- [How it works](#how-it-works)
- [Wishlist](#wishlist)
- [Quick start](#quick-start)
- Installing
- [Through Library Manager](#install-through-library-manager)
- [From Github](#checkout-from-github)
- [Using](#using)
- [Documentation](#documentation)
- [Access Point Password](#password-protect-the-configuration-access-point)
- [Callbacks](#callbacks)
- [Configuration Portal Timeout](#configuration-portal-timeout)
- [On Demand Configuration](#on-demand-configuration-portal)
- [Custom Parameters](#custom-parameters)
- [Custom IP Configuration](#custom-ip-configuration)
- [Filter Low Quality Networks](#filter-networks)
- [Debug Output](#debug)
- [Troubleshooting](#troubleshooting)
- [Releases](#releases)
- [Contributors](#contributions-and-thanks)
## 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
- 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
- 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 try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure.
## How It Looks
![ESP8266 WiFi Captive Portal Homepage](http://i.imgur.com/YPvW9eql.png) ![ESP8266 WiFi Captive Portal Configuration](http://i.imgur.com/oicWJ4gl.png)
## Wishlist
- [x] remove dependency on EEPROM library
- [x] move HTML Strings to PROGMEM
- [x] cleanup and streamline code (although this is ongoing)
- [x] if timeout is set, extend it when a page is fetched in AP mode
- [x] add ability to configure more parameters than ssid/password
- [x] maybe allow setting ip of ESP after reboot
- [x] add to Arduino Library Manager
- [x] add to PlatformIO
- [ ] add multiple sets of network credentials
- [x] allow users to customize CSS
- [ ] ESP32 support or instructions
- [ ] rewrite documentation for simplicity, based on scenarios/goals
- [ ] rely on the SDK's built in auto connect more than forcing a connect
## Quick Start
### Installing
You can either install through the Arduino Library Manager or checkout the latest changes or a release from github
#### Install through Library Manager
__Currently version 0.8+ works with release 2.0.0 or newer of the [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)__
- in Arduino IDE got to Sketch/Include Library/Manage Libraries
![Manage Libraries](http://i.imgur.com/9BkEBkR.png)
- search for WiFiManager
![WiFiManager package](http://i.imgur.com/18yIai8.png)
- click Install and start [using it](#using)
#### Checkout from github
__Github version works with release 2.0.0 or newer of the [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)__
- Checkout library to your Arduino libraries folder
### Using
- Include in your sketch
```cpp
#include <ESP8266WiFi.h> //ESP8266 Core WiFi Library (you most likely already have this in your sketch)
#include <DNSServer.h> //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h> //Local WebServer used to serve the configuration portal
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager WiFi Configuration Magic
```
- Initialize library, in your setup function add
```cpp
WiFiManager wifiManager;
```
- Also in the setup function add
```cpp
//first parameter is name of access point, second is the password
wifiManager.autoConnect("AP-NAME", "AP-PASSWORD");
```
if you just want an unsecured access point
```cpp
wifiManager.autoConnect("AP-NAME");
```
or if you want to use and auto generated name from 'ESP' and the esp's Chip ID use
```cpp
wifiManager.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.
While in AP mode, connect to it then open a browser to the gateway IP, default 192.168.4.1, configure wifi, save and it should reboot and connect.
Also see [examples](https://github.com/tzapu/WiFiManager/tree/master/examples).
## Documentation
#### Password protect the configuration Access Point
You can and should password protect the configuration access point. Simply add the password as a second parameter to `autoConnect`.
A short password seems to have unpredictable results so use one that's around 8 characters or more in length.
The guidelines are that a wifi password must consist of 8 to 63 ASCII-encoded characters in the range of 32 to 126 (decimal)
```cpp
wifiManager.autoConnect("AutoConnectAP", "password")
```
#### Callbacks
##### Enter Config mode
Use this if you need to do something when your device enters configuration mode on failed WiFi connection attempt.
Before `autoConnect()`
```cpp
wifiManager.setAPCallback(configModeCallback);
```
`configModeCallback` declaration and example
```cpp
void configModeCallback (WiFiManager *myWiFiManager) {
Serial.println("Entered config mode");
Serial.println(WiFi.softAPIP());
Serial.println(myWiFiManager->getConfigPortalSSID());
}
```
##### Save settings
This gets called when custom parameters have been set **AND** a connection has been established. Use it to set a flag, so when all the configuration finishes, you can save the extra parameters somewhere.
See [AutoConnectWithFSParameters Example](https://github.com/tzapu/WiFiManager/tree/master/examples/AutoConnectWithFSParameters).
```cpp
wifiManager.setSaveConfigCallback(saveConfigCallback);
```
`saveConfigCallback` declaration and example
```cpp
//flag for saving data
bool shouldSaveConfig = false;
//callback notifying us of the need to save config
void saveConfigCallback () {
Serial.println("Should save config");
shouldSaveConfig = true;
}
```
#### Configuration Portal 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
```cpp
wifiManager.setConfigPortalTimeout(180);
```
which will wait 3 minutes (180 seconds). When the time passes, the autoConnect function will return, no matter the outcome.
Check for connection and if it's still not established do whatever is needed (on some modules I restart them to retry, on others I enter deep sleep)
#### On Demand Configuration Portal
If you would rather start the configuration portal on demand rather than automatically on a failed connection attempt, then this is for you.
Instead of calling `autoConnect()` which does all the connecting and failover configuration portal setup for you, you need to use `startConfigPortal()`. __Do not use BOTH.__
Example usage
```cpp
void loop() {
// is configuration portal requested?
if ( digitalRead(TRIGGER_PIN) == LOW ) {
WiFiManager wifiManager;
wifiManager.startConfigPortal("OnDemandAP");
Serial.println("connected...yeey :)");
}
}
```
See example for a more complex version. [OnDemandConfigPo
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
嵌入式优质项目,资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松copy复刻,拿到资料包后可轻松复现出一样的项目。 本人单片机开发经验充足,深耕嵌入式领域,有任何使用问题欢迎随时与我联系,我会及时为你解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明,项目具体内容可查看下方的资源详情。 【附带帮助】: 若还需要嵌入式物联网单片机相关领域开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步。 【本人专注嵌入式领域】: 有任何使用问题欢迎随时与我联系,我会及时解答,第一时间为你提供帮助,CSDN博客端可私信,为你解惑,欢迎交流。 【建议小白】: 在所有嵌入式开发中硬件部分若不会画PCB/电路,可选择根据引脚定义将其代替为面包板+杜邦线+外设模块的方式,只需轻松简单连线,下载源码烧录进去便可轻松复刻出一样的项目 【适合场景】: 相关项目设计中,皆可应用在项目开发、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面中 可借鉴此优质项目实现复刻,也可以基于此项目进行扩展来开发出更多功能
资源推荐
资源详情
资源评论
收起资源包目录
基于Arduino+Blynk+ESP8266设计的WiFi遥控小车(皆可应用在毕设/课设/大作业/实训/竞赛/项目开发) (486个子文件)
blynk-ser.bat 2KB
com2tcp.bin 92KB
project.checksum 40B
.clang-format 136B
OLEDDisplay.cpp 29KB
WiFiManager.cpp 22KB
OLEDDisplayUi.cpp 15KB
BlynkHandlers.cpp 14KB
main.cpp 10KB
BlynkTimer.cpp 7KB
BlynkDebug.cpp 6KB
utility.cpp 5KB
_LetsEncryptAuthorityX3.crt 2KB
_ISRGRootX1.crt 2KB
_blynk-cloudcom.crt 1KB
server.crt 1KB
_LetsEncryptAuthorityX3.der 1KB
_ISRGRootX1.der 1KB
_blynk-cloudcom.der 1001B
_DSTRootX3.der 846B
.gitattributes 66B
.gitattributes 16B
.gitignore 270B
.gitignore 157B
.gitignore 8B
OLEDDisplayFonts.h 103KB
BlynkDetectDevice.h 16KB
BlynkProtocol.h 15KB
OLEDDisplay.h 11KB
BlynkDebug.h 10KB
BlynkHandlers.h 10KB
ConfigMode.h 10KB
ConfigMode.h 9KB
WiFiManager.h 9KB
BlynkApi.h 9KB
BlynkSimpleRedBear_Duo_BLE.h 9KB
letsencrypt_der.h 9KB
BlynkParam.h 9KB
isrgroot_der.h 8KB
OLEDDisplayUi.h 8KB
ConfigMode.h 7KB
ConfigMode.h 7KB
ConfigMode.h 7KB
Indicator.h 7KB
Indicator.h 7KB
Indicator.h 7KB
Indicator.h 6KB
Indicator.h 6KB
blynkcloud_der.h 6KB
BlynkEthernet.h 6KB
BlynkSimpleEsp8266_SSL.h 6KB
BlynkApiArduino.h 5KB
BlynkApiParticle.h 5KB
BlynkWildFire.h 5KB
BlynkSimpleRedBearLab_BLE_Nano.h 5KB
BlynkTimer.h 5KB
BlynkSimpleEsp32_BT.h 5KB
BlynkBLEPeripheralSerial.h 5KB
SSD1306Wire.h 5KB
BlynkSimpleShieldEsp8266.h 5KB
dst_der.h 5KB
BlynkCC3000.h 5KB
BlynkApiMbed.h 5KB
SSD1306Brzo.h 5KB
SH1106Wire.h 5KB
SSD1306Spi.h 5KB
SSD1306I2C.h 5KB
BlynkSimpleEsp32_BLE.h 5KB
BlynkDateTime.h 5KB
BlynkSimpleCurieBLE.h 4KB
SH1106Brzo.h 4KB
SH1106Spi.h 4KB
BlynkProtocolDefs.h 4KB
BlynkSimpleEsp32_SSL.h 4KB
WidgetTimeInput.h 3KB
Settings.h 3KB
Settings.h 3KB
BlynkGsmClient.h 3KB
BlynkSimpleEthernetSSL.h 3KB
BlynkArduinoClient.h 3KB
Settings.h 3KB
BlynkFifo.h 3KB
OTA.h 3KB
BlynkSimpleRFduinoBLE.h 3KB
BlynkSimpleSimbleeBLE.h 3KB
BlynkSimpleFishino.h 3KB
BlynkWiFiCommon.h 3KB
BlynkWiFly.h 3KB
BlynkParticle.h 3KB
BlynkSimpleEsp8266.h 3KB
Settings.h 3KB
Settings.h 3KB
BlynkSimpleEsp32.h 2KB
OTA.h 2KB
OTA.h 2KB
template.h 2KB
BlynkSimpleLinkItONE.h 2KB
BlynkArduinoGSM.h 2KB
BlynkConfig.h 2KB
BlynkEveryN.h 2KB
共 486 条
- 1
- 2
- 3
- 4
- 5
资源评论
阿齐Archie
- 粉丝: 3w+
- 资源: 2465
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于Spring Cloud框架的统一登录与日志管理系统.zip
- spire.presentation.free.zip
- (源码)基于Spring Boot框架的简历管理系统.zip
- C#ERP生产管理系统源码带开发文档数据库 SQL2008源码类型 WebForm
- (源码)基于Spring、Struts2和Hibernate的学生管理系统.zip
- 房屋冰凌冰锥冰柱检测数据集VOC+YOLO格式147张1类别.zip
- (源码)基于物联网技术的COVID患者健康监测系统.zip
- 考研数学必备高等数学公式速查手册
- 基于用户浏览网站偏好分类的FlinkML快速演示样例+Java项目源码+文档说明+代码注释
- (源码)基于Python和Kuramoto模型的无标度网络同步检测系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功