A small Arduino library for GSM modules, that just works.
If you like TinyGSM - give it a star, or fork it and contribute!
This library is easy to integrate with lots of sketches, which use Ethernet or WiFi.
PubSubClient (MQTT), Blynk, HTTP Client and File Download examples are provided.
The complete WebClient example for Arduino Uno (via Software Serial) takes little resources:
Sketch uses 14094 bytes (43%) of program storage space. Maximum is 32256 bytes.
Global variables use 625 bytes (30%) of dynamic memory, leaving 1423 bytes for local variables. Maximum is 2048 bytes.
Arduino GSM library uses 15868 bytes (49%) of Flash and 1113 bytes (54%) of RAM in a similar scenario.
TinyGSM also pulls data gently from the modem (whenever possible), so it can operate on very little RAM.
Now, you have more space for your experiments.
Feature \ Modem | SIM8xx | U201 | A6/A7/A20 | M590 | ESP8266 | XBee |
---|---|---|---|---|---|---|
Data connections | ||||||
TCP (HTTP, MQTT, Blynk, ...) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
UDP | ◌ | ◌ | ◌ | |||
SSL/TLS (HTTPS) | ✔¹ | ✔ | 🅧 | 🅧 | ✔¹ | ✔¹ |
USSD | ||||||
Sending USSD requests | ✔ | ✔ | ✔ | 🅧 | ||
Decoding 7,8,16-bit response | ✔ | ✔ | ✔ | 🅧 | ||
SMS | ||||||
Sending | ✔ | ✔ | ✔ | 🅧 | ✔ | |
Sending Unicode | ✔ | ◌ | 🅧 | 🅧 | ||
Reading | 🅧 | |||||
Incoming message event | ? | 🅧 | ||||
Calls | ||||||
Dial, hangup | ✔ | ✔ | 🅧 | 🅧 | 🅧 | |
Receiving calls | ✔ | ✔ | 🅧 | 🅧 | 🅧 | |
Incoming event (RING) | ◌ | ◌ | 🅧 | 🅧 | 🅧 | |
DTMF sending | ✔ | ✔ | 🅧 | 🅧 | 🅧 | |
DTMF decoding | ◌ | 🅧 | 🅧 | 🅧 | 🅧 | |
Location | ||||||
GSM location service | ✔ | ✔ | 🅧 | 🅧 | 🅧 | ✔ |
GPS/GNSS | ✔¹ | 🅧 | ◌¹ | 🅧 | 🅧 | 🅧 |
✔ - implemented ◌ - planned 🅧 - not available on this modem
¹ - only some device models or firmware revisions have this feature (SIM8xx R14.18, A7, etc.)
More modems may be supported later:
Watch this repo for new updates! And of course, contributions are welcome ;)
If you have found TinyGSM to be useful in your work, research or company, please consider making a donation to the project commensurate with your resources. Any amount helps!
All donations will be used strictly to fund the development of TinyGSM:
AT
command using this sketchMany GSM modems, WiFi and radio modules can be controlled by sending AT commands over Serial.
TinyGSM knows which commands to send, and how to handle AT responses, and wraps that into standard Arduino Client interface.
For GPRS data streams, this library provides the standard Arduino Client interface.
For additional functions, please refer to this example sketch
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.
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 and here.
When using ESP32 HardwareSerial
, you may need to specify additional parameters to the .begin()
call.
Please refer to this comment.
Use this sketch to diagnose your SIM card and GPRS connection:
File -> Examples -> TynyGSM -> tools -> Diagnostics
Sometimes (especially if you played with AT comands), your module configuration may become invalid.
This may result in problems such as:
To return module to Factory Defaults, use this sketch:
File -> Examples -> TynyGSM -> tools -> FactoryReset
This project is released under The GNU Lesser General Public License (LGPL-3.0)