8.6 KiB
AutoConnect for ESP8266/ESP32
An Arduino library for ESP8266/ESP32 WLAN configuration at run time with web interface.
Overview
To the dynamic configuration for joining to WLAN with SSID and PSK accordingly. It an Arduino library united with ESP8266WebServer class for ESP8266 or WebServer class for ESP32. Easy implementing the Web interface constituting the WLAN for ESP8266/ESP32 WiFi connection. With this library to make a sketch easily which connects from ESP8266/ESP32 to the access point at runtime by the web interface without hard-coded SSID and password.
No need pre-coded SSID & password
It is no needed hard-coding in advance the SSID and Password into the sketch to connect between ESP8266/ESP32 and WLAN. You can input SSID & Password from a smartphone via the web interface at runtime.
Simple usage
AutoConnect control screen will be displayed automatically for establishing new connections. It aids by the captive portal when vested the connection cannot be detected.
By using the AutoConnect menu, to manage the connections convenient.
Store the established connection
The connection authentication data as credentials are saved automatically in the flash of ESP8266/ESP32 and You can select the past SSID from the AutoConnect menu.
Easy to embed in
AutoConnect can be placed easily in your sketch. It's "begin" and "handleClient" only.
Lives with your sketches
The sketches which provide the web page using ESP8266WebServer there is, AutoConnect will not disturb it. AutoConnect can use an already instantiated ESP8266WebServer object, or itself can assign it. This effect also applies to ESP32. The corresponding class for ESP32 will be the WebServer.
Easy to add the custom Web pages ENHANCED w/v0.9.7
You can easily add your owned web pages that can consist of representative HTML elements and invoke them from the menu. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD.
Quick and easy to equip the OTA update feature UPDATED w/v1.1.5
You can quickly and easily equip the OTA update feature to your sketch and also you can operate the firmware update process via OTA from AutoConnect menu.
Installation
Requirements
Supported hardware
- Generic ESP8266 modules (applying the ESP8266 Community's Arduino core)
- Adafruit HUZZAH ESP8266 (ESP-12)
- ESP-WROOM-02
- Heltec WiFi Kit 8
- NodeMCU 0.9 (ESP-12) / NodeMCU 1.0 (ESP-12E)
- Olimex MOD-WIFI-ESP8266
- SparkFun Thing
- SweetPea ESP-210
- ESP32Dev Board (applying the Espressif's arduino-esp32 core)
- SparkFun ESP32 Thing
- WEMOS LOLIN D32
- Ai-Thinker NodeMCU-32S
- Heltec WiFi Kit 32
- M5Stack
- And other ESP8266/ESP32 modules supported by the Additional Board Manager URLs of the Arduino-IDE.
!!! info "About flash size on the module" The AutoConnect sketch size is relatively large. Large flash capacity is necessary. 512Kbyte (4Mbits) flash inclusion module such as ESP-01 is not recommended.
Required libraries
AutoConnect requires the following environment and libraries.
Arduino IDE
The current upstream at the 1.8 level or later is needed. Please install from the official Arduino IDE download page. This step is not required if you already have a modern version.
ESP8266 Arduino core
AutoConnect targets sketches made on the assumption of ESP8266 Community's Arduino core. Stable 2.4.0 or higher required and the latest release is recommended.
Install third-party platform using the Boards Manager of Arduino IDE. Package URL is http://arduino.esp8266.com/stable/package_esp8266com_index.json
ESP32 Arduino core
Also, to apply AutoConnect to ESP32, the arduino-esp32 core provided by Espressif is needed. Stable 1.0.1 or required and the latest release is recommended.
Install third-party platform using the Boards Manager of Arduino IDE. You can add multiple URLs into Additional Board Manager URLs field, separating them with commas. Package URL is https://dl.espressif.com/dl/package_esp32_index.json for ESP32.
!!! info "Arduino core for ESP32 1.0.3 or later" For ESP32, AutoConnect v1.0.0 later is required for arduino-esp32 1.0.3 or later.
Additional library (Required)
The PageBuilder library to build HTML for ESP8266WebServer is needed.
To install the PageBuilder library into your Arduino IDE, you can use the Library Manager. Select the board of ESP8266 series in the Arduino IDE, open the library manager and search keyword 'PageBuilder' with the topic 'Communication', then you can see the PageBuilder. The latest version is required 1.3.6 later.1
Additional library (Optional)
By adding the ArduinoJson library, AutoConnect will be able to handle the custom Web pages described with JSON. Since AutoConnect v0.9.7 you can insert user-owned web pages that can consist of representative HTML elements as styled TEXT, INPUT, BUTTON, CHECKBOX, SELECT, SUBMIT and invoke them from the AutoConnect menu. These HTML elements can be added by sketches using the AutoConnect API. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD. ArduinoJson is required to use this feature.2 AutoConnect can work with ArduinoJson both version 5 and version 6.
Install the AutoConnect
Clone or download from the AutoConnect GitHub repository.
When you select Download, you can import it to Arduino IDE immediately. After downloaded, the AutoConnect-master.zip file will be saved in your download folder. Then in the Arduino IDE, navigate to "Sketch > Include Library". At the top of the drop down list, select the option to "Add .ZIP Library...". Details for Arduino official page.
!!! info "Supported by Library manager." AutoConnect was added to the Arduino IDE library manager. It can be used with the PlatformIO library also.