Follow us:-
0

ESP32 with SIM900A GSM Module

  • 15-07-2025

πŸ“‘ What is SIM900?

The SIM900 is a GSM/GPRS module from SIMCom. It allows microcontrollers like ESP32 or Arduino to:

βœ… Send/receive SMS
βœ… Make/receive phone calls
βœ… Connect to the Internet (GPRS)
βœ… Send data to servers via HTTP, MQTT, TCP/IP

It communicates via UART (TX/RX) and uses AT commands.


πŸ“¦ Features of SIM900

Feature Description
Network 2G GSM (850/900/1800/1900 MHz)
Communication UART (AT commands)
Baud Rate Default 9600
SIM Card Standard-size SIM (2G supported)
Power Supply 5V–12V, 2A recommended
Antenna Required for GSM signal
Optional Mic & Speaker (for calls)

πŸ”Œ SIM900 to ESP32 Connection

SIM900 Pin ESP32 Pin
TX GPIO 16 (ESP32 RX)
RX GPIO 17 (ESP32 TX)
GND GND
VCC ⚠️ External 5V 2A power supply

⚠️ DO NOT power SIM900 directly from ESP32 or USB. It needs high current, especially during network operations.


🧾 Arduino Code Example – Sending SMS with ESP32 + SIM900

🧰 Libraries Required:

You don't need extra libraries – just Serial and AT commands.

βš™οΈ Wiring

  • SIM900 TX → ESP32 RX (GPIO 16)

  • SIM900 RX → ESP32 TX (GPIO 17)

  • SIM900 GND ↔ ESP32 GND

  • SIM900 VCC → External 5V 2A

    πŸ“± Other Useful AT Commands:

    Command Function
    AT Check module
    AT+CSQ Signal strength
    AT+CCID SIM card number
    AT+CREG? Network registration
    ATD+91XXXXXXXXXX; Make a call
    ATH Hang up
    AT+CMGR=1 Read SMS from slot 1
    AT+CMGD=1 Delete SMS from slot 1

    βš™οΈ Using Serial Monitor to Test

    You can manually send AT commands via Serial Monitor using this setup:

    • Use Serial passthrough sketch to forward Serial to SIM900.


    πŸ“‘ Real-World Projects Using SIM900 + ESP32

    Project Description
    🚨 GSM Alarm System    Send SMS when motion or fire is detected
    πŸ“¦ Asset Tracker   Send location data via SMS (with GPS)
    πŸ›œ IoT without WiFi   Use GPRS to send data to cloud
    πŸ” Smart Door Lock   Unlock with OTP via SMS
    πŸ“ˆ Remote Sensor   Send sensor values (temperature, moisture, etc.) to phone

    ⚠️ Power Supply Tips

    • SIM900 can draw up to 2A peak. If underpowered, it may restart or fail to send SMS.

    • Use external power supply (e.g., 5V 2A adapter or battery pack).

    • Keep GND common between ESP32 and SIM900.


    ❓ Common Issues and Fixes

    Problem Solution
    No SMS sent   Check SIM is active, balance, and signal
    Module keeps restarting   Power supply issue – use 2A source
    AT commands don’t respond   Check TX/RX pins or baud rate
    "SIM not inserted" Clean SIM contacts and reinsert

 

HOW TO OPERATE

 


// Define ESP32 hardware serial port for SIM900
#define SIM900_TX 17  // ESP32 TX connected to SIM900 RX
#define SIM900_RX 16  // ESP32 RX connected to SIM900 TX
#define PWRKEY 4      // SIM900 Power Key pin (adjust if needed)
#define GSM_BAUD 9600
// Initialize hardware serial for SIM900
HardwareSerial sim900(2);

void powerOnSIM900() {
    pinMode(PWRKEY, OUTPUT);
    digitalWrite(PWRKEY, LOW);
    delay(1000);  // Hold PWRKEY low for 1 second
    digitalWrite(PWRKEY, HIGH);
    delay(9000);  // Wait for the module to initialize
}

void setup() {
    Serial.begin(115200);  // Serial Monitor
    sim900.begin(GSM_BAUD, SERIAL_8N1, SIM900_RX, SIM900_TX);  // SIM900 UART
   
    powerOnSIM900();

    Serial.println("Testing AT communication...");
   
    // Test AT command
    sendATCommand("AT");

    // Set SMS text mode
    sendATCommand("AT+CMGF=1");

    // Send SMS
    Serial.println("Sending SMS...");
    sim900.println("AT+CMGS=\"+919305706040\"");  // Replace with recipient's number
    delay(1000);
    sim900.print("Hello from ESP32 and SIM900");
    sim900.write(26); // CTRL+Z to send
    delay(5000);
    printResponse();
}

void loop() {
    // Add code to handle incoming messages or other functionalities
}

// Function to send an AT command and print response
void sendATCommand(const char *command) {
    Serial.print("Sending: ");
    Serial.println(command);
    sim900.println(command);
    delay(1000);
    printResponse();
}

// Function to print response from SIM900
void printResponse() {
    while (sim900.available()) {
        Serial.write(sim900.read());
    }
    Serial.println("----------------------");
}

ESP32 with SIM900A GSM Module

Related Post

How do I run a script at Pico on boot?

How do I run a script at Pico on boot?

As per official documentation Step by step process for pico program run after power on:Save your pyt...

ESP32 Setup in Arduino IDE

ESP32 Setup in Arduino IDE

ESP32 Board are so popular? Mainly because of the following featuresLow-costBluetoothWiFiLow PowerDu...

Node MCU ESP8266 Setup in Arduino IDE

Node MCU ESP8266 Setup in Arduino IDE

Node MCU ESP8266 Board are so popular? Mainly because of the following features.Its true Arduino Kil...

ESP32 with L298N DC Motor Driver

ESP32 with L298N DC Motor Driver

πŸ”§ Basic IntroductionL298N is a dual H-Bridge motor driver IC that allows controlling the direction...

MotorBot with Esp32

MotorBot with Esp32

πŸ”§ Components Needed:ComponentQuantityESP32 Dev Board1L298N Motor Driver Module1DC Gear Motors (TT o...

ESP32 with ADXL335 Accelerometer

ESP32 with ADXL335 Accelerometer

The ADXL335 is a small, thin, low-power 3-axis analog accelerometer manufactured by Analog Devices....

ESP32 with Ultrasonic Sensor (HC-SR04)

ESP32 with Ultrasonic Sensor (HC-SR04)

🧠 What is an Ultrasonic Sensor?An ultrasonic sensor is a device that uses sound waves to detect how...

ESP32 with DHT11 Temperature & Humidity Sensor

ESP32 with DHT11 Temperature & Humidity Sensor

πŸ“Œ What is the DHT11 Sensor?The DHT11 is a basic, low-cost digital temperature and humidity sensor....

ESP32-Based Autonomous Fire Extinguisher Bot

ESP32-Based Autonomous Fire Extinguisher Bot

πŸ”₯ FIRE BOT – Bluetooth Controlled Fire Extinguisher RobotWelcome to the FIRE BOT project! This robo...

ESP32 with BMP180 Pressure & Temperature Sensor

ESP32 with BMP180 Pressure & Temperature Sensor

BMP180 Sensor: Digital Barometric Pressure SensorThe BMP180 is a digital barometric pressure sensor...

ESP32 with 1.8" TFT LCD Display (ST7735S)

ESP32 with 1.8" TFT LCD Display (ST7735S)

πŸ”§ 1. Hardware Overview: 1.8" TFT DisplayMost 1.8" TFT modules are based on the ST7735 driver and co...

Smart Display Interface Using SSD1306 OLED & ESP32

Smart Display Interface Using SSD1306 OLED & ESP32

The SSD1306 is a popular controller used in OLED (Organic Light Emitting Diode) displays, most commo...

ESP32 with Servo Motor

ESP32 with Servo Motor

A servo motor is a type of motor designed for precise control of angular position, making it ideal f...

ESP32 with Gravity Voice Recognition Module

ESP32 with Gravity Voice Recognition Module

The Gravity Voice Recognition Module is a user-friendly module developed by DFRobot that allows micr...

ESP32 with APDS-9960 Gesture Sensor

ESP32 with APDS-9960 Gesture Sensor

The APDS-9960 is an advanced, compact sensor from Broadcom (formerly Avago Technologies) that offers...

Smart Control: Stepper Motor with ESP32

Smart Control: Stepper Motor with ESP32

πŸ” What is the 28BYJ-48 Stepper Motor?The 28BYJ-48 is a 5V unipolar stepper motor with a built-in re...

Smart Farming : ESP32 with Soil Moisture Sensor

Smart Farming : ESP32 with Soil Moisture Sensor

How Soil Moisture Sensor Works and Interface it with Esp32Β When you hear the term β€œsmart garden,” on...

Control in Your Hands: ESP32 with 2-Axis Joystick

Control in Your Hands: ESP32 with 2-Axis Joystick

πŸ”§ What is an Analog Joystick?An analog joystick typically has:2 potentiometers (one for X-axis, one...

ESP32 with NEO-8M GPS Module

ESP32 with NEO-8M GPS Module

πŸ“‘ What is the NEO-8M GPS Module?The NEO-8M is a high-precision GNSS GPS receiver by u-blox, capable...

ESP32 with WS2812 NeoPixel LED

ESP32 with WS2812 NeoPixel LED

πŸ”§ What is a NeoPixel?NeoPixel is Adafruit’s name for individually addressable RGB LEDs using the WS...

Motion Detected: ESP32 with PIR Sensor (HC-SR501)

Motion Detected: ESP32 with PIR Sensor (HC-SR501)

🧠 What is a PIR Sensor?PIR = Passive Infrared SensorA PIR sensor detects motion by measuring change...

ESP32 with AI Thinker GP-02 GPS Module

ESP32 with AI Thinker GP-02 GPS Module

βœ… What is AI Thinker GP-02?The AI Thinker GP-02 is a GNSS (GPS) module, designed to work with satel...

Button with ESP32

Button with ESP32

🧠 What is a Push Button?A push button is a simple mechanical switch that connects two points in a c...

Tilt Sensor Module SW520D

Tilt Sensor Module SW520D

πŸ€” What is a Tilt Sensor?A tilt sensor (also called a ball switch or mercury switch) is a digital sw...

ESP32 with TCS34725 RGB Sensor

ESP32 with TCS34725 RGB Sensor

🎨 What is the TCS34725?The TCS34725 is a color sensor made by AMS (now part of Renesas).It detects...

ESP32 + I2C LCD for Real-Time Feedback

ESP32 + I2C LCD for Real-Time Feedback

πŸ“˜ What is an I2C LCD?An I2C LCD is a Liquid Crystal Display that uses the I2C communication protoco...

MPU6050 Accelerometer and Gyroscope Sensor

MPU6050 Accelerometer and Gyroscope Sensor

🧠 What is MPU6050?The MPU6050 is a 6-axis motion tracking device made by InvenSense. It combines:βœ…...

Digital Temperature Monitoring: ESP32 + DS18B20 Sensor System

Digital Temperature Monitoring: ESP32 + DS18B20 Sensor System

🌑️ What is DS18B20?The DS18B20 is a digital temperature sensor from Maxim Integrated (now Analog Dev...

ESP32 with DS1307 RTC Module

ESP32 with DS1307 RTC Module

⏰ What is DS1307 RTC?The DS1307 is a real-time clock IC by Maxim Integrated that keeps track of:Sec...

DFPlayer Mini with Esp32

DFPlayer Mini with Esp32

🎡 What is DFPlayer Mini?The DFPlayer Mini is a tiny, standalone MP3 audio player module. It can pla...

IR Receiver VS1838B with ESP32

IR Receiver VS1838B with ESP32

πŸ“‘ What is an IR Receiver?An IR (Infrared) Receiver module receives signals from an IR remote contro...

Rotary Encoder with Esp32

Rotary Encoder with Esp32

πŸ“Œ What is a Rotary Encoder?A rotary encoder is an electro-mechanical sensor that converts the angul...

ESP32 with Dot Matrix Display (MAX7219)

ESP32 with Dot Matrix Display (MAX7219)

πŸ“Œ What is the Dot Matrix Display with MAX7219?A Dot Matrix Display is an arrangement of LEDs in a g...

ESP-NOW with ESP32

ESP-NOW with ESP32

πŸ“Œ What is ESP-NOW?ESP-NOW is a wireless communication protocol developed by Espressif, allowing ESP...

ESP32 Joystick Controlled Robot Using ESP-NOW Protocol & L298N Motor Driver

ESP32 Joystick Controlled Robot Using ESP-NOW Protocol & L298N Motor Driver

πŸ€– ESP32 Joystick Controlled Robot Using ESP-NOW Protocol & L298N Motor DriverWireless bot control w...

ESP32 with MAX30100 HEART SENSOR

ESP32 with MAX30100 HEART SENSOR

❀️ Heart Rate & SpOβ‚‚ Sensor (MAX30100/MAX30102)πŸ”¬ Pulse Sensor | SpOβ‚‚ Monitor | Wearable Health Tech...