Volodymyr Shymanskyy 6 years ago
parent
commit
de6173e8d8
4 changed files with 64 additions and 5 deletions
  1. +17
    -5
      README.md
  2. +6
    -0
      examples/AllFunctions/AllFunctions.ino
  3. +3
    -0
      keywords.txt
  4. +38
    -0
      src/TinyGsmClientSIM800.h

+ 17
- 5
README.md View File

@ -67,13 +67,15 @@ GPS/GNSS | ✔¹ | 🅧 | ◌¹ | 🅧 |
- SIMCom SIM800 series (SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868) - SIMCom SIM800 series (SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868)
- SIMCom SIM900 series (SIM900A, SIM900D, SIM908, SIM968) - SIMCom SIM900 series (SIM900A, SIM900D, SIM908, SIM968)
- AI-Thinker A6, A6C, A7, A20 - AI-Thinker A6, A6C, A7, A20
- U-blox SARA U201 (*alpha*)
- ESP8266 (AT commands interface, similar to GSM modems) - ESP8266 (AT commands interface, similar to GSM modems)
- Digi XBee WiFi and Cellular (using XBee command mode) - Digi XBee WiFi and Cellular (using XBee command mode)
- Neoway M590 - Neoway M590
- U-blox SARA U201 ***(alpha)***
- Quectel BG96 ***(alpha)***
### Supported boards/modules ### Supported boards/modules
- Arduino MKR GSM 1400 (*alpha*)
- Arduino MKR GSM 1400 ***(alpha)***
- RAK WisLTE ***(alpha)***
- GPRSbee - GPRSbee
- Microduino GSM - Microduino GSM
- Adafruit FONA (Mini Cellular GSM Breakout) - Adafruit FONA (Mini Cellular GSM Breakout)
@ -82,7 +84,8 @@ GPS/GNSS | ✔¹ | 🅧 | ◌¹ | 🅧 |
- ... other modules, based on supported modems - ... other modules, based on supported modems
More modems may be supported later: More modems may be supported later:
- [ ] Quectel M10, M95, UG95
- [ ] Quectel M10, M35, M95, UG95
- [ ] Sequans Monarch LTE Cat M1/NB1
- [ ] SIMCom SIM5320, SIM5360, SIM5216, SIM7xxx - [ ] SIMCom SIM5320, SIM5360, SIM5216, SIM7xxx
- [ ] Telit GL865 - [ ] Telit GL865
- [ ] ZTE MG2639 - [ ] ZTE MG2639
@ -113,6 +116,13 @@ If you have found TinyGSM to be useful in your work, research or company, please
3. Check if serial connection is working (Hardware Serial is recommended) 3. Check if serial connection is working (Hardware Serial is recommended)
Send an ```AT``` command using [this sketch](tools/AT_Debug/AT_Debug.ino) Send an ```AT``` command using [this sketch](tools/AT_Debug/AT_Debug.ino)
4. Ensure that GSM antenna is firmly attached 4. Ensure that GSM antenna is firmly attached
If you have any issues:
1. Read the whole README (you're looking at it!)
2. Try running the Diagnostics sketch
3. Check for [**highlighted topics here**](https://github.com/vshymanskyy/TinyGSM/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22for+reference%22+)
4. If you have a question, post it in [Gitter chat](https://gitter.im/tinygsm)
## How does it work? ## How does it work?
@ -133,8 +143,9 @@ Use this sketch to diagnose your SIM card and GPRS connection:
### Ensure stable data & power connection ### Ensure stable data & power connection
This actually solves stability problems in **many** cases:
- Provide a good, [stable power supply](https://github.com/vshymanskyy/TinyGSM/wiki/Powering-GSM-module) (up to 2A and specific voltage according to your module documentation)
Most modules require up to 2A and specific voltage - according to the module documentation.
So this actually solves stability problems in **many** cases:
- Provide a good stable power supply. Read about [**powering your module**](https://github.com/vshymanskyy/TinyGSM/wiki/Powering-GSM-module).
- Keep your wires as short as possible - Keep your wires as short as possible
- Consider soldering them for a stable connection - Consider soldering them for a stable connection
- Do not put your wires next to noisy signal sources (buck converters, antennas, oscillators etc.) - Do not put your wires next to noisy signal sources (buck converters, antennas, oscillators etc.)
@ -143,6 +154,7 @@ This actually solves stability problems in **many** cases:
When using ```SoftwareSerial``` (on Uno, Nano, etc), the speed **115200** may not work. When using ```SoftwareSerial``` (on Uno, Nano, etc), the speed **115200** may not work.
Try selecting **57600**, **38400**, or even lower - the one that works best for you. Try selecting **57600**, **38400**, or even lower - the one that works best for you.
In some cases **9600** is unstable, but using **38400** helps, etc.
Be sure to set correct TX/RX pins in the sketch. Please note that not every Arduino pin can serve as TX or RX pin. Be sure to set correct TX/RX pins in the sketch. Please note that not every Arduino pin can serve as TX or RX pin.
**Read more about SoftSerial options and configuration [here](https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html) and [here](https://www.arduino.cc/en/Reference/SoftwareSerial).** **Read more about SoftSerial options and configuration [here](https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html) and [here](https://www.arduino.cc/en/Reference/SoftwareSerial).**


+ 6
- 0
examples/AllFunctions/AllFunctions.ino View File

@ -126,6 +126,12 @@ void loop() {
String gsmLoc = modem.getGsmLocation(); String gsmLoc = modem.getGsmLocation();
DBG("GSM location:", gsmLoc); DBG("GSM location:", gsmLoc);
// This is only supported on SIMxxx series
String gsmTime = modem.getGSMDateTime(DATE_TIME);
DBG("GSM Time:", gsmTime);
String gsmDate = modem.getGSMDateTime(DATE_DATE);
DBG("GSM Date:", gsmDate);
String ussd_balance = modem.sendUSSD("*111#"); String ussd_balance = modem.sendUSSD("*111#");
DBG("Balance (USSD):", ussd_balance); DBG("Balance (USSD):", ussd_balance);


+ 3
- 0
keywords.txt View File

@ -24,3 +24,6 @@ factoryReset KEYWORD2
####################################### #######################################
# Literals (LITERAL1) # Literals (LITERAL1)
####################################### #######################################
DATE_FULL LITERAL1
DATE_TIME LITERAL1
DATE_DATE LITERAL1

+ 38
- 0
src/TinyGsmClientSIM800.h View File

@ -39,6 +39,11 @@ enum RegStatus {
REG_UNKNOWN = 4, REG_UNKNOWN = 4,
}; };
enum DateTime {
DATE_FULL = 0,
DATE_TIME = 1,
DATE_DATE = 2
};
class TinyGsmSim800 class TinyGsmSim800
{ {
@ -307,6 +312,13 @@ public:
if (!testAT()) { if (!testAT()) {
return false; return false;
} }
//Enable Local Time Stamp for getting network time
sendAT(GF("+CLTS=1"));
if (waitResponse(10000L) != 1) {
return false;
}
sendAT(GF("&W"));
waitResponse();
sendAT(GF("+CFUN=0")); sendAT(GF("+CFUN=0"));
if (waitResponse(10000L) != 1) { if (waitResponse(10000L) != 1) {
return false; return false;
@ -719,6 +731,32 @@ public:
return res; return res;
} }
/*
* Time functions
*/
String getGSMDateTime(DateTime format) {
sendAT(GF("+CCLK?"));
if (waitResponse(2000L, GF(GSM_NL "+CCLK: \"")) != 1) {
return "";
}
String res;
switch(format) {
case DATE_FULL:
res = stream.readStringUntil('"');
break;
case DATE_TIME:
streamSkipUntil(',');
res = stream.readStringUntil('"');
break;
case DATE_DATE:
res = stream.readStringUntil(',');
break;
}
return res;
}
/* /*
* Battery functions * Battery functions
*/ */


Loading…
Cancel
Save