Skip to content

A small Arduino library for GSM modules, that just works. Supported modules: SIMCom SIM800, SIM900, A6, A7, A20, M590, U201, XBee, ESP8266-AT

License

Notifications You must be signed in to change notification settings

replicadeltd/TinyGSM

 
 

Repository files navigation

TinyGSM logo

A small Arduino library for GSM modules, that just works.

GitHub version Build status GitHub issues GitHub wiki GitHub stars License

If you like TinyGSM - give it a star, or fork it and contribute! GitHub stars GitHub forks

You can also join our chat: Gitter

Arduino Client interface support

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.

examples

TinyGSM is tiny

The complete WebClient example for Arduino Uno (via Software Serial) takes little resources:

Sketch uses 15022 bytes (46%) of program storage space. Maximum is 32256 bytes.
Global variables use 574 bytes (28%) of dynamic memory, leaving 1474 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.

Features

Feature \ Modem SIM8xx U201 A6/A7/A20 M590 ESP8266 XBee Quectel M95
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.)

Supported modems

  • SIMCom SIM800 series (SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868)
  • SIMCom SIM900 series (SIM900A, SIM900D, SIM908, SIM968)
  • AI-Thinker A6, A6C, A7, A20
  • U-blox SARA U201 (alpha)
  • ESP8266 (AT commands interface, similar to GSM modems)
  • Digi XBee WiFi and Cellular (using XBee command mode)
  • Neoway M590
  • Quectel M95

Supported boards/modules

  • Arduino MKR GSM 1400 (alpha)
  • GPRSbee
  • Microduino GSM
  • Adafruit FONA (Mini Cellular GSM Breakout)
  • Adafruit FONA 800/808 Shield
  • Industruino GSM
  • ... other modules, based on supported modems

More modems may be supported later:

  • Quectel M10, UG95
  • SIMCom SIM5320, SIM5360, SIM5216, SIM7xxx
  • Telit GL865
  • ZTE MG2639
  • Hi-Link HLK-RM04

Watch this repo for new updates! And of course, contributions are welcome ;)

Donation

Donate BountySource Donate Bitcoin

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:

  • Covering cellular network expences
  • Buying new hardware and modems for integration
  • Bounty Budget (to reward other developers for their contributions)
  • Implementing new features
  • Quality Assurance

Getting Started

  1. Using your phone: - Disable PIN code on the SIM card - Check your balance - Check that APN,User,Pass are correct and you have internet
  2. Ensure the SIM card is correctly inserted into the module
  3. Check if serial connection is working (Hardware Serial is recommended)
    Send an AT command using this sketch
  4. Ensure that GSM antenna is firmly attached

How does it work?

Many 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.

API Reference

For GPRS data streams, this library provides the standard Arduino Client interface.
For additional functions, please refer to this example sketch

Troubleshooting

Diagnostics sketch

Use this sketch to diagnose your SIM card and GPRS connection:
File -> Examples -> TynyGSM -> tools -> Diagnostics

Ensure stable data & power connection

This actually solves stability problems in many cases:

  • Provide a good, stable power supply (up to 2A and specific voltage according to your module documentation)
  • Keep your wires as short as possible
  • Consider soldering them for a stable connection
  • Do not put your wires next to noisy signal sources (buck converters, antennas, oscillators etc.)

SoftwareSerial problems

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.

ESP32 HardwareSerial

When using ESP32 HardwareSerial, you may need to specify additional parameters to the .begin() call. Please refer to this comment.

SAMD21

When using SAMD21-based boards, you may need to use a sercom uart port instead of Serial1. Please refer to this comment.

Broken initial configuration

Sometimes (especially if you played with AT comands), your module configuration may become invalid.
This may result in problems such as:

  • Can't connect to the GPRS network
  • Can't connect to the server
  • Sent/recieved data contains invalid bytes
  • etc.

To return module to Factory Defaults, use this sketch:
File -> Examples -> TynyGSM -> tools -> FactoryReset

Goouuu Tech IOT-GA6 vs AI-Thinker A6 confusion

It turns out that Goouuu Tech IOT-GA6 is not the same as AI-Thinker A6. Unfortunately IOT-GA6 is not supported out of the box yet. There are some hints that IOT-GA6 firmware may be updated to match A6... But no one confirmed that up to my knowledge.


License

This project is released under The GNU Lesser General Public License (LGPL-3.0)

About

A small Arduino library for GSM modules, that just works. Supported modules: SIMCom SIM800, SIM900, A6, A7, A20, M590, U201, XBee, ESP8266-AT

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 98.4%
  • C 1.5%
  • Makefile 0.1%