Hey guys, its Nick again, welcome to educ8s.tv.

In today’s video/tutorial, we will be looking at the SIM900 chip based Arduino GSM Shield from Tinysine. We will be taking a look at how easy it is to send and receive SMS messages using the shield.

This GPRS/GSM Shield provides us with an easy way to use the GSM cell phone network in our projects to send or receive data from a remote location. The shield allows us to achieve this using any of the following methods:

  • Short Message Service
  • Audio (call)
  • GPRS Service

Some of the features of this shield include;

  1. Based on SIMCom‘s SIM900 Module
  2. Quad-Band 850 / 900/ 1800 / 1900 MHz – would work on GSM networks in all countries across the world.
  3. Control via AT commands – Standard Commands: GSM 07.07 & 07.05 | Enhanced Commands: SIMCOM AT Commands.
  4. Short Message Service – so that you can send small amounts of data over the network (ASCII or raw hexadecimal).
  5. Embedded TCP/UDP stack – allows you to upload data to a web server.
  6. Speaker and Headphone jacks – so that you can send DTMF signals or play recording like an answering machine.
  7. SIM Card holder and GSM Antenna – present onboard.
  8. 12 GPIOs, 2 PWMs and an ADC (all 2.8 volt logic) – to augment your Arduino.
  9. Low power consumption – 1.5mA(sleep mode)
  10. Industrial Temperature Range – -40°C to +85 °C

The shield is compatible with all boards based on the Arduino Uno form factor with matching pinouts.

Today, we will be demonstrating how to use this shield to give your project the ability to send and receive SMS messages as well as making and receiving phone calls. We also have the option of connecting our projects to the Internet using the GPRS network, but we will take a look at this during another video.

Required Components and Where to Buy

The following components/parts are required to build this project and they can be bought by clicking on the link in front of them.

1. Arduino Uno ▶ https://educ8s.tv/part/ArduinoUno

2.GSM Shield ▶ https://educ8s.tv/part/GSMShield

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!

[adsense]

Schematics

One of the benefits of using this particular GSM module is that it comes as a shield and is connected to the microcontroller by plugging it directly into it as shown in the image below. With this done and a sim card inserted into the module, we can proceed to write the code for this project.

Connecting the GSM Shield to the Arduino

 

Code

For this project, the goal is to show you how easy it is to send and receive SMS messages with the Arduino. To communicate easily with the GSM module in the code, we will be using the GSM shield library from tinyosshop. The library helps us to send and receive messages easily with an example to guide. It should be noted that this library has been tested for this shield only and I am thus not sure if it works with other GSM shields or not. The library can be downloaded by clicking on the download link below.

LIBRARIES

Arduino Tone Library: http://www.tinyosshop.com/datasheet/GSM_GPRS_GPS_Shield_GSMSHIELD.rar

With the library downloaded and installed, we are ready to write the code.

The first thing we do is include all the libraries that will be used for this project.

//////////////////////////////////////////////
  //        Arduino GSM SHIELD SMS            //
 //              Tutorial by                 //
//           https://educ8s.tv           //
/////////////////////////////////////////////


#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"

Next, we create an object SMS of the smsgsm library and declare some of the variables which will be used in the project as things proceed.

SMSGSM sms;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

char sms_position;
char phone_number[20];
char sms_text[100];
int i;

 

With this done we move to the void setup function.

As soon as the device starts up, it should try to connect to the GSM network and also display the status of that attempt whether successful or not.

void setup()
{
    Serial.begin(9600);
    
    if (gsm.begin(9600)) 
    {
        Serial.println("\nstatus=READY");
        started=true;
    } 
    else 
        Serial.println("\nstatus=IDLE");

 

The next important part of the code under the void setup function is the line of code that takes in the mobile number of the line to which SMS messages/notifications should be sent. There is a need to add the country code in front of the number with the “+” sign.

if(started) 
    {
        if (sms.SendSMS("+300000000000", "Arduino SMS"))
        {
          Serial.println("\nSMS sent OK.");
        }
        else
        {
          Serial.println("\nError sending SMS.");
        }      
    }

The void loop follows, and it basically just reads all new SMS messages and display it on the serial monitor along with the phone number of the sender.

void loop()
{
    if(started) 
    {
        sms_position=sms.IsSMSPresent(SMS_UNREAD);
        if (sms_position) 
        {
            Serial.print("SMS postion:");
            Serial.println(sms_position,DEC);
            sms.GetSMS(sms_position, phone_number, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }      
        delay(2000);
    }
}

Upload this code to your Arduino board and you should now be able to send messages from your phone to the Arduino and from the Arduino to the phone using the serial monitor as shown in the image below.

Demo

The complete code for this project can be downloaded from the link below.

——————–

CODE OF THE PROJECT
——————–

 

 

 

That’s it for today’s tutorial guys, thanks for reading/watching. If you get stuck at any point while building this project, feel free to reach out to me via the comment section, I will be glad to answer whatever questions you might have. Don’t forget to share, like and subscribe on youtube. Thanks!

SUBSCRIBE ON YOUTUBE

——————–

Never miss a video: Subscribe to educ8s.tv