SIM900 GSM/GPRS Shield · Astro Tech Blog

SIM900 GSM/GPRS Shield

The SIM900 is a quad-band GSM/GPRS module from SIMCom that enables Arduino projects to make phone calls, send and receive SMS messages, and connect to the internet over GPRS. It communicates via serial AT commands and operates on 850/900/1800/1900 MHz bands, providing worldwide cellular connectivity. The shield form factor stacks directly on an Arduino Uno or Mega, and an external power supply is recommended due to the module’s peak current draw of up to 2 A during transmission.

Database schema showing relationships

For this interfacing you need the following components:

  • Arduino board (Uno, Mega — shield fits directly)
  • SIM900 GSM/GPRS shield
  • Active micro-SIM card with a valid GSM plan (data + SMS)
  • External 5V / 2A DC power supply (barrel jack)
  • USB cable to connect Arduino to your computer
  • Antenna (included with the shield)
  • (Optional) Headset with microphone for voice calls

Schematic

The SIM900 shield is designed to stack directly onto an Arduino Uno or Mega. Connect the shield as follows:

SIM900 Shield          Arduino Uno (stacked via headers)
-------------          --------------------------------
All pins               Matching header pins (D0–D13, A0–A5, 5V, GND)

External PSU (+)  -->  Shield barrel jack (7–12V DC in / Vin)
External PSU (-)  -->  GND (common)

Jumpers on the shield select the serial communication mode:

  • Hardware Serial (D0/D1): Default. Uses the same UART as the USB port. You must disconnect the RX/TX jumpers when uploading code.
  • Software Serial (D2/D3): Move jumpers to D2 (RX) and D3 (TX) to use a software serial port, leaving the USB port free for debugging.

This tutorial assumes Software Serial on pins D2 (RX from Arduino) and D3 (TX from Arduino). Note that SIM900 shield RX connects to Arduino TX and vice versa.

Jumper configuration

JumperPositionSetting
Serial SelectD2/D3Software Serial on pins 2 (RX) and 3 (TX)
Power SelectVCC5V from Arduino (with external PSU on barrel jack)

Pin Map

Shield PinNameConnected To
Digital 2 (RX)SIM900 TXArduino TX (shield output)
Digital 3 (TX)SIM900 RXArduino RX (shield input)
5VPowerArduino 5V rail
GNDGroundArduino GND
Vin / barrel jackExternal power7–12V DC / 2A PSU

The shield also breaks out additional SIM900 pins:

  • RST: Hardware reset (active LOW)
  • PWRKEY: Power key (active LOW for 1 s to power on/off)
  • NETLIGHT: Network status LED indicator

Install necessary Library

No external library is required for basic operation. The SIM900 communicates via standard AT commands over serial.

For convenience, install the SIM900 library by Seeed Studio or GSM library by Arduino via the Library Manager (Tools > Manage Libraries). This tutorial uses direct AT commands for full control.

Code with complete explanation

This sketch demonstrates initializing the SIM900 module, registering to the GSM network, sending an SMS, making a voice call, and reading incoming SMS messages.

#include <SoftwareSerial.h>

SoftwareSerial sim900(2, 3); // RX, TX (Arduino pins connected to SIM900)

void setup()
{
  Serial.begin(9600);
  sim900.begin(19200); // SIM900 default baud rate

  Serial.println("SIM900 GSM/GPRS Shield Test");
  delay(3000);

  // Send AT to check communication
  sim900.println("AT");
  waitForResponse("OK");

  // Check signal quality
  sim900.println("AT+CSQ");
  waitForResponse("OK");

  // Check network registration
  sim900.println("AT+CREG?");
  waitForResponse("OK");

  // Set SMS text mode
  sim900.println("AT+CMGF=1");
  waitForResponse("OK");

  Serial.println("Module ready. Commands:");
  Serial.println("Send 'S' to send an SMS");
  Serial.println("Send 'C' to make a call");
  Serial.println("Send 'H' to hang up");
  Serial.println("Send 'R' to read unread SMS");
  Serial.println();
}

void loop()
{
  // Forward SIM900 responses to Serial Monitor
  if (sim900.available())
  {
    Serial.write(sim900.read());
  }

  // Handle serial commands
  if (Serial.available())
  {
    char cmd = Serial.read();

    switch (cmd)
    {
      case 'S':
        sendSMS();
        break;

      case 'C':
        makeCall();
        break;

      case 'H':
        hangUp();
        break;

      case 'R':
        readSMS();
        break;
    }
  }
}

// Send an SMS
void sendSMS()
{
  Serial.println("Sending SMS...");

  // Set recipient phone number (change to your number)
  sim900.print("AT+CMGS=\"+1234567890\"\r");
  delay(1000);

  // Message content
  sim900.print("Hello from Arduino SIM900 shield!");
  delay(500);

  // Send Ctrl+Z (0x1A) to transmit
  sim900.write(0x1A);
  delay(5000);

  waitForResponse("OK");
}

// Make a voice call
void makeCall()
{
  Serial.println("Making call...");
  sim900.println("ATD+1234567890;"); // Semicolon = voice call
  delay(30000); // Ring for 30 seconds
  hangUp();
}

// Hang up the current call
void hangUp()
{
  Serial.println("Hanging up...");
  sim900.println("ATH");
  delay(1000);
}

// Read unread SMS messages
void readSMS()
{
  sim900.println("AT+CMGL=\"REC UNREAD\",1");
  delay(2000);
  waitForResponse("OK");
}

// Helper: wait for a response string from the module
void waitForResponse(const char *expected)
{
  unsigned long timeout = millis() + 5000;
  String response = "";

  while (millis() < timeout)
  {
    if (sim900.available())
    {
      char c = sim900.read();
      response += c;
      Serial.write(c);
    }
  }

  if (response.indexOf(expected) != -1)
  {
    Serial.println(" [OK]");
  }
  else
  {
    Serial.println(" [TIMEOUT]");
  }
}

Code breakdown

  • SoftwareSerial sim900(2, 3) — creates a software serial port on pins 2 (RX) and 3 (TX). The SIM900 shield is configured to use D2/D3 via its serial jumpers.
  • sim900.begin(19200) — sets the baud rate. The SIM900 defaults to 19200 baud (some modules use 9600 or 115200 — check your module).
  • sim900.println("AT") — the basic attention command. The module should respond with OK if communication is working.
  • AT+CSQ — queries signal quality. Returns +CSQ: <rssi>,<ber> where RSSI is 0–31 (higher = better).
  • AT+CREG? — checks network registration. Returns +CREG: <n>,<stat> where stat = 1 (registered, home network) or 5 (registered, roaming).
  • AT+CMGF=1 — sets SMS mode to text mode (instead of PDU mode).
  • AT+CMGS="<number>" — sends an SMS. Followed by the message body and terminated with Ctrl+Z (0x1A).
  • ATD<number>; — dials a voice call. The semicolon specifies voice call (without it, the module tries data mode).
  • ATH — hangs up the current call.
  • AT+CMGL="REC UNREAD",1 — lists all unread SMS messages in text mode.

Network status LED

The SIM900 shield has a network status LED (NETLIGHT) that indicates the current state:

LED PatternMeaning
OffModule not powered
64 ms on / 800 ms offNot registered / searching
64 ms on / 3000 ms offRegistered (home network)
64 ms on / 300 ms offGPRS data transfer active

GPRS internet connection

To connect to the internet via GPRS:

void setupGPRS()
{
  // Set APN (change to your provider's APN)
  sim900.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
  waitForResponse("OK");

  sim900.println("AT+SAPBR=3,1,\"APN\",\"your.apn\"");
  waitForResponse("OK");

  // Open bearer
  sim900.println("AT+SAPBR=1,1");
  waitForResponse("OK");

  // Get IP address
  sim900.println("AT+SAPBR=2,1");
  waitForResponse("OK");
}

Steps to perform this interfacing

  1. Insert the micro-SIM card into the shield’s SIM card holder (ensure the gold contacts face inward and the card is locked in place).
  2. Screw the antenna onto the SMA connector on the shield.
  3. Configure the serial jumpers on the shield for Software Serial (D2/D3).
  4. Stack the shield onto the Arduino Uno.
  5. Connect the external 5V / 2A power supply to the shield’s barrel jack. Do not rely on USB power alone — the SIM900 can draw up to 2 A during GSM bursts, which exceeds USB power limits.
  6. Connect the Arduino to your computer via USB.
  7. Upload the sketch. If using Software Serial, you can leave the USB connected during upload.
  8. Open the Serial Monitor (Tools > Serial Monitor, set baud rate to 9600).
  9. Press the PWRKEY button on the shield for 1–2 seconds to power on the SIM900. The NETLIGHT should start blinking.
  10. Wait 10–60 seconds for network registration. When the NETLIGHT blinks slowly (3 s interval), the module is registered.
  11. Test commands via the Serial Monitor: S to send SMS, C to call, R to read unread messages.

Power-on sequence

The SIM900 can be powered on by either:

  • Pressing the PWRKEY button for 1–2 seconds
  • Driving the PWRKEY pin LOW for 1 second via an Arduino pin
const int pwrkeyPin = 9;

void powerOnSIM900()
{
  pinMode(pwrkeyPin, OUTPUT);
  digitalWrite(pwrkeyPin, LOW);
  delay(1500);
  digitalWrite(pwrkeyPin, HIGH);
}

Caution

  • Power supply: The SIM900 draws peak currents of up to 2 A during GSM burst transmission (every 4.6 ms when transmitting). This far exceeds the USB 500 mA limit and the Arduino onboard 5V regulator’s 800 mA limit. Always use an external 5V / 2A (or higher) power supply connected to the shield’s barrel jack. Without adequate power, the module will reset or fail to register on the network.
  • Antenna required: The SIM900 must have an antenna connected at all times when powered. Operating without an antenna can damage the RF power amplifier.
  • SIM card: Use an active micro-SIM card with a valid GSM plan. The SIM900 does NOT support 3G, 4G, or LTE — it is 2G only. In many countries, 2G networks are being phased out. Check that 2G (GSM 850/900/1800/1900) is still active in your area. For 3G/4G projects, use a SIM800, SIM5320, or SIM76xx module instead.
  • Serial conflicts: The SIM900 shield uses the Arduino’s hardware UART by default (D0/D1). When using hardware serial, you must disconnect the RX and TX jumpers on the shield before uploading code (otherwise the SIM900 interferes with the USB-Serial converter). Software Serial on D2/D3 avoids this issue and allows simultaneous USB debugging.
  • Baud rate mismatch: The SIM900 default baud rate varies between modules (19200 is most common, but some use 9600 or 115200). If AT returns nothing, try different baud rates in sim900.begin(). You can change the baud rate permanently with AT+IPR=9600.
  • Network registration time: The SIM900 takes 10–60 seconds (sometimes longer) to register on the GSM network after power-on. Do not send commands that require network access (SMS, calls, GPRS) before the module is registered. Check registration status with AT+CREG? before proceeding.
  • Electrostatic sensitivity: The SIM900 SIM card holder and antenna connector are ESD-sensitive. Handle the shield in a static-safe environment and avoid touching the exposed antenna connector.
  • Local regulations: GSM modules require type approval for use in each country. The SIM900 shield is CE and FCC certified, but using it in a commercial product requires additional testing and certification.