Interfacing GSM Module with Arduino


SIM900A is a GSM module used to connect devices like Arduino to the mobile network, similar to how your smartphone does. This allows the device to access features such as SMS and mobile network through GPRS. In this guide, we will be primarily be focusing on how you can interface SIM900A to give your microcontroller the capability to send SMS messages

interfacing gsm module with arduino

How to use SIM900A?

SIM900A will typically be available in modules with breakout pins for easy interfacing along with connectors for SIM cards, antennas and a few more extra features. For this guide, we will be using the AE GSM SIM900A module.


 It has features such as direct

  • UART pinout
  • SPI pinout
  • RS232 connector, for connecting the module to PC
  • Support for external antenna (comes with one antenna)
  • SIM slot to add in SIM card
  • 12V external DC power jack
Interfacing GSM Module with Arduino

Components Required

Connection setup

1. First, we will need to insert the SIM card onto the SIM card tray on the GSM module and lock it
2. Connect the external antenna to the module, if not done already
3. Make the following connections between your Arduino and the GSM module

Arduino Uno GSM Module
D9  Tx
D10 Rx



Note: We won’t be connecting VCC from the GSM module to the Arduino since the GSM module will be directly powered by the 12V supply we plug into the barrel jack. But we will connect GNDs to make the ground plane common between the two devices.


4. Once the connections are done, you can power on the GSM module by plugging in your external 12V DC Jack
5. The onboard Network LED will initially blink rapidly. After a few minutes, the blinking should slow down to a steady pace. This means the GSM module has successfully been registered on the mobile network and is ready to be used

Code to Send and Receive SMS with Arduino

#include <SoftwareSerial.h>

SoftwareSerial Sim(9, 10);


void setup()


  Sim.begin(9600);                            // Setting the baud rate of Sim Module  

  Serial.begin(9600);                         // Setting the baud rate of Serial Monitor (Arduino)




void loop()


  if (Serial.available()>0)

   switch(                      // Read data given in Serial Monitor


    case 's':                                 // If data is 's', goto SendMessage() function



    case 'r':                                 // If data is 'r', goto ReceiveMessage() function





 if (Sim.available()>0)

   Serial.write(;                  // If SIM module sends messages, print it to Serial monitor



 void SendMessage()


  Sim.println("AT+CMGF=1");                    // Sets the Sim Module in send SMS mode

  delay(1000);                                 // Delay of 1 second

  Sim.println("AT+CMGS=\"+91xxxxxxxxxx\"\r");  // Replace x with mobile number

  delay(1000);                                 // Delay of 1 second

  Sim.println("I am SMS from Sim Module");     // Type in the SMS text you want to send

  delay(100);                                  // Delay of 0.1 second

  Sim.println((char)26);                       // ASCII code of CTRL+Z (to exit out)

  delay(1000);                                 // Delay of 1 second



 void ReceiveMessage()


  Sim.println("AT+CNMI=2,2,0,0,0");            // AT Command to receive a live SMS

  delay(1000);                                 // Delay of 1 second




To upload the code to your Arduino, follow the steps below

  • Open Arduino IDE
  • Copy paste the same code into your IDE
  • Change the phone number and the message you would like to send to the required values
  • Connect your Arduino to your PC
  • Select the Board as “Arduino Uno” under Tools
  • Select the correct COM port under Tools
  • Click on upload
  • After uploading is done, open the Serial Monitor and set baud rate to 9600

The above sketch we have uploaded has a feature to both send and receive SMS. To send SMS, send the character ‘s’ in ther Serial Monitor. The Arduino will programmatically send a text SMS with the message and the phone number you have provided. Note, this may take a few seconds depending on the range and network connectivity


To receive SMSs, you can set the GSM module to listen for SMS by sending the character ‘r’. The GSM module will be set to listen mode and check for any SMSs every 1 second. If the SMS arrives, the GSM module will print the contents of the message to the Serial Monitor


The GSM module can add an extra superpower for your Arduino and other microcontroller projects by giving it access to the extensive mobile network. These modules can be added to controllers to enable IoT like functions in areas without reliable access to a network or internet, by programmatically sending in updates and commands through SMS functions.


For example, the Arduino can be programmed to turn on an irrigation pump if it receives a message to do so through the GSM module, giving you the ability to control your irrigation fields through your phone from anywhere in the world. It can also be programmed to send in periodic updates via SMS of various environmental parameters, allowing you to better manage the entire system


Frequently Asked Questions

1. How can I receive SMS using GSM module with Arduino?

You can receive SMS by setting the GSM module to a specific state using this AT command below


The AT command can also be given to the module programmatically as per our example above

2. Which GSM module is better for Arduino?

Ans: All the most common GSM modules work with Arduino without any issues. The differentiating factor between each type of module are the feature sets they each offer.

Leave a comment

Please note, comments must be approved before they are published