Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit b0bbb2b

Browse files
authored
v1.0.10
### Releases v1.0.10 1. Use ESP8266/ESP32 MultiWiFi feature to autoconnect to the best and available WiFi SSID. 2. Auto format SPIFFS/LittleFS for first time usage. 3. Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
1 parent 84f6e82 commit b0bbb2b

35 files changed

+2416
-1949
lines changed

README.md

Lines changed: 496 additions & 470 deletions
Large diffs are not rendered by default.

examples/ESP32_GSM/Credentials.h

Lines changed: 103 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,121 @@
11
/****************************************************************************************************************************
2-
Credentials.h for ESP32_GSM.ino
3-
For ESP32 boards to run GSM/GPRS and WiFi simultaneously, using config portal feature
4-
5-
Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
6-
Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
7-
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager
8-
Licensed under MIT license
9-
Version: 1.0.9
2+
Credentials.h
3+
For ESP32 TTGO-TCALL boards to run GSM/GPRS and WiFi simultaneously, using config portal feature
4+
Uploading SHT3x temperature and humidity data to Blynk
5+
6+
Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
7+
Based on and modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
8+
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_Manager
9+
Licensed under MIT license
10+
Version: 1.0.10
1011
11-
Version Modified By Date Comments
12-
------- ----------- ---------- -----------
13-
1.0.0 K Hoang 17/01/2020 Initial coding. Add config portal similar to Blynk_WM library.
14-
1.0.1 K Hoang 27/01/2020 Change Synch XMLHttpRequest to Async (https://xhr.spec.whatwg.org/). Reduce code size
15-
1.0.2 K Hoang 08/02/2020 Enable GSM/GPRS and WiFi running simultaneously
16-
1.0.3 K Hoang 18/02/2020 Add checksum. Add clearConfigData()
17-
1.0.4 K Hoang 14/03/2020 Enhance Config Portal GUI. Reduce code size.
18-
1.0.5 K Hoang 20/03/2020 Add more modem supports. See the list in README.md
19-
1.0.6 K Hoang 07/04/2020 Enable adding dynamic custom parameters from sketch
20-
1.0.7 K Hoang 09/04/2020 SSID password maxlen is 63 now. Permit special chars # and % in input data.
21-
1.0.8 K Hoang 14/04/2020 Fix bug.
22-
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
23-
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
12+
Version Modified By Date Comments
13+
------- ----------- ---------- -----------
14+
1.0.0 K Hoang 17/01/2020 Initial coding. Add config portal similar to Blynk_WM library.
15+
1.0.1 K Hoang 27/01/2020 Change Synch XMLHttpRequest to Async (https://xhr.spec.whatwg.org/). Reduce code size
16+
1.0.2 K Hoang 08/02/2020 Enable GSM/GPRS and WiFi running simultaneously
17+
1.0.3 K Hoang 18/02/2020 Add checksum. Add clearConfigData()
18+
1.0.4 K Hoang 14/03/2020 Enhance Config Portal GUI. Reduce code size.
19+
1.0.5 K Hoang 20/03/2020 Add more modem supports. See the list in README.md
20+
1.0.6 K Hoang 07/04/2020 Enable adding dynamic custom parameters from sketch
21+
1.0.7 K Hoang 09/04/2020 SSID password maxlen is 63 now. Permit special chars # and % in input data.
22+
1.0.8 K Hoang 14/04/2020 Fix bug.
23+
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
24+
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
25+
1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage.
26+
Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
2427
*****************************************************************************************************************************/
2528

2629
#ifndef Credentials_h
2730
#define Credentials_h
2831

29-
/// Start Default Config Data //////////////////
30-
31-
/*
32-
// Defined in <BlynkSimpleESP8266_GSM_WFM.h>
32+
#if USE_BLYNK_WM
3333

34-
#define SSID_MAX_LEN 32
35-
//From v1.0.10, WPA2 passwords can be up to 63 characters long.
36-
#define PASS_MAX_LEN 64
34+
/// Start Default Config Data //////////////////
3735

38-
typedef struct
39-
{
40-
char wifi_ssid[SSID_MAX_LEN];
41-
char wifi_pw [PASS_MAX_LEN];
42-
} WiFi_Credentials;
43-
44-
#define BLYNK_SERVER_MAX_LEN 32
45-
#define BLYNK_TOKEN_MAX_LEN 36
36+
/*
37+
// Defined in <BlynkSimpleESP8266_GSM_WFM.h>
4638
47-
typedef struct
48-
{
49-
char blynk_server [BLYNK_SERVER_MAX_LEN];
50-
char wifi_blynk_token [BLYNK_TOKEN_MAX_LEN];
51-
char gsm_blynk_token [BLYNK_TOKEN_MAX_LEN];
52-
} Blynk_Credentials;
39+
#define SSID_MAX_LEN 32
40+
//From v1.0.10, WPA2 passwords can be up to 63 characters long.
41+
#define PASS_MAX_LEN 64
42+
43+
typedef struct
44+
{
45+
char wifi_ssid[SSID_MAX_LEN];
46+
char wifi_pw [PASS_MAX_LEN];
47+
} WiFi_Credentials;
48+
49+
#define BLYNK_SERVER_MAX_LEN 32
50+
#define BLYNK_TOKEN_MAX_LEN 36
51+
52+
typedef struct
53+
{
54+
char blynk_server [BLYNK_SERVER_MAX_LEN];
55+
char wifi_blynk_token [BLYNK_TOKEN_MAX_LEN];
56+
char gsm_blynk_token [BLYNK_TOKEN_MAX_LEN];
57+
} Blynk_Credentials;
58+
59+
#define NUM_WIFI_CREDENTIALS 2
60+
#define NUM_BLYNK_CREDENTIALS 2
61+
62+
// Configurable items besides fixed Header
63+
#define NUM_CONFIGURABLE_ITEMS ( 6 + (2 * NUM_WIFI_CREDENTIALS) + (3 * NUM_BLYNK_CREDENTIALS) )
64+
#define DEFAULT_GPRS_PIN "1234"
65+
66+
typedef struct Configuration
67+
{
68+
char header [16];
69+
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
70+
Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
71+
int blynk_port;
72+
// YOUR GSM / GPRS RELATED
73+
char apn [32];
74+
char gprsUser [32];
75+
char gprsPass [32];
76+
char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
77+
// END OF YOUR GSM / GPRS RELATED
78+
char board_name [24];
79+
int checkSum;
80+
} Blynk_WF_Configuration;
5381
54-
#define NUM_WIFI_CREDENTIALS 2
55-
#define NUM_BLYNK_CREDENTIALS 2
82+
*/
5683

57-
// Configurable items besides fixed Header
58-
#define NUM_CONFIGURABLE_ITEMS ( 6 + (2 * NUM_WIFI_CREDENTIALS) + (3 * NUM_BLYNK_CREDENTIALS) )
59-
#define DEFAULT_GPRS_PIN "1234"
84+
//bool LOAD_DEFAULT_CONFIG_DATA = true;
85+
bool LOAD_DEFAULT_CONFIG_DATA = false;
6086

61-
typedef struct Configuration
87+
Blynk_WF_Configuration defaultConfig =
6288
{
63-
char header [16];
64-
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
65-
Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
66-
int blynk_port;
89+
//char header[16], dummy, not used
90+
"GSM",
91+
//WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]
92+
//WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw
93+
"SSID1", "password1",
94+
"SSID2", "password2",
95+
// Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
96+
// Blynk_Creds.blynk_server, Blynk_Creds.wifi_blynk_token and Blynk_Creds.gsm_blynk_token
97+
"account.ddns.net", "wifi_token", "gsm_token",
98+
"account.duckdns.org", "wifi_token1", "gsm_token1",
99+
//int blynk_port;
100+
8080,
67101
// YOUR GSM / GPRS RELATED
68-
char apn [32];
69-
char gprsUser [32];
70-
char gprsPass [32];
71-
char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
72-
// END OF YOUR GSM / GPRS RELATED
73-
char board_name [24];
74-
int checkSum;
75-
} Blynk_WF_Configuration;
76-
77-
*/
78-
79-
bool LOAD_DEFAULT_CONFIG_DATA = true;
80-
//bool LOAD_DEFAULT_CONFIG_DATA = false;
81-
82-
Blynk_WF_Configuration defaultConfig =
83-
{
84-
//char header[16], dummy, not used
85-
"GSM",
86-
//WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]
87-
//WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw
88-
"SSID1", "password1",
89-
"SSID2", "password2",
90-
// Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
91-
// Blynk_Creds.blynk_server, Blynk_Creds.wifi_blynk_token and Blynk_Creds.gsm_blynk_token
92-
"account.ddns.net", "wifi_token", "gsm_token",
93-
"account.duckdns.org", "wifi_token1", "gsm_token1",
94-
//int blynk_port;
95-
8080,
96-
// YOUR GSM / GPRS RELATED
97-
//char apn [32];
98-
"rogers-core-appl1.apn",
99-
//char gprsUser [32];
100-
"wapuser1",
101-
//char gprsPass [32];
102-
"wap",
103-
//char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
104-
"1245678",
105-
// END OF YOUR GSM / GPRS RELATED
106-
//char board_name [24];
107-
"ESP32-GSM-WiFi",
108-
//int checkSum, dummy, not used
109-
0
110-
};
111-
112-
/////////// End Default Config Data /////////////
102+
//char apn [32];
103+
"rogers-core-appl1.apn",
104+
//char gprsUser [32];
105+
"wapuser1",
106+
//char gprsPass [32];
107+
"wap",
108+
//char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
109+
"1245678",
110+
// END OF YOUR GSM / GPRS RELATED
111+
//char board_name [24];
112+
"ESP32-GSM-WiFi",
113+
//int checkSum, dummy, not used
114+
0
115+
};
116+
117+
/////////// End Default Config Data /////////////
113118

119+
#endif // #if USE_BLYNK_WM
114120

115121
#endif //Credentials_h

examples/ESP32_GSM/ESP32_GSM.ino

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
For ESP32 to run GSM/GPRS and WiFi simultaneously, using config portal feature
44
55
Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
6-
Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
7-
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager
6+
Based on and modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
7+
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_Manager
88
Licensed under MIT license
9-
Version: 1.0.9
9+
Version: 1.0.10
1010
1111
Version Modified By Date Comments
1212
------- ----------- ---------- -----------
@@ -21,6 +21,8 @@
2121
1.0.8 K Hoang 14/04/2020 Fix bug.
2222
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
2323
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
24+
1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage.
25+
Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
2426
*****************************************************************************************************************************/
2527

2628
#include "defines.h"
@@ -86,7 +88,8 @@ void setup()
8688
while (!SerialMon);
8789

8890
SerialMon.print(F("\nStart ESP32-WIFI-GSM using "));
89-
SerialMon.println(CurrentFileFS);
91+
SerialMon.print(CurrentFileFS);
92+
SerialMon.println(" on " + String(ARDUINO_BOARD));
9093

9194
// Set-up modem reset, enable, power pins
9295
pinMode(MODEM_PWKEY, OUTPUT);
@@ -107,12 +110,28 @@ void setup()
107110
Serial.println(F("Use WiFi to connect Blynk"));
108111

109112
#if USE_BLYNK_WM
113+
114+
// Set config portal SSID and Password
115+
Blynk_WF.setConfigPortal("TestPortal-ESP32", "TestPortalPass");
116+
110117
// Use configurable AP IP, instead of default IP 192.168.4.1
111-
Blynk_WF.setConfigPortalIP(IPAddress(192, 168, 240, 1));
112-
// Use channel = 0 => random Config Portal WiFi channel to avoid conflict
118+
Blynk_WF.setConfigPortalIP(IPAddress(192, 168, 232, 1));
119+
// Set config portal channel, default = 1. Use 0 => random channel from 1-12 to avoid conflict
113120
Blynk_WF.setConfigPortalChannel(0);
114-
// Set personalized Hostname
121+
122+
// Select either one of these to set static IP + DNS
123+
Blynk_WF.setSTAStaticIPConfig(IPAddress(192, 168, 2, 232), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
124+
//Blynk_WF.setSTAStaticIPConfig(IPAddress(192, 168, 2, 232), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
125+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
126+
//Blynk_WF.setSTAStaticIPConfig(IPAddress(192, 168, 2, 232), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
127+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
128+
129+
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
130+
//Blynk_WF.begin();
131+
// Use this to personalize DHCP hostname (RFC952 conformed)
132+
// 24 chars max,- only a..z A..Z 0..9 '-' and no '-' as last char
115133
Blynk_WF.begin("ESP32-WiFi-GSM");
134+
116135
#else
117136
Blynk_WF.begin(wifi_blynk_tok, ssid, pass, blynk_server, BLYNK_HARDWARE_PORT);
118137

examples/ESP32_GSM/defines.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/****************************************************************************************************************************
2-
defines.h for ESP32_GSM.ino
2+
defines.h
33
For ESP32 boards to run GSM/GPRS and WiFi simultaneously, using config portal feature
44
55
Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
6-
Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
7-
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager
6+
Based on and modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
7+
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_Manager
88
Licensed under MIT license
9-
Version: 1.0.9
9+
Version: 1.0.10
1010
1111
Version Modified By Date Comments
1212
------- ----------- ---------- -----------
@@ -21,6 +21,8 @@
2121
1.0.8 K Hoang 14/04/2020 Fix bug.
2222
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
2323
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
24+
1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage.
25+
Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
2426
*****************************************************************************************************************************/
2527

2628
#ifndef defines_h

0 commit comments

Comments
 (0)