Skip to main content

Raspberry Pi SIM800L GSM module

Project description

Raspberry Pi SIM800L, SIM800C and SIM800H GSM module

PyPI Python Versions PyPI download month GitHub license

SIM800L GSM module library for Linux systems like the Raspberry Pi. This library was also successfully tested with SIM800C and should also support SIM800H.

This library provides a driver for SIMCom GSM modules (SIM800L, SIM800C, SIM800H) via AT commands over a serial interface. It supports SMS (including multipart), HTTP/HTTPS GET and POST requests, DNS resolution, RTC synchronization, and access to module information. SMS messaging can be done in TEXT, HEX, or PDU mode (default: PDU). Possibly the driver is also compatible with newer modules like SIM7100 and SIM5300.

Key features include:

  • send_sms(): Sends SMS messages, automatically handling multipart when necessary.
  • read_next_message(): Retrieves the next SMS, abstracting message type and reassembling multipart content.
  • http(): Executes HTTP GET/POST requests, returning response status and payload.
  • dns_query(): Resolves domain names to IPs via the module’s DNS functionality.

The library also exposes over 30 methods to configure and query the SIM module, enabling robust control and integration.

AT Protocol issues

This software manages SMS messaging and HTTP operations via the asyncronous serial communication of the SIM800 device, using its proprietary AT command protocol.

The AT command protocol is fundamentally inadequate for reliable and verifiable communication and presents intrinsic limitations when employed for robust operations. Originally designed for simple control of modems, the AT protocol is inherently textual and lacks the formal structure of communication protocols that utilize packetized data exchange.

One critical drawback lies in the nature of message formatting. AT commands are plain-text strings without explicit framing mechanisms. Unlike packet-based protocols, AT messages do not encapsulate data within headers that define payload length, type, or integrity information such as checksums or CRCs. Consequently, parsing and verifying the completeness and correctness of messages becomes error-prone.

Moreover, AT-based communication lacks a standardized state machine or signaling mechanisms to indicate distinct phases of a connection lifecycle. Commands that initiate, maintain, or terminate connections must be issued and interpreted in a predefined order, but the protocol itself does not return the transition between these states. This absence of inherent session management results in brittle implementations, where the client must continually probe the status of operations.

This deficiency becomes even more critical with vendor-specific instructions, which introduce proprietary connection setup sequences requiring polling or conditional branching based on context-sensitive responses, and may also include asynchronous "Unsolicited Result Codes" within the textual communication that needs special processing while managing the workflow. Without structured feedback or flags denoting session phases, the client application must rely on loosely coupled, often ambiguous responses to maintain protocol correctness.

Through an accurately tested heuristic approach, this software attempts to handle all supported operations via the AT protocol in the most robust manner possible, aiming to automatically recover from errors when feasible.

Setup

This module only installs on Linux (not on Windows).

Hw Requirements

  • Linux system with a UART serial port, or Raspberry Pi with Raspberry Pi OS (this library has been tested with Buster and Bullseye).
  • External power supply for the SIM800L (using the Raspberry Pi 5V power supply, a standard diode (1N4007) with voltage drop of about 0.6 volts and a 1 F capacitor might work).

Full information, installation notes, API reference and usage details at the sim800l-gsm-module GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sim800l_gsm_module-2.0.4.tar.gz (50.8 kB view details)

Uploaded Source

File details

Details for the file sim800l_gsm_module-2.0.4.tar.gz.

File metadata

  • Download URL: sim800l_gsm_module-2.0.4.tar.gz
  • Upload date:
  • Size: 50.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for sim800l_gsm_module-2.0.4.tar.gz
Algorithm Hash digest
SHA256 5bddc50fe4d3a7584958ba9ce8149fcc8cb856ef70fb8d7729f3b024245e47b9
MD5 9923899cc32af24efaa184a862109d9a
BLAKE2b-256 5dd869b9f9b83f346fd4ce81305ef84c55c6483208e06400fa0f6186c71e4e03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page