One of the essential elements of building IoT project is the ability to connect devices. Wi-Fi and Bluetooth are good low cost choices, but they work only at close ranges, or in hotspot areas. When the device needs to be at a remote location GSM is a good and easy to setup option.
In this Instructable, I will show you how easy it is to send and receive SMS messages over GSM with Arduino.
In the following Instructables, I will also show you how you can connect over GSM to Internet and access servers, and how you can handle voice calls.
To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/ .
Make sure that you install 1.6.7 higher, otherwise this Instructable will not work!
The Visuino: https://www.visuino.com also needs to be installed.
The GSM Shield is configured by default for 19200 serial port speed. We need to configure Serial Port 1 for this speed:
We need to add component to control the GSM Module. The Module is controlled through the Serial channel, so we need to connect it. Digital Pin 9 is used to power On/Off the Module:
It takes some time for the GMS Module to initialize. It is nice if we have some indication that the module is ready. For this we will send "GSM Ready" text to the Serial port when the module is ready:
The GSM component consists of many modules performing different tasks. Since we will use only SMS we need to add only "Short Message" module, and then add one "Send SMS" function to it:
The Serial port receives one character at a time. To send an SMS messages, we need to get all the characters from a line, create a Text out of it, and send it to the GSM Module:
We need to make sure that we send the SMS after the text has been properly updated. We can use a Delay component with short delay for that:
Congratulations! You have completed the project.
Picture 1 shows the connected and powered up project.
On Picture 2 you can see the complete Visuino diagram.
If you connect with Serial Terminal to the Arduino, after about 30 seconds you will see the "GSM Ready" message appear (Picture 3)
Once the message appears, if you Type some text, and click "Send" (Picture 4), the text will be sent as SMS message.
If you have selected as phone number on Step 8 to the phone of the SIM card on the Shield, after a while you will receive the message, and it will be shown on the Serial Terminal (Picture 5)
If you have set the number of a different device on Step 8, the messages will be sent to that device.
You can send SMS messages to the phone number from other phones and devices, and they also will be shown in the serial terminal.
Also attached is the Visuino project, that I created for this Instructable. You can download and open it in Visuino: https://www.visuino.com