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

Commit b690b3e

Browse files
authored
Fix messed-up README.md
1 parent 639afbd commit b690b3e

File tree

1 file changed

+153
-23
lines changed

1 file changed

+153
-23
lines changed

README.md

Lines changed: 153 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
## BlynkGSM_Manager
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/BlynkGSM_Manager.svg?)](https://www.ardu-badge.com/BlynkGSM_Manager)
4-
[![GitHub release](https://img.shields.io/github/release/khoih-prog/BlynkGSM_Manager.svg)](https://github.com/khoih-prog/BlynkGSM_Manager/releases)
5-
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/BlynkGSM_Manager/blob/master/LICENSE)
6-
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
7-
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/BlynkGSM_Manager.svg)](http://github.com/khoih-prog/BlynkGSM_Manager/issues)
84

95
### Releases v1.0.8
106

@@ -184,8 +180,131 @@ MenuItem myMenuItems [] = {};
184180
uint16_t NUM_MENU_ITEMS = 0;
185181
#endif
186182
183+
/////// // End dynamic Credentials ///////////
184+
```
185+
186+
Also see examples:
187+
1. [TTGO_TCALL_GSM](examples/TTGO_TCALL_GSM)
188+
2. [ESP32_GSM](examples/ESP32_GSM)
189+
3. [ESP8266_GSM](examples/ESP8266_GSM)
190+
191+
192+
## So, how it works?
193+
194+
If it detects no valid stored Credentials or it cannot connect to the Blynk server in 30 seconds, it will switch to ***Configuration Mode***. You will see your built-in LED turned ON. In `Configuration Mode`, it starts a WiFi access point called ***ESP_xxxxxx***. Connect to it using password ***MyESP_xxxxxx***.
195+
196+
You can set:
197+
198+
1. static Config Portal IP address by using `Blynk_WF.setConfigPortalIP(IPAddress(xxx, xxx, xxx, xxx))`
199+
2. random Config Portal WiFi channel by using `Blynk_WF.setConfigPortalChannel(0)`
200+
3. selected Config Portal WiFi channel by using `Blynk_WF.setConfigPortalChannel(channel)`
201+
202+
<p align="center">
203+
<img src="https://github.com/khoih-prog/BlynkGSM_Manager/blob/master/pics/Selection_1.jpg">
204+
</p>
205+
206+
After you connected, go to http://192.168.4.1., the Browser will display the following page:
207+
208+
<p align="center">
209+
<img src="https://github.com/khoih-prog/BlynkGSM_Manager/blob/master/pics/Selection_2.png">
210+
</p>
211+
212+
Enter your credentials (WiFi SSID/Password/WiFi-Token, GPRS APN/User/Pass/PIN, Blynk Server/Port/GSM-Token).
213+
214+
<p align="center">
215+
<img src="https://github.com/khoih-prog/BlynkGSM_Manager/blob/master/pics/Selection_3.png">
216+
</p>
187217

188-
/////// // End dynamic Credentials ///////////#define USE_DYNAMIC_PARAMETERS true
218+
Then click ***Save***. After the board auto-restarted, you will see if it's connected to your Blynk server successfully.
219+
220+
221+
This `Blynk.begin()` is not a blocking call, so you can use it for critical functions requiring in loop().
222+
Anyway, this is better for projects using Blynk just for GUI (graphical user interface).
223+
224+
In operation, if GSM/GPRS or Blynk connection is lost, `Blynk_WF.run()` or `Blynk_GSM.run()` will try reconnecting automatically. Therefore, `Blynk_WF.run()` `Blynk_GSM.run()` and must be called in the `loop()` function. Don't use:
225+
226+
```cpp
227+
void loop()
228+
{
229+
if (Blynk.connected())
230+
Blynk_WF.run();
231+
232+
...
233+
}
234+
```
235+
just
236+
237+
```cpp
238+
void loop()
239+
{
240+
Blynk_WF.run();
241+
...
242+
}
243+
```
244+
245+
## Example [TTGO_TCALL_GSM](examples/TTGO_TCALL_GSM)
246+
Please take a look at other examples, as well.
247+
248+
```
249+
#ifndef ESP32
250+
#error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
251+
#endif
252+
253+
#define BLYNK_PRINT Serial
254+
#define BLYNK_HEARTBEAT 60
255+
256+
// TTGO T-Call pin definitions
257+
#define MODEM_RST 5 // Pin D5 mapped to pin GPIO5/SPISS/VSPI_SS of ESP32
258+
#define MODEM_PWKEY 4 // Pin D4 mapped to pin GPIO4/ADC10/TOUCH0 of ESP32
259+
#define MODEM_POWER_ON 23 // Pin D23 mapped to pin GPIO23/VSPI_MOSI of ESP32
260+
#define MODEM_TX 27 // Pin D27 mapped to pin GPIO27/ADC17/TOUCH7 of ESP32
261+
#define MODEM_RX 26 // Pin D26 mapped to pin GPIO26/ADC19/DAC2 of ESP32
262+
#define I2C_SDA 21 // Pin D21 mapped to pin GPIO21/SDA of ESP32
263+
#define I2C_SCL 22 // Pin D22 mapped to pin GPIO22/SCL of ESP32
264+
265+
// Select your modem:
266+
#define TINY_GSM_MODEM_SIM800
267+
//#define TINY_GSM_MODEM_SIM808
268+
//#define TINY_GSM_MODEM_SIM868
269+
//#define TINY_GSM_MODEM_SIM900
270+
//#define TINY_GSM_MODEM_SIM5300
271+
//#define TINY_GSM_MODEM_SIM5320
272+
//#define TINY_GSM_MODEM_SIM5360
273+
//#define TINY_GSM_MODEM_SIM7000
274+
//#define TINY_GSM_MODEM_SIM7100
275+
//#define TINY_GSM_MODEM_SIM7500
276+
//#define TINY_GSM_MODEM_SIM7600
277+
//#define TINY_GSM_MODEM_SIM7800
278+
//#define TINY_GSM_MODEM_UBLOX
279+
//#define TINY_GSM_MODEM_SARAR4
280+
//#define TINY_GSM_MODEM_M95
281+
//#define TINY_GSM_MODEM_BG96
282+
//#define TINY_GSM_MODEM_A6
283+
//#define TINY_GSM_MODEM_A7
284+
//#define TINY_GSM_MODEM_M590
285+
//#define TINY_GSM_MODEM_MC60
286+
//#define TINY_GSM_MODEM_MC60E
287+
//#define TINY_GSM_MODEM_XBEE
288+
//#define TINY_GSM_MODEM_SEQUANS_MONARCH
289+
290+
// Increase RX buffer if needed
291+
#define TINY_GSM_RX_BUFFER 1024
292+
293+
//#define USE_BLYNK_WM false
294+
#define USE_BLYNK_WM true
295+
296+
#define USE_SPIFFS false
297+
//#define USE_SPIFFS true
298+
299+
#define EEPROM_SIZE 2048
300+
#define EEPROM_START 256
301+
302+
#include <BlynkSimpleTinyGSM_M.h>
303+
304+
#if USE_BLYNK_WM
305+
#include <BlynkSimpleEsp32_GSM_WFM.h>
306+
307+
#define USE_DYNAMIC_PARAMETERS true
189308
190309
/////////////// Start dynamic Credentials ///////////////
191310
@@ -256,12 +375,13 @@ uint16_t NUM_MENU_ITEMS = 0;
256375
//#define USE_LOCAL_SERVER false
257376
258377
#if USE_LOCAL_SERVER
259-
#define wifi_blynk_tok "****"
378+
#define wifi_blynk_tok "****"
260379
#define gsm_blynk_tok "****"
261380
//#define blynk_server "account.duckdns.org"
381+
// Usedirect IPAddress in case GPRS can't use DDNS fast enough and can't connect
262382
#define blynk_server "xxx.xxx.xxx.xxx"
263383
#else
264-
#define wifi_blynk_tok "****"
384+
#define wifi_blynk_tok "****"
265385
#define gsm_blynk_tok "****"
266386
#define blynk_server "blynk-cloud.com"
267387
#endif
@@ -278,17 +398,12 @@ uint16_t NUM_MENU_ITEMS = 0;
278398
// Set serial for debug console (to the Serial Monitor, default speed 115200)
279399
#define SerialMon Serial
280400
281-
#define RXD2 16
282-
#define TXD2 17
283-
// Use ESP32 Serial2 for GSM
284-
#define SerialAT Serial2
401+
// Use ESP32 Serial2 for GSM, Serial1 for TTGO T-Call
402+
#define SerialAT Serial1
285403
286404
// Uncomment this if you want to see all AT commands
287405
#define DUMP_AT_COMMANDS false
288406
289-
//#include <SoftwareSerial.h>
290-
//SoftwareSerial SerialAT(MODEM_RX, MODEM_TX); // RX, TX
291-
292407
#if DUMP_AT_COMMANDS
293408
#include <StreamDebugger.h>
294409
StreamDebugger debugger(SerialAT, SerialMon);
@@ -355,7 +470,7 @@ void setup()
355470
SerialMon.begin(115200);
356471
while (!SerialMon);
357472
358-
SerialMon.println(F("\nStart ESP32-WIFI-GSM"));
473+
SerialMon.println(F("\nStart TTGO-TCALL-GSM"));
359474
360475
// Set-up modem reset, enable, power pins
361476
pinMode(MODEM_PWKEY, OUTPUT);
@@ -369,17 +484,18 @@ void setup()
369484
SerialMon.println(F("Set GSM module baud rate"));
370485
371486
// Set GSM module baud rate
372-
//SerialAT.begin(115200);
373487
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
374488
delay(3000);
375489
376490
Serial.println(F("Use WiFi to connect Blynk"));
377491
378492
#if USE_BLYNK_WM
379-
// Use channel = 0 => random Config Portal WiFi channel to avoid conflict
493+
// Use configurable AP IP, instead of default IP 192.168.4.1
380494
Blynk_WF.setConfigPortalIP(IPAddress(192, 168, 100, 1));
495+
// Use channel = 0 => random Config Portal WiFi channel to avoid conflict
381496
Blynk_WF.setConfigPortalChannel(0);
382-
Blynk_WF.begin("ESP32-WiFi-GSM");
497+
// Set personalized Hostname
498+
Blynk_WF.begin("TTGO-TCALL-GSM");
383499
#else
384500
Blynk_WF.begin(wifi_blynk_tok, ssid, pass, blynk_server, BLYNK_HARDWARE_PORT);
385501
@@ -435,14 +551,13 @@ void loop()
435551
436552
#if USE_BLYNK_WM
437553
if (valid_apn)
554+
Blynk_GSM.run();
555+
#else
556+
Blynk_GSM.run();
438557
#endif
439-
{
440-
if (GSM_CONNECT_OK)
441-
Blynk_GSM.run();
442-
}
443558
444559
check_status();
445-
560+
446561
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
447562
static bool displayedCredentials = false;
448563
@@ -572,6 +687,21 @@ BGBGBGBGBGBGBGBGBGBG BGBGBGBGBGBGBGBGBGBG BGBGBGBGBGBGBGBGBGBG BGBGBGBGBGBGBGBGB
572687
1. Change Synch XMLHttpRequest to Async to avoid ["InvalidAccessError" DOMException](https://xhr.spec.whatwg.org/)
573688
2. Reduce memory usage.
574689

690+
## TO DO
691+
692+
1. Same features for other boards with GSM/GPRS shield as well as other GSM/GPRS shields (SIM7x00, etc.).
693+
694+
## DONE
695+
696+
1. Permit EEPROM size and location configurable to avoid conflict with others.
697+
2. More flexible to configure reconnection timeout.
698+
3. For fresh config data, don't need to wait for connecting timeout before entering config portal.
699+
4. If the config data not entered completely (APN, GPRS User, GPRS Pass, Server, HardwarePort and Blynk token), entering config portal
700+
5. Better Cofig Portal GUI
701+
6. WiFi Password max length is 63, according to WPA2 standard.
702+
7. Permit to input special chars such as ***%*** and ***#*** into data fields.
703+
8. Dynamic custom parameters
704+
575705
### Contributions and thanks
576706

577707
1. Thanks to [Mike Kranidis](https://community.blynk.cc/u/mikekgr) and [Mike Kranidis @ GitHub](https://github.com/mikekgr) for initial testing the library and giving reasons, advices to start this library.

0 commit comments

Comments
 (0)