BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk WiFiManager for ESP8266/ESP32 with Multi-WiFi and Multi-Blynk

Try at

This works for ESP8266 and ESP32, with or w/o SSL. The configuration data can be saved either in EEPROM or SPIFFS.

3 Likes

Using SSL for local server is a little bit more complicated.
I just created and posted a note for creating / installing LetsEncrypt as well as OpenSSL SSL certificates for Local Blynk Server. Hope it’s helpful.

Below is the Notes:

Any problems, please do not hesitate to open an issue:

1 Like

Updated: Dec 17th 2019

Blynk_WiFiManager libraries v1.0.2 just got included into Arduino Library Manager.
Now you can install this library directly from Arduino Library Manager.

Updated Dec 29th 2019

Included in Platform.io

Updated: Jan 08th 2020

Releases v1.0.4

Why this version

I’m really fed-up with the unfriendly, confusing and cryptic DHCP hostnames such as ESP_XXXXXX, espressif, etc., using ChipID.
Thanks to an issue opened in library ESP_WiFiManager (https://github.com/khoih-prog/ESP_WiFiManager), I decided to add this option to have built-in, yet configurable DHCP hostname to these libraries.

Now you can easily specify and have the friendly, identifiable, RFC-952-conformed DHP hostnames associated with your boards, such as SmartFarm-DeepSleep-1, Irrigation, Master-Controller, etc. You’ll be happier to have a look at your WiFi Router DHCP list and find out which is which.

New in this version

  1. Add configurable personalized RFC-952 DHCP hostname and setHostname()
  2. Modify examples to use new feature
2 Likes

Updated: Jan 20th 2020

Releases v1.0.5

Why this version

Normally, the default Portal IP (192.168.4.1), SSID and PW as well as the dynamically allocated board’s IP address are good enough.
In special cases where there is conflict, if static IP is required or bad router’s DNS settings, you can use the new features to force the configurable IP addresses. But please use with care to avoid potential issues.

New in this version

Add new features to enable :

  1. configuring Portal Static IP address, Name and Password.
  2. configuring Static IP address, Gateway, Subnet Mask and 2 DNS Servers IP addresses.

Following is the sample terminal output when running example ESP32WM_Config with SSL option true

Starting ...
[34] RFC925 Hostname = ESP32-WM-Config
[46] Header = SSL_ESP32, SSID = ***, PW = ***
[46] Server = account.duckdns.org, Port = 9443, Token = ***
[47] Board Name = ESP32-WM-SSL-Config
[50] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32

[146] Use static IP
[151] connectToWifi: start
[402] connectToWifi: connected OK
[402] IP = 192.168.2.230, GW = 192.168.2.1, SN = 255.255.255.0
[402] DNS1 = 192.168.2.1, DNS2 = 8.8.8.8
[403] begin: WiFi connected. Try connecting to Blynk
[408] BlynkArduinoClient.connect: Connecting to account.duckdns.org:9443
[3684] Certificate OK
[3696] Ready (ping: 10ms).
[3763] begin: WiFi and Blynk connected

Blynk ESP32 using EEPROM connected. Board Name : ESP32-WM-SSL-Config
EEPROM size = 4096 bytes, EEPROM start address = 1024 / 0x400

Update Feb 6th 2020

New in Version v1.0.6

  1. Optimize
  2. Fix ESP32 EEPROM size to 2K from 4K to avoid NVS error
  3. Shorten code size
  4. Add functions
  5. Use dynamically allocated Config Portal WebServer.

Update Feb 18th 2020

Releases v1.0.7

New in Version v1.0.7

  1. Add checksum for more reliable data
  2. Add Multi-WiFi feature to enable reconnect to the best / available WiFi AP.
  3. Add Multi-Blynk feature to enable reconnect to the best / available Blynk Server.

ConfigPortal

The following is the sample terminal output when running example ESP8266WM_Config

Starting ...
[65] RFC925 Hostname = ESP8266-WM-Config
[66] Calc Cksum = 0x309d, Read Cksum = 0x309d
[66] Header = ESP8266, Board Name = ESP8266-Multi-WM
[67] SSID = ****, PW = ****
[70] SSID1 = ****1, PW1 = ****1
[74] Server = 192.168.2.112, Token = ****
[80] Server1 = account.duckdns.org, Token1 = ****
[86] Port = 8080
[88] Connecting MultiWifi...
[11276] WiFi connected after time: 2
[11276] SSID: ****, RSSI = -45                                 <= Connected to SSID
[11276] Channel: 2, IP address: 192.168.2.91
[11277] bg: WiFi connected. Try Blynk
[11279] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on NodeMCU

[11292] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080  <= Try Server
[11325] Ready (ping: 19ms).                                  <= Connected to Server
[11392] Connected to Blynk Server = 192.168.2.112, Token  = ****
[11392] bg: WiFi+Blynk connected
Blynk ESP8288 using EEPROM connected. Board Name : ESP8266-Multi-WM
EEPROM size = 4096 bytes, EEPROM start address = 512 / 0x200
BRB
[101232] run: WiFi lost. Reconnect WiFi+Blynk                  <= Lost SSID
[101232] Connecting MultiWifi...
[106316] WiFi connected after time: 1
[106317] SSID: ****1, RSSI = -62                               <= Connected to SSID1
[106317] Channel: 4, IP address: 192.168.2.91
[106317] run: WiFi reconnected. Connect to Blynk
[106320] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080   <= Try Server
[106352] Ready (ping: 11ms).                                   <= Connected to Server
[106419] run: WiFi+Blynk reconnected
RB
[165434] Heartbeat timeout                                              <= Lost Server
[165735] run: Blynk lost. Connect Blynk
[165735] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on NodeMCU

[165741] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080  <= Server lost
[170741] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on NodeMCU

[170743] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080 <= Try Server1
[170781] Ready (ping: 9ms).
[170848] Connected to Blynk Server = account.duckdns.org, Token  = **** <= Connected to Server1
[170848] run: Blynk reconnected
RBRBRBRBRBRBRB RBRB

You can see that the system automatically detects and connects to the best or available WiFi APs and/or Blynk Servers, whenever interruption happens. This feature is very useful for systems requiring high degree of reliability.

3 Likes