Using the SIM800 Dev Board with Gizduino V – Part 1

March 25, 2016

Articles, Projects

The SIM800 GSM/GPRS Dev module is a full featured GSM/GPRS module packed with more features as compared to the SIM900. This module have inbuilt Bluetooth stack compliant with 3.0+EDR, MMS, FTP, TCP/IP, email and Micro SD support in addition to the standard features of the SIM900. The good thing about this module is that AT commands from the older dev board based on the SIM900 is compatible with this new module. Upgrading is easy, just plug and play. This particular Dev Module from E-Gizmo Mechatronix Central has on board reliable LDO regulator that allows a wide range of power supply voltage without tripping the SIM800 module, on board buffered LED status indicators, onboard micro SD card socket, SMA RF connector and unpopulated header pads for easy access to all pin functions of the SIM800.

SIM800 GSM/GPRS Dev Module

SIM800 GSM/GPRS Dev Module

First we will be using the SIM800 to send a message when a button is pressed and turn on/off a LED using SMS. In this setup we will be using the Gizduino V (ATMega 328 Based Arduino Compatible Module), LED’S and push button switches and Arduino 1.6.8 IDE. We will not be using any other external libraries aside from the SoftwareSerial library. The Hardware serial of the Gizduino V is used for debugging and programming. The figure below shows the test setup wiring.

Setup

Wiring Diagram of the Setup (Click to Enlarge)

First, we initialize some variables for for storing messages, storing receivers number where our SMS will be sent, also we include the SoftwareSerial library. In addition a macro is added to enable or disable debug messages to the Hardware Serial. Most of the functions are based on the SIM900 routines from Cooking Hacks.

SMS_1

Next we setup all the necessary GPIO pins where LED’s and switches are connected, initialize the hardware serial, software serial used to communicate with the modem, and call the initialization routine for the SIM800.

SMS_2

Before we go through the other functions, we take a look on how we send the AT Command to the modem using this code:

SMS_1

Since we communicate with the modem using AT Command, we make use of the above code to send the command, and wait for its response. It is important to know the response so that we could track the errors.

To initialize the SIM800, we first connect to the network, then delete all message and we set the modem to text mode. As compared to the SIM900, we need to power on the SIM900 on its PWON pin before we start the communication, the firmware of this SIM800 has auto power on as soon as the input power is connected.

SMS_4

To send an SMS, we issue the AT+CMGS command to the modem

SMS_5

For us to use SMS to turn on or off devices, we need a routine to receive SMS, as compared to sending SMS, when a message is received, we use several routines to handle the message so that we could extract the information that we want. The modem will issue a +CMTI when a new message is received in the following format +CMTI: “SM”,11 where 11 is the location of the message in the memory. We are interested with the location of the message in the memory,  because we will need the location when we issue the AT+CMGR command to read the new message.

SMS_7

When we get the location of the message, we issue the AT+CMGR command to the modem

SMS_8

To handle the new message from the previous command, we use the following code

SMS_9

Additionally, we need the functions below so that we always process a complete message from the modemSMS_10

And a function to wait for new messages, we use the function below inside the loop to continuously check for new messages.

SMS_11

Finally, we process the data inside the loop, to turn on or off devices, we compare the contents of the message buffer to a pre-defined keyword.

SMS_12_a

To send a message when a button is pressed, we check the state of the button and use the SendSMS function to send a message to a predefined number.

SMS_12_b

That’s it! Happy Coding! See you on the next part.

 

, , , , , , , , ,

No comments yet.

Leave a Reply