Skip to content

SIM800_GSM_GPRS is an Arduino library for SIM800C/SIM800L modules. It enables sending/receiving SMS, making/answering calls, and performing HTTP GET/POST via GPRS. Compatible with Arduino, ESP32, and STM32, it offers simple APIs, network detection, IoT, IMEI retrieval, and event-driven SMS/call handling.

License

Notifications You must be signed in to change notification settings

kbmkrishnamali1992-hub/SIM800_GSM_GPRS_LIBRARY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📡 SIM800_GSM_GPRS Arduino Library

SIM800_GSM_GPRS is an Arduino-compatible library for SIM800C/SIM800L GSM/GPRS modules. It enables easy communication with GSM networks to send SMS, make/receive calls, and perform HTTP GET/POST via GPRS. Supports Arduino, ESP32, and STM32 boards.


✨ Features

  • Initialize SIM800 module and test communication
  • Send and receive SMS messages
  • Make, answer, and disconnect calls
  • Perform HTTP GET/POST requests via GPRS
  • Retrieve IMEI and network status
  • Enable event-based handling for incoming SMS and calls
  • Control sleep mode and network LED
  • Lightweight, dependency-free library

🧩 Supported Boards

  • Arduino UNO / Mega / Nano
  • ESP32 / ESP32-WROOM / TTGO / Seeed nRF52840 Sense
  • STM32 (CubeIDE and Arduino core)
  • Any board supporting Serial or SoftwareSerial

⚙️ Installation

Option 1 — Arduino IDE (Manual)

  1. Download this repository as a ZIP.
  2. In Arduino IDE, go to Sketch → Include Library → Add .ZIP Library…
  3. Select the downloaded file.

Option 2 — GitHub Clone

git clone https://github.com/kbmkrishnamali1992-hub/SIM800_GSM_GPRS_LIBRARY.git

Place the folder in your Arduino libraries directory:

Documents/Arduino/libraries/SIM800_GSM_GPRS

🧠 Example Usage

🔹 Example 1 — Send SMS and Make Call

#include <SIM800_GSM_GPRS.h>
#include <SoftwareSerial.h>

SoftwareSerial sim800(2, 3);
SIM800_GSM_GPRS gsm(sim800);

void setup() {
  Serial.begin(9600);
  sim800.begin(9600);
  Serial.println(F("Initializing GSM..."));
  
  while (!gsm.begin()) delay(2000);
  
  Serial.println(F("SIM800C Ready!"));
  Serial.print(F("IMEI: ")); Serial.println(gsm.getIMEI());
  
  gsm.gsmECHOoff();
  gsm.setSMSTextMode();
  gsm.enableCALL();
  gsm.enableSMSNotification();
  
  while (!gsm.wait_for_network(1000)) delay(1000);
  Serial.println(F("CONNECTED TO NETWORK"));
  
  gsm.sendSMS("9876543210", "Hello from SIM800C!");
  gsm.makeCall("9876543210");
}
void loop() {}

🔹 Example 2 — HTTP POST & GET via GPRS

#include <SIM800_GSM_GPRS.h>
#include <SoftwareSerial.h>

SoftwareSerial sim800(2, 3);
SIM800_GSM_GPRS gsm(sim800);

void setup() {
  Serial.begin(9600);
  sim800.begin(9600);
  while (!gsm.begin()) delay(2000);

  Serial.println(F("CONNECTED TO NETWORK"));
  String apn = "airtelgprs.com";
  while (!gsm.connectGPRS(apn)) delay(1000);

  String payload = "{\"test_name\":\"SIM800C\"}";
  String response;
  int status;

  if (gsm.httpPost("http://httpbin.org/post", payload, status, response)) {
    Serial.println(F("🌐 HTTP POST success"));
    Serial.println(response);
  }

  if (gsm.httpGet("http://httpbin.org/get?test_name=SIM800C", status, response)) {
    Serial.println(F("🌐 HTTP GET success"));
    Serial.println(response);
  }

  gsm.DisconnectGPRS();
  gsm.shutdownModule();
}
void loop() {}

🧰 API Reference

Function Description
begin() Initialize SIM800 and test communication
getIMEI() Returns the module IMEI
wait_for_network(timeout) Wait for GSM network registration
sendSMS(number, message) Send text SMS
makeCall(number) Make an outgoing call
answerCall() Answer incoming call
disconnectCall() Hang up active call
checkEvent() Check for incoming SMS or call events
connectGPRS(apn) Connect to GPRS using given APN
httpPost(url, payload, status, response) Perform HTTP POST
httpGet(url, status, response) Perform HTTP GET
DisconnectGPRS() Disconnect GPRS session
shutdownModule() Power down SIM800 safely
enableSMSNotification() Enable SMS received notifications
enableCALL() Enable incoming call detection
disableSleepMode() Keep module awake
gsmECHOoff() Disable AT command echo

🧩 Dependencies

  • Arduino Core (any board)
  • <SoftwareSerial.h> (for UNO/Nano)
  • Hardware Serial (recommended for ESP32 / STM32)

🧑‍💻 Contributing

Pull requests are welcome! To contribute:

  1. Fork the repo
  2. Create your feature branch
  3. Commit changes and open a PR

💡 Troubleshooting

Issue Possible Fix
No network detected Check SIM card, antenna, or power supply
HTTP POST fails Verify APN and HTTP URL (must be HTTP, not HTTPS)
SMS not sent Ensure SIM has balance and signal
“OK” not received Try lowering baudrate to 9600

🧾 License

This library is released under the MIT License — you’re free to use, modify, and distribute it.


🌍 Author & Support

Author: KRISHNA MALI Email: kbm.krishnamali1992@gmail.com GitHub: https://github.com/kbmkrishnamali1992-hub

About

SIM800_GSM_GPRS is an Arduino library for SIM800C/SIM800L modules. It enables sending/receiving SMS, making/answering calls, and performing HTTP GET/POST via GPRS. Compatible with Arduino, ESP32, and STM32, it offers simple APIs, network detection, IoT, IMEI retrieval, and event-driven SMS/call handling.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages