- Why do we need this ESP_AT_WM_Lite library
- Changelog
- Prerequisites
- Important Notes about AT Firmwares
- Installation
- Packages' Patches
- How It Works
- How to use
- 1. Basic usage
- 2. Add custom parameters
- 3. Not using custom parameters
- 4. To open Config Portal
- 5. To use different AP WiFi Channel
- 6. To use different static AP IP from default
- 7. To use and input only one set of WiFi SSID and PWD
- 8. To enable auto-scan of WiFi networks for selection in Configuration Portal
- Important Notes for using Dynamic Parameters' ids
- Examples
- So, how it works?
- Important Notes
- How to use default Credentials and have them pre-loaded onto Config Portal
- How to add dynamic parameters from sketch
- Important Notes for using Dynamic Parameters' ids
- Example nRF52_ESP8266Shield
- Debug Terminal Output Samples
- Debug
- Troubleshooting
- Releases
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License
- Copyright
Why do we need this ESP_AT_WM_Lite library
This library is a Light Weight Credentials / WiFi Manager for ESP8266/ESP32-AT shields, specially designed to support AVR Mega, SAM DUE, SAMD21, SAMD51, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running ESP8266/ESP32-AT-command shields. with smaller memory (64+K bytes)
The RP2040-based boards, such as RASPBERRY_PI_PICO, are currently supported using Earle Philhower's arduino-pico core and LittleFS. The support to Arduino-mbed RP2040 core, which has no LittleFS support yet, will be added in the future using simulated-EEPROM if LittleFS not ready then.
Other AVR-family boards (UNO, Nano, etc.) are not supported as they don't have enough memory to run Config Portal WebServer.
This ESP_AT_WM_Lite library is a Credentials / WiFi Connection Manager, permitting the addition of custom parameters to be configured in Config Portal. The parameters then will be saved automatically, without the complicated callback functions to handle data saving / retrieving.
If you have used one of the full-fledge WiFiManagers such as :
and have to write complicated callback functions to save custom parameters in SPIFFS/LittleFS/EEPROM, you'd appreciate the simplicity of this Light-Weight Credentials / WiFiManager.
You can also specify static AP and STA IP. Use much less memory compared to full-fledge WiFiManager. Config Portal will be auto-adjusted to match the number of dynamic custom parameters. Credentials are saved in EEPROM, FlashStorage_SAMD
, FlashStorage_STM32
, DueFlashStorage
or nRF52 LittleFS.
The web configuration portal, served from the ESP32/ESP8266-AT WiFi
is operating as an access point (AP) with configurable static IP address or use default IP Address of 192.168.4.1
New recent features:
- MultiWiFi feature for configuring/auto(re)connecting ESP32/ESP8266-AT WiFi to the available MultiWiFi APs at runtime.
- DoubleDetectDetector feature to force Config Portal when double reset is detected within predetermined time, default 10s.
- Powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Config Portal will be auto-adjusted to match the number of dynamic parameters.
- Optional default Credentials as well as Dynamic parameters to be optionally autoloaded into Config Portal to use or change instead of manually input.
- Dynamic custom parameters to be saved automatically in non-volatile memory, such as EEPROM, FlashStorage_SAMD, FlashStorage_STM32, DueFlashStorage or nRF52 LittleFS..
- Configurable Config Portal Title to be either BoardName or default undistinguishable names.
- Examples are designed to separate Credentials / Defines / Dynamic Params / Code, so that you can change Credentials / Dynamic Params quickly for each device.
- To permit autoreset after configurable timeout if DRD/MRD or non-persistent forced-CP
- Use new nRF52 LittleFS, SAMD FlashStorage_SAMD and STM32F/L/H/G/WB/MP1 FlashStorage_STM32 features
- Scan WiFi networks for selection in Configuration Portal
This ESP_AT_WM_Lite library currently supports these following boards:
-
nRF52 boards, such as AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.
-
SAM DUE
-
SAMD21
- Arduino SAMD21: ZERO, MKRs, NANO_33_IOT, etc.
- Adafruit SAMD21 (M0): ItsyBitsy M0, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground Express, Trinket M0, PIRkey, Hallowing M0, Crickit M0, etc.
- Seeeduino: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, etc.
- SAMD51
- Adafruit SAMD51 (M4): Metro M4, Grand Central M4, ItsyBitsy M4, Feather M4 Express, Trellis M4, Metro M4 AirLift Lite, MONSTER M4SK Express, Hallowing M4, etc.
- Seeeduino: Wio Terminal, Grove UI Wireless
-
Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC)
-
STM32F/L/H/G/WB/MP1 boards (with 64+K Flash)
- Nucleo-144
- Nucleo-64
- Discovery
- Generic STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7 (with 64+K Flash): x8 and up
- STM32L0, STM32L1, STM32L4, STM32L5
- STM32G0, STM32G4
- STM32H7
- STM32WB
- STM32MP1
- LoRa boards
- 3-D printer boards
- Generic Flight Controllers
- Midatronics boards
- RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core and LittleFS
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core using LittleFS
- Using new efficient features of
FlashStorage_SAMD library v1.1.0+
- Optimize code and fix bug
- Update examples with new features
- Enable scan of WiFi networks for selection in Configuration Portal. Check PR for v1.3.0 - Enable scan of WiFi networks #10. Now you can select optional SCAN_WIFI_NETWORKS, MANUAL_SSID_INPUT_ALLOWED to be able to manually input SSID, not only from a scanned SSID lists and MAX_SSID_IN_LIST (from 2-6 for ESP8266-AT or 2-15 for other)
- Minor enhancement to not display garbage when data is invalid
- Tested with new Arduino Core for STM32 v2.0.0 and add support to new STM32L5 boards.
- Enhance MultiWiFi connection logic
- Enhance debugging feature
- Fix invalid "blank" Config Data treated as Valid.
- Permit optionally inputting one set of WiFi SSID/PWD by using
REQUIRE_ONE_SET_SSID_PW == true
- Enforce WiFi PWD minimum length of 8 chars
- Optimize code
- Use better FlashStorage_STM32.
- Add Table-of-Contents
- Add support to ESP32-AT WiFi shields.
- Add support to WIS600-01S/W600-AT WiFi shields.
- Modify LOAD_DEFAULT_CONFIG_DATA logic.
- Enhance MultiWiFi connection logic.
- Fix WiFi Status bug.
- Add support to nRF52 (AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.). Dynamic custom parameters to be saved automatically in LittleFS.
- Add MultiWiFi features for WiFi
- Add DoubleResetDetector (DRD) feature.
- Restructure examples separate Credentials / Defines / Dynamic Params / Code.
- Drop support to Teensy boards.
- Add support to SAM51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.) and SAM DUE.
- WiFi Password max length is 63, according to WPA2 standard.
- Permit to input special chars such as ~,!,@,#,$,%,^,*,& into data fields.
- Fix bug
- New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Config Portal will be auto-adjusted to match the number of dynamic parameters.
- Dynamic custom parameters to be saved automatically in EEPROM, SAMD EEPROM-emulated FlashStorage or SAM DUE DueFlashStorage.
Arduino IDE 1.8.13+
for ArduinoArduino AVR core 1.8.3+
for Arduino (Use Arduino Board Manager) for AVR boards.Arduino Core for STM32 v2.0.0+
for STM32F/L/H/G/WB/MP1 boards (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.).Teensy core 1.53+
for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) boardsArduino SAM DUE core v1.6.12+
for SAM DUE ARM Cortex-M3 boards.Arduino SAMD core 1.8.11+
for SAMD ARM Cortex-M0+ boards.Adafruit SAMD core 1.6.8+
for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.).Seeeduino SAMD core 1.8.1+
for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.).Adafruit nRF52 v0.21.0+
for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, NINA_B302_ublox, etc.Earle Philhower's arduino-pico core v1.2.2+
for RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, etc.ESP8266_AT_WebServer library v1.2.0+
. To install, checkFlashStorage_SAMD library v1.1.0+
for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.). To install, checkFlashStorage_STM32 library v1.1.0+
for STM32F/L/H/G/WB/MP1 boards. To install. checkDueFlashStorage library v1.0.0+
for SAM DUE. To install, checkAdafruit's LittleFS/InternalFS
for nRF52DoubleResetDetector_Generic v1.2.0+
. To install. checkAi-Thinker AT Firmware v1.5.4
orAT Firmware v1.7.4.0
for ESP8266-AT WiFi shields.AT version_2.1.0.0_dev
for ESP32-AT WiFi shields.AT version_1.1.4
for WIS600-01S and W600-AT WiFi shields.
-
AT version:1.1.0.0(May 11 2016 18:09:56) SDK version:1.5.4(baaeaebb) Ai-Thinker Technology Co. Ltd. Jun 13 2016 11:29:20
-
AT version:1.7.4.0(May 11 2020 19:13:04) SDK version:3.0.4(9532ceb) compile time:May 27 2020 10:12:17 Bin version(Wroom 02):1.7.4
-
WIS600-01S
andW600
using either ESP8266 or ESP32-AT commands and stock firmwareAT version:1.1.4(Dec 05 2018 11:06:45) SDK version:3.0.0 Dec 05 2018 11:06:45
-
AT version:2.1.0.0-dev(4f6b92c - Jun 10 2020 10:36:54) SDK version:v4.0.1-193-ge7ac221b4 compile time(b85a8df):Jun 18 2020 14:00:59 Bin version:2.0.0(WROOM-32)
See instructions at AT Command Core and ESP_AT_Get_Started
- Upload
AT Firmware v1.7.4.0
bin files to correct locations as follows:
# BOOT MODE
### Flash size 8Mbit: 512KB+512KB
boot_v1.2+.bin 0x00000
user1.1024.new.2.bin 0x01000
esp_init_data_default.bin 0xfc000
blank.bin 0x7e000 & 0xfe000
### Flash size 16Mbit-C1: 1024KB+1024KB
boot_v1.2+.bin 0x00000
user1.2048.new.5.bin 0x01000
esp_init_data_default.bin 0x1fc000
blank.bin 0xfe000 & 0x1fe000
- Test before using different AT-Firmware Version at your own risks. Just use any simple example to verify if the AT-firmware is OK.
- Compatible AT-Firmare version will be updated. Check for all supported AT Firmwares and download them from AT_Firmwares.
- Support to ESP32-AT-command shields will be added by using new library ESP_AT_Lib to replace Blynk's BlynkESP8266_Lib.
The best and easiest way is to use Arduino Library Manager
. Search for ESP_AT_WM_Lite
, then select / install the latest version.
You can also use this link for more detailed instructions.
- Navigate to ESP_AT_WM_Lite page.
- Download the latest release
ESP_AT_WM_Lite-master.zip
. - Extract the zip file to
ESP_AT_WM_Lite-master
directory - Copy whole
ESP_AT_WM_Lite-master
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
- Install VS Code
- Install PlatformIO
- Install ESP_AT_WM_Lite library or ESP_AT_WM_Lite library by using Library Manager. Search for ESP_AT_WM_Lite in Platform.io Author's Libraries
- Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File
To be able to compile, run and automatically detect and display BOARD_NAME on nRF52840/nRF52832 boards, you have to copy the whole nRF52 0.21.0 directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0).
Supposing the Adafruit nRF52 version is 0.21.0. These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/platform.txt
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/boards.txt
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/variants/NINA_B302_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/variants/NINA_B302_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/variants/NINA_B112_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/variants/NINA_B112_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/0.21.0/cores/nRF5/Udp.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/platform.txt
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/boards.txt
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.13/hardware/teensy/avr/boards.txt).
Supposing the Arduino version is 1.8.13. These files must be copied into the directory:
./arduino-1.8.13/hardware/teensy/avr/boards.txt
./arduino-1.8.13/hardware/teensy/avr/cores/teensy/Stream.h
./arduino-1.8.13/hardware/teensy/avr/cores/teensy3/Stream.h
./arduino-1.8.13/hardware/teensy/avr/cores/teensy4/Stream.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h
To be able to compile and run on SAM DUE boards, you have to copy the whole SAM DUE directory into Arduino sam directory (~/.arduino15/packages/arduino/hardware/sam/1.6.12).
Supposing the Arduino SAM core version is 1.6.12. This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/sam/x.yy.zz/platform.txt
To be able to compile without error and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards, you have to copy the whole Arduino SAMD cores 1.8.10 directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.10).
Supposing the Arduino SAMD version is 1.8.11. Now only one file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/1.8.11/platform.txt
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/x.yy.zz/platform.txt
Supposing the Arduino SAMD version is 1.8.9. These files must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/1.8.9/platform.txt
~/.arduino15/packages/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z
These files must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/platform.txt
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/cores/arduino/Arduino.h
This is mandatory to fix the notorious Arduino SAMD compiler error. See Improve Arduino compatibility with the STL (min and max macro)
...\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
Whenever the above-mentioned compiler error issue is fixed with the new Arduino SAMD release, you don't need to copy the Arduino.h
file anymore.
To be able to automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards, you have to copy the file Adafruit SAMD platform.txt into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.6.8).
Supposing the Adafruit SAMD core version is 1.6.8. This file must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/samd/1.6.8/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/platform.txt
To be able to automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards, you have to copy the file Seeeduino SAMD platform.txt into Adafruit samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.8.1).
Supposing the Seeeduino SAMD core version is 1.8.1. This file must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.1/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/platform.txt
To use LAN8720 on some STM32 boards
- Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
- Discovery (DISCO_F746NG)
- STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
you have to copy the files stm32f4xx_hal_conf_default.h and stm32f7xx_hal_conf_default.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.0.0/system) to overwrite the old files.
Supposing the STM32 stm32 core version is 2.0.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.0.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h
for STM32F4.~/.arduino15/packages/STM32/hardware/stm32/2.0.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h
for Nucleo-144 STM32F7.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F4xx/stm32f4xx_hal_conf_default.h
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F7xx/stm32f7xx_hal_conf_default.h
To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards, you have to copy the files STM32 variant.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.0.0). You have to modify the files corresponding to your boards, this is just an illustration how to do.
Supposing the STM32 stm32 core version is 2.0.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.0.0/variants/NUCLEO_F767ZI/variant.h
for Nucleo-144 NUCLEO_F767ZI.~/.arduino15/packages/STM32/hardware/stm32/2.0.0/variants/NUCLEO_L053R8/variant.h
for Nucleo-64 NUCLEO_L053R8.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/NUCLEO_F767ZI/variant.h
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/NUCLEO_L053R8/variant.h
To be able to automatically detect and display BOARD_NAME on Seeeduino SAMD (RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc) boards, you have to copy the file RP2040 platform.txt into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.2.2).
Supposing the rp2040 core version is 1.2.2. This file must be copied into the directory:
~/.arduino15/packages/rp2040/hardware/rp2040/1.2.2/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/platform.txt
- The nRF52_ESP8266Shield example shows how it works and should be used as the basis for a sketch that uses this library.
- The concept of nRF52_ESP8266Shield is that a new
ESP8266 AT shield
will start a WiFi configuration portal when powered up, but has no valid stored Credentials. - There are maximum 3 more custom parameters added in the sketch which you can use in your program later. In the example, they are: Blynk Server, Token and Blynk Port.
- Using any WiFi enabled device with a browser (computer, phone, tablet) connect to the newly created AP and type in the configurable AP IP address (default 192.168.4.1). The Config Portal AP channel (default 10) is also configurable to avoid conflict with other APs.
- The Config Portal is auto-adjusted to fix the 2 static parameters (WiFi SSID/PWD) as well as 6 more dynamic custom parameters.
- After the custom data entered, and
Save
button pressed, the configuration data will be saved in host's non-volatile memory, then the board reboots. - If there is valid stored Credentials, it'll go directly to connect to WiFi without starting / using the Config Portal.
ESP8266 AT shield
will try to connect. If successful, the dynamic DHCP or configured static IP address will be displayed in the configuration portal.- The
ESP8266 AT shield
WiFi Config Portal network and Web Server will shutdown to return control to the sketch code.
- Include in your sketch
// Select depending on board
#define EspSerial Serial1
#include <Esp8266_AT_WM_Lite_nRF52.h>
#define HOST_NAME "nRF52-ESP_AT"
// SSID and PW for Config Portal
String portal_ssid = "nRF52-CfgPrtl-SSID";
String portal_password = "nRF52-CfgPrtl-PW";
ESP_AT_WiFiManager_Lite* ESP_AT_WiFiManager;
// Your nRF52 <-> ESP8266 baud rate:
#define ESP8266_BAUD 115200
- To add custom parameters, just modify from the example below
#define USE_DYNAMIC_PARAMETERS true
/////////////// Start dynamic Credentials ///////////////
//Defined in <Esp8266_AT_WM_Lite_nRF52.h>
/**************************************
#define MAX_ID_LEN 5
#define MAX_DISPLAY_NAME_LEN 16
typedef struct
{
char id [MAX_ID_LEN + 1];
char displayName [MAX_DISPLAY_NAME_LEN + 1];
char *pdata;
uint8_t maxlen;
} MenuItem;
**************************************/
#if USE_DYNAMIC_PARAMETERS
#define MAX_MQTT_SERVER_LEN 34
char MQTT_Server [MAX_MQTT_SERVER_LEN + 1] = "mqtt-server";
#define MAX_MQTT_PORT_LEN 6
char MQTT_Port [MAX_MQTT_PORT_LEN + 1] = "1883";
MenuItem myMenuItems [] =
{
{ "mqtt", "MQTT Server", MQTT_Server, MAX_MQTT_SERVER_LEN },
{ "mqpt", "Port", MQTT_Port, MAX_MQTT_PORT_LEN },
};
// Due to notorious 2K buffer limitation of ESO8266-AT shield, the NUM_MENU_ITEMS is limited to max 3
// to avoid WebServer not working due to HTML data larger than 2K can't be sent successfully
// The items with index larger than 3 will be ignored
uint16_t NUM_MENU_ITEMS = min( 3, sizeof(myMenuItems) / sizeof(MenuItem)); //MenuItemSize;
#else
MenuItem myMenuItems [] = {};
uint16_t NUM_MENU_ITEMS = 0;
#endif
/////// // End dynamic Credentials ///////////
- If you don't need to add dynamic parameters, use in sketch
#define USE_DYNAMIC_PARAMETERS false
- When you want to open a config portal, just add
ESP_AT_WiFiManager = new ESP_AT_WiFiManager_Lite(&EspSerial, ESP8266_BAUD);
// Optional to change default AP IP(192.168.4.1)
//ESP_AT_WiFiManager->setConfigPortalIP(IPAddress(192, 168, 220, 1));
// Use channel(0) for random AP WiFi channel
ESP_AT_WiFiManager->setConfigPortalChannel(1);
// Personalized portal_ssid and password, e.g. CfgPrtl-SSID and CfgPrtl-PW
ESP_AT_WiFiManager->setConfigPortal(portal_ssid, portal_password);
ESP_AT_WiFiManager->begin();
- To not use default AP WiFi Channel 10 to avoid conflict with other WiFi APs, call
ESP_AT_WiFiManager->setConfigPortalChannel(newChannel);
- To use random AP WiFi Channel to avoid conflict with other WiFi APs :
ESP_AT_WiFiManager->setConfigPortalChannel(0);
- To use different static AP IP (not use default
192.168.4.1
), call
ESP_AT_WiFiManager->setConfigPortalIP(IPAddress(xxx,xxx,xxx,xxx));
While in AP mode, connect to it using its SSID
(Personalized SSID or "ESP_AT_XXXXXX") / Password
(Personalized PW or "MyESP_AT_XXXXXX"), then connect a Web-Browser to the Portal AP IP, default 192.168.4.1
, configure wifi and dynamic Credentials, then click Save
. The Credentials / WiFi connection information will be saved in non-volatile memory. It will then autoconnect to one of the configured WiFi APs.
Once Credentials / WiFi network information is saved in the host non-volatile memory, it will try to autoconnect to WiFi every time it is started, without requiring any function calls in the sketch.
// Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank"
// Default is false (if not defined) => must input 2 sets of SSID/PWD
#define REQUIRE_ONE_SET_SSID_PW true
But it's always advisable to use and input both sets for reliability.
// Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank"
// Default is false (if not defined) => must input 2 sets of SSID/PWD
#define REQUIRE_ONE_SET_SSID_PW false
#define SCAN_WIFI_NETWORKS true
The manual input of SSIDs is default enabled, so that users can input arbitrary SSID, not only from the scanned list. This is for the sample use-cases in which users can input the known SSIDs of another place, then send the boards to that place. The boards can connect to WiFi without users entering Config Portal to re-configure.
// To disable manually input SSID, only from a scanned SSID lists
#define MANUAL_SSID_INPUT_ALLOWED false
This is for normal use-cases in which users can only select an SSID from a scanned list of SSIDs to avoid typo mistakes and/or security.
The maximum number of SSIDs in the list is selectable from 2 to 6 for ESP8266/ESP32-AT. If invalid number of SSIDs is selected, the default number of 6 will be used.
// From 2-15
#define MAX_SSID_IN_LIST 8
- These ids (such as "mqtt" in example) must be unique.
Please be noted that the following reserved names are already used in library:
"id" for WiFi SSID
"pw" for WiFi PW
"id1" for WiFi1 SSID
"pw1" for WiFi1 PW
"nm" for Board Name
- Mega_ESP8266Shield
- SAMD_ESP8266Shield
- SAM_DUE_ESP8266Shield
- STM32_ESP8266Shield
- nRF52_ESP8266Shield
- RPi_Pico_ESP8266Shield. New
In Configuration Portal Mode
, it starts an AP named ESP_AT_XXXXXX
. Connect to it using the configurable password
you can define in the code. For example, MyESP_AT_XXXXXX
(see examples):
// SSID and PW for Config Portal
String ssid = "ESP_AT_" + String(0x1ABCDEF, HEX);
const char* password = "ESP_AT_PW";
After you connected, please, go to http://192.168.4.1 or newly configured AP IP, The following Config Portal screen will appear:
Enter your WiFi credentials,
then click Save
.
The WiFi Credentials will be saved and the board connect to the selected WiFi AP.
If you're already connected to a listed WiFi AP and don't want to change anything, just select Exit
from the Main
page to reboot the board and connect to the previously-stored AP. The WiFi Credentials are still intact.
- Now you can use special chars such as ~, !, @, #, $, %, ^, &, _, -, space,etc. thanks to brondolin to provide the amazing fix in Blynk_WM to permit input special chars such as % and # into data fields. See Issue 3.
- The SSIDs, Passwords must be input (or to make them different from blank). Otherwise, the Config Portal will re-open until those fields have been changed. If you don't need any field, just input anything or use duplicated data from similar field.
- WiFi password max length now is 63 chars according to WPA2 standard.
See this example and modify as necessary
1. To always load Default Credentials and override Config Portal data
// Used mostly for development and debugging. FORCES default values to be loaded each run.
// Config Portal data input will be ignored and overridden by DEFAULT_CONFIG_DATA
bool LOAD_DEFAULT_CONFIG_DATA = true;
2. To load Default Credentials when there is no valid Credentials.
// Used mostly once debugged. Assumes good data already saved in device.
// Config Portal data input will be override DEFAULT_CONFIG_DATA
bool LOAD_DEFAULT_CONFIG_DATA = false;
3. Example of Default Credentials
/// Start Default Config Data //////////////////
/*
#define SSID_MAX_LEN 32
//From v1.0.3, WPA2 passwords can be up to 63 characters long.
#define PASS_MAX_LEN 64
typedef struct
{
char wifi_ssid[SSID_MAX_LEN];
char wifi_pw [PASS_MAX_LEN];
} WiFi_Credentials;
#define NUM_WIFI_CREDENTIALS 2
// Configurable items besides fixed Header, just add board_name
#define NUM_CONFIGURABLE_ITEMS ( ( 2 * NUM_WIFI_CREDENTIALS ) + 1 )
////////////////
typedef struct Configuration
{
char header [16];
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
char board_name [24];
int checkSum;
} ESP8266_AT_Configuration;
*/
#define TO_LOAD_DEFAULT_CONFIG_DATA true
#if TO_LOAD_DEFAULT_CONFIG_DATA
// This feature is primarily used in development to force a known set of values as Config Data
// It will NOT force the Config Portal to activate. Use DRD or erase Config Data with Blynk.clearConfigData()
// Used mostly for development and debugging. FORCES default values to be loaded each run.
// Config Portal data input will be ignored and overridden by DEFAULT_CONFIG_DATA
//bool LOAD_DEFAULT_CONFIG_DATA = true;
// Used mostly once debugged. Assumes good data already saved in device.
// Config Portal data input will override DEFAULT_CONFIG_DATA
bool LOAD_DEFAULT_CONFIG_DATA = false;
ESP8266_AT_Configuration defaultConfig =
{
//char header[16], dummy, not used
"SHD_ESP8266",
// WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
// WiFi_Credentials.wifi_ssid and WiFi_Credentials.wifi_pw
"SSID1", "password1",
"SSID2", "password2",
//char board_name [24];
"SAMD-ESP_AT",
// terminate the list
//int checkSum, dummy, not used
0
/////////// End Default Config Data /////////////
};
#else
bool LOAD_DEFAULT_CONFIG_DATA = false;
ESP8266_AT_Configuration defaultConfig;
#endif // TO_LOAD_DEFAULT_CONFIG_DATA
/////////// End Default Config Data /////////////
Example of Default dynamicParams
- To add custom parameters, just modify the example below
#ifndef dynamicParams_h
#define dynamicParams_h
#include "defines.h"
// USE_DYNAMIC_PARAMETERS defined in defined.h
//#define USE_DYNAMIC_PARAMETERS true
/////////////// Start dynamic Credentials ///////////////
//Defined in <Esp8266_AT_WM_Lite_SAMD.h>
/**************************************
#define MAX_ID_LEN 5
#define MAX_DISPLAY_NAME_LEN 16
typedef struct
{
char id [MAX_ID_LEN + 1];
char displayName [MAX_DISPLAY_NAME_LEN + 1];
char *pdata;
uint8_t maxlen;
} MenuItem;
**************************************/
#if USE_DYNAMIC_PARAMETERS
#define MAX_MQTT_SERVER_LEN 34
char MQTT_Server [MAX_MQTT_SERVER_LEN + 1] = "mqtt-server";
#define MAX_MQTT_PORT_LEN 6
char MQTT_Port [MAX_MQTT_PORT_LEN + 1] = "1883";
MenuItem myMenuItems [] =
{
{ "mqtt", "MQTT Server", MQTT_Server, MAX_MQTT_SERVER_LEN },
{ "mqpt", "Port", MQTT_Port, MAX_MQTT_PORT_LEN },
};
// Due to notorious 2K buffer limitation of ESO8266-AT shield, the NUM_MENU_ITEMS is limited to max 3
// to avoid WebServer not working due to HTML data larger than 2K can't be sent successfully
// The items with index larger than 3 will be ignored
uint16_t NUM_MENU_ITEMS = min( 3, sizeof(myMenuItems) / sizeof(MenuItem)); //MenuItemSize;
#else
MenuItem myMenuItems [] = {};
uint16_t NUM_MENU_ITEMS = 0;
#endif
/////// // End dynamic Credentials ///////////
#endif //dynamicParams_h
- If you don't need to add dynamic parameters, use the following in sketch
#define USE_DYNAMIC_PARAMETERS false
or
/////////////// Start dynamic Credentials ///////////////
MenuItem myMenuItems [] = {};
uint16_t NUM_MENU_ITEMS = 0;
/////// // End dynamic Credentials ///////////
- These ids (such as "mqtt" in example) must be unique.
Please be noted that the following reserved names are already used in library:
"id" for WiFi SSID
"pw" for WiFi PW
"id1" for WiFi1 SSID
"pw1" for WiFi1 PW
"nm" for Board Name
Example nRF52_ESP8266Shield
1. File nRF52_ESP8266Shield.ino
#include "defines.h"
#include "Credentials.h"
#include "dynamicParams.h"
ESP_AT_WiFiManager_Lite* ESP_AT_WiFiManager;
void heartBeatPrint()
{
static int num = 1;
if (ESP_AT_WiFiManager->getWiFiStatus())
Serial.print("H"); // H means connected to WiFi
else
Serial.print("F"); // F means not connected to WiFi
if (num == 80)
{
Serial.println();
num = 1;
}
else if (num++ % 10 == 0)
{
Serial.print(" ");
}
}
void check_status()
{
static unsigned long checkstatus_timeout = 0;
//KH
#define HEARTBEAT_INTERVAL 20000L
// Print hearbeat every HEARTBEAT_INTERVAL (20) seconds.
if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
{
heartBeatPrint();
checkstatus_timeout = millis() + HEARTBEAT_INTERVAL;
}
}
void setup()
{
// Debug console
Serial.begin(115200);
while (!Serial);
Serial.print("\nStart nRF52_ESP8266Shield on ");
Serial.println(BOARD_NAME);
Serial.println(ESP_AT_WM_LITE_VERSION);
Serial.print("Debug Level = ");
Serial.println(_ESP_AT_WM_LOGLEVEL_);
// initialize serial for ESP module
EspSerial.begin(115200);
ESP_AT_WiFiManager = new ESP_AT_WiFiManager_Lite(&EspSerial, ESP8266_BAUD);
// Optional to change default AP IP(192.168.4.1)
//ESP_AT_WiFiManager->setConfigPortalIP(IPAddress(192, 168, 220, 1));
// Use channel(0) for random AP WiFi channel
ESP_AT_WiFiManager->setConfigPortalChannel(0);
// Personalized portal_ssid and password
ESP_AT_WiFiManager->setConfigPortal(portal_ssid, portal_password);
ESP_AT_WiFiManager->begin();
}
#if USE_DYNAMIC_PARAMETERS
void displayCredentials()
{
Serial.println("\nStored Dynamic Params:");
for (uint8_t i = 0; i < NUM_MENU_ITEMS; i++)
{
Serial.print(myMenuItems[i].displayName);
Serial.print(" = ");
Serial.println(myMenuItems[i].pdata);
}
}
void displayCredentialsOnce()
{
static bool displayedCredentials = false;
if (!displayedCredentials)
{
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
if (!strlen(myMenuItems[i].pdata))
{
break;
}
if ( i == (NUM_MENU_ITEMS - 1) )
{
displayedCredentials = true;
displayCredentials();
}
}
}
}
#endif
void loop()
{
ESP_AT_WiFiManager->run();
check_status();
#if (USE_DYNAMIC_PARAMETERS)
displayCredentialsOnce();
#endif
}
2. File defines.h
#ifndef defines_h
#define defines_h
/* Comment this out to disable prints and save space */
#define DRD_GENERIC_DEBUG true
#define USE_NEW_WEBSERVER_VERSION true //false
#define _ESP_AT_LOGLEVEL_ 1
/* Comment this out to disable prints and save space */
#define ESP_AT_DEBUG_OUTPUT Serial
#define ESP_AT_DEBUG true
#define _ESP_AT_WM_LOGLEVEL_ 3
// Uncomment to use ESP32-AT commands
//#define USE_ESP32_AT true
#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#if defined(ESP8266_AT_USE_NRF528XX)
#undef ESP8266_AT_USE_NRF528XX
#endif
#define ESP8266_AT_USE_NRF528XX true
#else
#error This code is intended to run only on the nRF52 boards ! Please check your Tools->Board setting.
#endif
#if (ESP8266_AT_USE_NRF528XX)
#if defined(NRF52840_FEATHER)
#define BOARD_TYPE "NRF52840_FEATHER_EXPRESS"
#elif defined(NRF52832_FEATHER)
#define BOARD_TYPE "NRF52832_FEATHER"
#elif defined(NRF52840_FEATHER_SENSE)
#define BOARD_TYPE "NRF52840_FEATHER_SENSE"
#elif defined(NRF52840_ITSYBITSY)
#define BOARD_TYPE "NRF52840_ITSYBITSY_EXPRESS"
#elif defined(NRF52840_CIRCUITPLAY)
#define BOARD_TYPE "NRF52840_CIRCUIT_PLAYGROUND"
#elif defined(NRF52840_CLUE)
#define BOARD_TYPE "NRF52840_CLUE"
#elif defined(NRF52840_METRO)
#define BOARD_TYPE "NRF52840_METRO_EXPRESS"
#elif defined(NRF52840_PCA10056)
#define BOARD_TYPE "NORDIC_NRF52840DK"
#elif defined(NINA_B302_ublox)
#define BOARD_TYPE "NINA_B302_ublox"
#elif defined(NINA_B112_ublox)
#define BOARD_TYPE "NINA_B112_ublox"
#elif defined(PARTICLE_XENON)
#define BOARD_TYPE "PARTICLE_XENON"
#elif defined(MDBT50Q_RX)
#define BOARD_TYPE "RAYTAC_MDBT50Q_RX"
#elif defined(ARDUINO_NRF52_ADAFRUIT)
#define BOARD_TYPE "ARDUINO_NRF52_ADAFRUIT"
#else
#define BOARD_TYPE "nRF52 Unknown"
#endif
#define EspSerial Serial1
#endif //ESP8266_AT_USE_NRF528XX
#ifndef BOARD_NAME
#define BOARD_NAME BOARD_TYPE
#endif
/////////////////////////////////////////////
// Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank"
// Default is false (if not defined) => must input 2 sets of SSID/PWD
#define REQUIRE_ONE_SET_SSID_PW false
#define USE_DYNAMIC_PARAMETERS true
/////////////////////////////////////////////
#define SCAN_WIFI_NETWORKS true
// To be able to manually input SSID, not from a scanned SSID lists
#define MANUAL_SSID_INPUT_ALLOWED true
// From 2-15
#define MAX_SSID_IN_LIST 6
/////////////////////////////////////////////
#include <Esp8266_AT_WM_Lite_nRF52.h>
#define HOST_NAME "nRF52-ESP_AT"
// SSID and PW for Config Portal
String portal_ssid = "CfgPrtl-SSID";
String portal_password = "CfgPrtl-PW";
// Your nRF52 <-> ESP8266 baud rate:
#define ESP8266_BAUD 115200
#endif //defines_h
3. File Credentials.h
#ifndef Credentials_h
#define Credentials_h
#include "defines.h"
/// Start Default Config Data //////////////////
/*
#define SSID_MAX_LEN 32
//From v1.0.3, WPA2 passwords can be up to 63 characters long.
#define PASS_MAX_LEN 64
typedef struct
{
char wifi_ssid[SSID_MAX_LEN];
char wifi_pw [PASS_MAX_LEN];
} WiFi_Credentials;
#define NUM_WIFI_CREDENTIALS 2
// Configurable items besides fixed Header, just add board_name
#define NUM_CONFIGURABLE_ITEMS ( ( 2 * NUM_WIFI_CREDENTIALS ) + 1 )
////////////////
typedef struct Configuration
{
char header [16];
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
char board_name [24];
int checkSum;
} ESP8266_AT_Configuration;
*/
#define TO_LOAD_DEFAULT_CONFIG_DATA true
#if TO_LOAD_DEFAULT_CONFIG_DATA
// This feature is primarily used in development to force a known set of values as Config Data
// It will NOT force the Config Portal to activate. Use DRD or erase Config Data with Blynk.clearConfigData()
// Used mostly for development and debugging. FORCES default values to be loaded each run.
// Config Portal data input will be ignored and overridden by DEFAULT_CONFIG_DATA
//bool LOAD_DEFAULT_CONFIG_DATA = true;
// Used mostly once debugged. Assumes good data already saved in device.
// Config Portal data input will be override DEFAULT_CONFIG_DATA
bool LOAD_DEFAULT_CONFIG_DATA = false;
ESP8266_AT_Configuration defaultConfig =
{
//char header[16], dummy, not used
"SHD_ESP8266",
// WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
// WiFi_Credentials.wifi_ssid and WiFi_Credentials.wifi_pw
"SSID1", "password1",
"SSID2", "password2",
//char board_name [24];
"nRF52-ESP_AT",
// terminate the list
//int checkSum, dummy, not used
0
/////////// End Default Config Data /////////////
};
#else
bool LOAD_DEFAULT_CONFIG_DATA = false;
ESP8266_AT_Configuration defaultConfig;
#endif // TO_LOAD_DEFAULT_CONFIG_DATA
/////////// End Default Config Data /////////////
#endif //Credentials_h
4. File dynamicParams.h
#ifndef dynamicParams_h
#define dynamicParams_h
#include "defines.h"
// USE_DYNAMIC_PARAMETERS defined in defined.h
//#define USE_DYNAMIC_PARAMETERS true
/////////////// Start dynamic Credentials ///////////////
//Defined in <Esp8266_AT_WM_Lite_nRF52.h>
/**************************************
#define MAX_ID_LEN 5
#define MAX_DISPLAY_NAME_LEN 16
typedef struct
{
char id [MAX_ID_LEN + 1];
char displayName [MAX_DISPLAY_NAME_LEN + 1];
char *pdata;
uint8_t maxlen;
} MenuItem;
**************************************/
#if USE_DYNAMIC_PARAMETERS
#define MAX_MQTT_SERVER_LEN 34
char MQTT_Server [MAX_MQTT_SERVER_LEN + 1] = "mqtt-server";
#define MAX_MQTT_PORT_LEN 6
char MQTT_Port [MAX_MQTT_PORT_LEN + 1] = "1883";
MenuItem myMenuItems [] =
{
{ "mqtt", "MQTT Server", MQTT_Server, MAX_MQTT_SERVER_LEN },
{ "mqpt", "Port", MQTT_Port, MAX_MQTT_PORT_LEN },
};
// Due to notorious 2K buffer limitation of ESO8266-AT shield, the NUM_MENU_ITEMS is limited to max 3
// to avoid WebServer not working due to HTML data larger than 2K can't be sent successfully
// The items with index larger than 3 will be ignored
uint16_t NUM_MENU_ITEMS = min( 3, sizeof(myMenuItems) / sizeof(MenuItem)); //MenuItemSize;
#else
MenuItem myMenuItems [] = {};
uint16_t NUM_MENU_ITEMS = 0;
#endif
/////// // End dynamic Credentials ///////////
#endif //dynamicParams_h
This is the terminal output when running nRF52_ESP8266Shield example on Adafruit ItsyBitsy NRF52840 Express and DRD is detected:
Start nRF52_ESP8266Shield on NRF52840_FEATHER
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
LittleFS Flag read = 0xd0d01234
Flag read = 0xd0d01234
doubleResetDetected
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
[ESP_AT] LoadCfgFile
[ESP_AT] OK
[ESP_AT] CCSum=0x1327,RCSum=0x1327
[ESP_AT] Valid Stored Dynamic Data
[ESP_AT] ======= Start Stored Config Data =======
[ESP_AT] b:StayInCfgPortal:DRD
[ESP_AT] Scanning Network
[ESP_AT] scanWifiNetworks: Done, Scanned Networks n = 8
[ESP_AT] WiFi networks found:
[ESP_AT] 1: dragino-1ed63c, -25dB
[ESP_AT] 2: HueNet, -27dB
[ESP_AT] 3: HueNetTek, -90dB
[ESP_AT] 4: HueNet1, -54dB
[ESP_AT] 5: HueNet2, -70dB
[ESP_AT] 6: bacau, -70dB
[ESP_AT] 7: guest_24, -25dB
[ESP_AT] 8: FishBowl, -13dB
[ESP_AT] SSID=CfgPrtl-SSID,PW=CfgPrtl-PW
[ESP_AT] IP=192.168.4.1,CH=1
F
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
FFFF
Start nRF52_ESP8266Shield on NRF52840_FEATHER
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
[ESP_AT] LoadCfgFile
[ESP_AT] OK
[ESP_AT] CCSum=0x1327,RCSum=0x1327
[ESP_AT] Valid Stored Dynamic Data
[ESP_AT] ======= Start Stored Config Data =======
[ESP_AT] ConMultiWifi
[ESP_AT] First connection, Using index=0
[ESP_AT] con2WF:SSID=HueNet1,PW=jenniqqs
[ESP_AT] Remaining retry_time=3
[ESP_AT] WOK, lastConnectedIndex=0
[ESP_AT] con2WF:OK
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
H
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
HHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH
Start nRF52_ESP8266Shield on NRF52840_FEATHER
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
[ESP_AT] CCSum=0x12c9,RCSum=0x12c9
[ESP_AT] Valid Stored Dynamic Data
[ESP_AT] ======= Start Stored Config Data =======
[ESP_AT] ConMultiWifi
[ESP_AT] First connection, Using index=0
[ESP_AT] con2WF:SSID=HueNet1,PW=password
[ESP_AT] Remaining retry_time=3
[ESP_AT] WOK, lastConnectedIndex=0
[ESP_AT] con2WF:OK
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
H
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
HH[ESP_AT] ConMultiWifi <== Lost Primary WiFi AP
[ESP_AT] Using index=1, lastConnectedIndex=0
[ESP_AT] con2WF:SSID=HueNet2,PW=password
[ESP_AT] Remaining retry_time=2
[ESP_AT] WOK, lastConnectedIndex=1 <== Reconnect to Secondary WiFi AP
[ESP_AT] con2WF:OK
HHHHH
This is the terminal output when running SAMD_ESP8266Shield example on Adafruit SAMD51 ItsyBitsy_M4 :
Start SAMD_ESP8266Shield on ITSYBITSY_M4
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
Flag read = 0xffffffff
No doubleResetDetected
SetFlag write = 0xd0d01234
[ESP_AT] CCSum=0x72de,RCSum=0x10200754
[ESP_AT] Invalid Stored Dynamic Data. Load default from Sketch
[ESP_AT] SaveEEPROM,sz=1024,Datasz=520,CSum=4156
[ESP_AT] b:StayInCfgPortal:NoCfgDat
[ESP_AT] Scanning Network
[ESP_AT] scanWifiNetworks: Done, Scanned Networks n = 9
[ESP_AT] WiFi networks found:
[ESP_AT] 1: HueNet1, -30dB
[ESP_AT] 2: HueNet, -88dB
[ESP_AT] 3: HueNetTek, -91dB
[ESP_AT] 4: dragino-1ed63c, -24dB
[ESP_AT] 5: HueNet2, -50dB
[ESP_AT] 6: Rogers 786, -26dB
[ESP_AT] 7: Access 2.0, -41dB
[ESP_AT] 8: VIRGIN874, -78dB
[ESP_AT] 9: Jasmine, -90dB
[ESP_AT] SSID=SAMD-CfgPrtl-SSID,PW=SAMD-CfgPrtl-PW
[ESP_AT] IP=192.168.4.1,CH=6
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
F
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
FFFF[ESP_AT] h:UpdFlash
[ESP_AT] SaveEEPROM,sz=1024,Datasz=520,CSum=4809
[ESP_AT] h:Rst
Start SAMD_ESP8266Shield on ITSYBITSY_M4
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[ESP_AT] CCSum=0x12c9,RCSum=0x12c9
[ESP_AT] Valid Stored Dynamic Data
[ESP_AT] ======= Start Stored Config Data =======
[ESP_AT] ConMultiWifi
[ESP_AT] First connection, Using index=0
[ESP_AT] con2WF:SSID=HueNet1,PW=password
[ESP_AT] Remaining retry_time=3
[ESP_AT] WOK, lastConnectedIndex=0
[ESP_AT] con2WF:OK
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
H
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
HHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH
Start SAMD_ESP8266Shield on ITSYBITSY_M4
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[ESP_AT] CCSum=0x12c9,RCSum=0x12c9
[ESP_AT] Valid Stored Dynamic Data
[ESP_AT] ======= Start Stored Config Data =======
[ESP_AT] ConMultiWifi
[ESP_AT] First connection, Using index=0
[ESP_AT] con2WF:SSID=HueNet1,PW=password
[ESP_AT] Remaining retry_time=3
[ESP_AT] WOK, lastConnectedIndex=0
[ESP_AT] con2WF:OK
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
H
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
HH[ESP_AT] ConMultiWifi <== Lost Primary WiFi AP
[ESP_AT] Using index=1, lastConnectedIndex=0
[ESP_AT] con2WF:SSID=HueNet2,PW=password
[ESP_AT] Remaining retry_time=2
[ESP_AT] WOK, lastConnectedIndex=1 <== Reconnect to Secondary WiFi AP
[ESP_AT] con2WF:OK
HHHHH
This is the terminal output when running RPi_Pico_ESP8266Shield example on RASPBERRY_PI_PICO :
Start RPi_Pico_ESP8266Shield on RASPBERRY_PI_PICO
ESP_AT_WM_Lite v1.3.0
Debug Level = 3
[ESP_AT] Use ES8266-AT Command
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
[ESP_AT] LoadCfgFile
[ESP_AT] OK
[ESP_AT] Invalid Stored WiFi Config Data.
[ESP_AT] SSID is blank or NULL
[ESP_AT] b:StayInCfgPortal:NoCfgDat
[ESP_AT] Scanning Network
[ESP_AT] scanWifiNetworks: Done, Scanned Networks n = 9
[ESP_AT] WiFi networks found:
[ESP_AT] 1: HueNetTek, -35dB
[ESP_AT] 2: HueNet1, -85dB
[ESP_AT] 3: , -83dB
[ESP_AT] 4: Waterhome, -82dB
[ESP_AT] 5: dlink-4F96, -77dB
[ESP_AT] 8: BELL627, -47dB
[ESP_AT] 9: Primus-f6b1, -82dB
[ESP_AT] SSID=CfgPrtl-SSID,PW=CfgPrtl-PW
[ESP_AT] IP=192.168.4.1,CH=1
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
F
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
FFFFFFFFF FFFF
Start RPi_Pico_ESP8266Shield on RASPBERRY_PI_PICO
ESP_AT_WM_Lite v1.3.0
Debug Level = 4
[ESP_AT] Use ES8266-AT Command
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
[ESP_AT] ======= Start Default Config Data =======
[ESP_AT] Hdr=SHD_ESP8266,SSID=SSID1,PW=password1
[ESP_AT] SSID1=SSID2,PW1=password2
[ESP_AT] BName=nRF52-ESP_AT
[ESP_AT] i=0,id=mqtt,data=mqtt-server
[ESP_AT] i=1,id=mqpt,data=1883
[ESP_AT] LoadCfgFile
[ESP_AT] OK
[ESP_AT] LoadCredFile
[ESP_AT] ChkCrR: Buffer allocated, Sz=35
[ESP_AT] ChkCrR:pdata=mqtt-server,len=34
[ESP_AT] ChkCrR:pdata=1883,len=6
[ESP_AT] OK
[ESP_AT] CrCCsum=0x55e,CrRCsum=0x55e
[ESP_AT] Buffer freed
[ESP_AT] CCSum=0x1186,RCSum=0x1186
[ESP_AT] LoadCredFile
[ESP_AT] CrR:pdata=mqtt-server,len=34
[ESP_AT] CrR:pdata=1883,len=6
[ESP_AT] OK
[ESP_AT] CrCCsum=0x55e,CrRCsum=0x55e
[ESP_AT] Valid Stored Dynamic Data
[ESP_AT] ======= Start Stored Config Data =======
[ESP_AT] Hdr=SHD_ESP8266,SSID=HueNet1,PW=password
[ESP_AT] SSID1=HueNet2,PW1=password
[ESP_AT] BName=RPi-Pico
[ESP_AT] i=0,id=mqtt,data=mqtt-server
[ESP_AT] i=1,id=mqpt,data=1883
[ESP_AT] ConMultiWifi
[ESP_AT] First connection, Using index=0
[ESP_AT] con2WF:SSID=HueNet1,PW=password
[ESP_AT] Remaining retry_time=3
[ESP_AT] WOK, lastConnectedIndex=0
[ESP_AT] con2WF:OK
[ESP_AT] IP=192.168.2.76
[ESP_AT] b:WOK
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
H
Stored Dynamic Params:
MQTT Server = mqtt-server
Port = 1883
HHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH
Debug is enabled by default on Serial. To disable, add at the beginning of sketch
/* Comment this out to disable prints and save space */
#define DRD_GENERIC_DEBUG true
#define USE_NEW_WEBSERVER_VERSION true //false
#define _ESP_AT_LOGLEVEL_ 1
/* Comment this out to disable prints and save space */
#define ESP_AT_DEBUG_OUTPUT Serial
#define ESP_AT_DEBUG true
#define _ESP_AT_WM_LOGLEVEL_ 3
If you get compilation errors, more often than not, you may need to install a newer version of the board's core, ESP8266 AT shield
AT-command or this library version.
Sometimes, the library will only work if you update the ESP8266 AT shield
core to the newer or older version because some function compatibility.
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core using LittleFS
- Using new efficient features of
FlashStorage_SAMD library v1.1.0+
- Optimize code and fix bug
- Update examples with new features
- Enable scan of WiFi networks for selection in Configuration Portal. Check PR for v1.3.0 - Enable scan of WiFi networks #10. Now you can select optional SCAN_WIFI_NETWORKS, MANUAL_SSID_INPUT_ALLOWED to be able to manually input SSID, not only from a scanned SSID lists and MAX_SSID_IN_LIST (from 2-6 for ESP8266-AT or 2-15 for other)
- Minor enhancement to not display garbage when data is invalid
- Tested with new Arduino Core for STM32 v2.0.0 and add support to new STM32L5 boards.
- Enhance MultiWiFi connection logic
- Enhance debugging feature
- Fix invalid "blank" Config Data treated as Valid.
- Permit optionally inputting one set of WiFi SSID/PWD by using
REQUIRE_ONE_SET_SSID_PW == true
- Enforce WiFi PWD minimum length of 8 chars
- Optimize code
- Use better FlashStorage_STM32.
- Add Table-of-Contents
- Add support to ESP32-AT WiFi shields.
- Add support to WIS600-01S/W600-AT WiFi shields.
- Modify LOAD_DEFAULT_CONFIG_DATA logic.
- Enhance MultiWiFi connection logic.
- Fix WiFi Status bug.
- Add support to nRF52 (AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.). Dynamic custom parameters to be saved automatically in LittleFS.
- Add MultiWiFi features for WiFi
- Add DoubleResetDetector (DRD) feature.
- Restructure examples separate Credentials / Defines / Dynamic Params / Code.
- Drop support to Teensy boards.
- Add support to SAM51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.) and SAM DUE.
- WiFi Password max length is 63, according to WPA2 standard.
- Permit to input special chars such as ~,!,@,#,$,%,^,*,& into data fields.
- Fix bug
- New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Config Portal will be auto-adjusted to match the number of dynamic parameters.
- Dynamic custom parameters to be saved automatically in EEPROM, SAMD EEPROM-emulated FlashStorage or SAM DUE DueFlashStorage.
- This is a Light-Weight Credentials / WiFi Connection Manager with fallback web configuration portal. Completely new to support Teensy, SAM DUE, SAMD, STM32, etc. boards running ESP8266 AT-command shields. with small memory (64+K bytes)
- Config Portal AP SSID and Password will use 4 bytes of hardware unique macAddress, only for Teensy.
Submit issues to: ESP_AT_WM_Lite issues
- Too many things to list, EEPROM, SPIFFS/FS/FAT FS (if available). Done.
- Find better and easier way to add more parameters. Done.
- Add more examples. Done.
- Add more boards. Done.
- Add support to RP2040-based boards such as RASPBERRY_PI_PICO, using Arduino-mbed RP2040 core
- Adding dynamic custom parameters
- Add MultiWiFi and Auto(Re)Connect feature
- Add support to AVR, SAM DUE, SAMD21, SAMD51, nRF52, STM32F/L/H/G/WB/MP1, etc.
- Many more to list ( WPA2 password length, special chars, etc.)
- Add DRD
- Add default Credentials
- Add Dynamic parameters
- Add Configurable Config Portal Title
- Split each example into several manageable files.
- Use more efficient FlashStorage_SAMD and FlashStorage_STM32
- Add Table-of-Contents
- Permit optionally inputting one set of WiFi SSID/PWD by using
REQUIRE_ONE_SET_SSID_PW == true
- Enforce WiFi PWD minimum length of 8 chars
- Enable scan of WiFi networks for selection in Configuration Portal
- Add support to new STM32 core v2.0.0 and new STM32L5 boards.
- Add support to RP2040-based boards such as RASPBERRY_PI_PICO, using Earle Philhower's arduino-pico core using LittleFS
Please help contribute to this project and add your name here.
- Thanks to Michael H. "bizprof" with the impressive new feature :
Enable scan of WiFi networks for selection in Configuration Portal
. Check PR for v1.3.0 - Enable scan of WiFi networks #10 leading to v1.2.0
⭐️ Michael H. "bizprof" |
If you want to contribute to this project:
- Report bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Tell other people about this library
- The library is licensed under MIT
Copyright 2020- Khoi Hoang