How to Interface SIM900A with Arduino and make Calls

In this tutorial, we are going to learn how to interface the SIM900A module with Arduino and also build a call alert system. This circuit will call to a specified number if the button is pressed, so we can use any sensors/triggers instead of the button.

The SIM900A mini-module is a compact GSM/GPRS module that allows for wireless communication over the cellular network. It is designed to be easily integrated into a variety of projects and can be used for a range of applications, including remote monitoring and control, GPS tracking, and SMS messaging.

Some of the key features of the SIM900A mini module include:

  • Quad-band 850/900/1800/1900 MHz GSM/GPRS support
  • SIM card socket
  • Embedded TCP/UDP stack
  • FTP/HTTP/SMTP/POP3 email support
  • Voice and SMS support

It’s important to note that the SIM900A mini-module requires a SIM card with an active cellular plan to function, and you will need to ensure that the module is compatible with the frequencies used by your local cellular network.

Circuit Diagram

  • First, connect the SIM900A module to your Arduino using a serial connection (RX and TX pins). Make sure to also connect the power and ground pins appropriately.
  • Insert a SIM card with an active cellular plan into the SIM900A module.

Arduino code

#include <SoftwareSerial.h>    //Create software serial object to communicate with SIM800L
SoftwareSerial GSM(11, 10); //SIM800L Tx & Rx is connected to Arduino #8 & #9

char phone_no[] = "+91XXXXXXXXXX"; //change with phone number to sms

#define bt_C  A1 

void setup() { 

  Serial.begin(9600);//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  GSM.begin(9600);   //Begin serial communication with Arduino and SIM800L

  pinMode(bt_C, INPUT_PULLUP); // declare bt_C as input


  Serial.println("Initializing....");
  initModule("AT", "OK", 1000);              //Once the handshake test is successful, it will back to OK

}

void loop() {

  if (digitalRead (bt_C) == 0)
  {
    callUp(phone_no);
  }

  delay(5);
}


void callUp(char *number) {
  GSM.print("ATD + "); GSM.print(number); GSM.println(";"); //Call to the specific number, ends with semi-colon,replace X with mobile number
  delay(20000);       // wait for 20 seconds...
  GSM.println("ATH"); //hang up
  delay(100);
}


void initModule(String cmd, char *res, int t) {
  while (1) {
    Serial.println(cmd);
    GSM.println(cmd);
    delay(100);
    while (GSM.available() > 0) {
      if (GSM.find(res)) {
        Serial.println(res);
        delay(t);
        return;
      } else {
        Serial.println("Error");
      }
    }
    delay(t);
  }
}

  • In your Arduino code, initialize the serial connection to the SIM900A module and send the necessary AT commands to dial a phone number.
  • To dial a phone number, send the AT command “ATD” followed by the phone number you wish to call (including the country and area codes). For example, to call the number “+1-123-456-7890”, you would send the command “ATD+11234567890;”. Note that the semicolon at the end is important to indicate the end of the command.
  • The SIM900A module should respond with the message “OK” if the call is successfully initiated.

Leave a comment