How tremaru/iarduino_gsm works
1. Repository type and boundary
- This is an Arduino library, not a standalone application.
- The core deliverable is a reusable C++ library in src/ that abstracts an iArduino GSM/GPRS Shield for microcontroller sketches.
- The repo boundary is: user sketch → iarduino_GSM library → serial link → GSM modem/shield → cellular network.
2. Core runtime subsystem
- The main implementation lives in src/iarduino_GSM.cpp and src/iarduino_GSM.h.
- This layer is the only place that should contain protocol handling, AT command formatting/parsing, and device state management.
- The README shows the public API surface; the library is a thin hardware-facing abstraction rather than a large framework.
3. Communication model
- The library talks to the GSM module through an Arduino UART abstraction supplied to begin(UART).
- The repo supports both HardwareSerial and SoftwareSerial in examples, meaning the library is designed to operate over either physical or bit-banged serial ports.
- This is the main architectural boundary: the library does not own the serial transport, it consumes an Arduino serial object.
4. Primary functional domains
- The API groups into a few clear subsystems:
- module lifecycle and status: begin, status, pwr, reset, pin, puk
- command execution: runAT, runUSSD
- SMS: SMSavailable, SMSmax, SMSread, SMSsend, encoding/class controls
- voice calls: CALLavailable, CALLup, CALLend, CALLdial, CALLstatus
- audio controls: SOUNDdevice, SOUNDvolume, SOUNDmute
- These are all application-facing wrappers around modem capabilities.
5. Data flow for control operations
- A sketch calls a library method.
- The library converts that request into AT commands and sends them over serial.
- The modem responds with modem text/URC responses.
- The library interprets the response and returns status/data to the sketch.
- For most features, the library is acting as a request/response adapter over AT command text.
6. SMS subsystem
- SMS support is one of the larger functional areas and likely includes text encoding/decoding, storage queries, and message transfer.
- extras/PDU.txt indicates the library also documents or supports PDU format handling, which matters for SMS transport and encoding.
- The encoding controls in the README (TXTreadCoding, TXTsendCoding, TXTsendCodingDetect) suggest the SMS path is responsible for charset conversion as well as message exchange.
7. Voice call subsystem
- The call-related APIs form a separate modem feature group for incoming/outgoing voice sessions.
- The library exposes call detection, dialing, answer, hangup, and status, plus audio routing and volume controls.
- Architecturally, this is still the same serial/AT channel, but it represents a distinct state machine in the modem domain.
8. Module lifecycle and recovery
- begin, pwr, reset, pin, and puk indicate the library manages module readiness and SIM security state, not just data services.
- This means the library likely has startup sequencing and recovery behavior before higher-level features can work.
- In diagram terms, these are initialization and fault-recovery paths around the main serial control path.
9. Example application layer
- The examples/ tree is extensive and organized by:
- board/shield variant: Shield_A6, Shield_A9
- transport type: HardwareSerial, SoftwareSerial
- feature demo: begin, balance, sms_send, sms_read, call_outgoing, call_incoming, AT_commands, reset_GSM, all, and “mini” variants
- These sketches are the consumer layer that demonstrate how the library is used in real Arduino programs.
- They also show the intended deployment matrix: different shield revisions and serial transport choices.
10. Packaging and Arduino IDE integration
- library.properties makes this a proper Arduino library package.
- keywords.txt supports Arduino IDE syntax highlighting and API discovery.
- License.txt and the README/wiki links indicate the repo is distributed as a documented hardware support library, not as a service or backend system.
11. Technologies and environment
- Runtime: Arduino C++ on embedded microcontrollers.
- External dependency: a GSM/GPRS modem/shield from iArduino.ru.
- No web stack, server, or database is present; the architectural center is embedded serial device control.
12. What an architecture diagram should emphasize
- Show the sketch/application as the caller.
- Show iarduino_GSM as the hardware abstraction layer.
- Show serial transport as the interface to the GSM shield.
- Show the shield/modem as the stateful external device that implements SMS, calls, USSD, and AT command behavior.
- Treat the examples and extras/ as supporting material around the core library, not as runtime components.
Main entry points: iarduino_GSM.cpp Core logic · iarduino_GSM.h iarduino_GSM · HardwareSerial A6 HW · SoftwareSerial A6 SW
Components 18
Core library
Reusable Arduino C++ layer that abstracts GSM modem control.
- iarduino_GSM · Main Arduino GSM/GPRS shield abstraction and public API.
src/iarduino_GSM.h - Core logic · Implements AT command formatting, parsing, and modem state management.
src/iarduino_GSM.cpp - Serial port · HardwareSerial or SoftwareSerial transport passed into the library.
- AT protocol · Text command/response interface used to control the modem.
- GSM shield · External iArduino GSM/GPRS modem that executes SMS, call, USSD, and audio features.
- Cell network · Carrier network reached by the shield for messaging and calls.
- Lifecycle · Startup, power, reset, PIN, and PUK handling.
- SMS · Send/read messages, storage queries, and text coding controls.
- Calls · Incoming/outgoing call handling and audio state control.
- USSD · Balance and other short code request/response operations.
Examples
Sketches that demonstrate library usage across shield variants and serial transports.
- Sketch API · User code that calls the library from a microcontroller program.
- A6 HW · HardwareSerial examples for the A6 shield variant.
examples/Shield_A6/HardwareSerial - A6 SW · SoftwareSerial examples for the A6 shield variant.
examples/Shield_A6/SoftwareSerial - A9 HW · HardwareSerial examples for the A9 shield variant.
examples/Shield_A9/HardwareSerial - A9 SW · SoftwareSerial examples for the A9 shield variant.
examples/Shield_A9/SoftwareSerial - Demo sketches · Begin, SMS, call, AT command, reset, balance, and all-in-one demonstrations.
Support files
Documentation and Arduino packaging metadata.
- PDU notes · SMS PDU format notes and encoding reference.
extras/PDU.txt - Arduino package · library.properties and keywords.txt for IDE integration.
Connections 17
- Sketch API → iarduino_GSM: uses · Sketches call the public API methods exposed by the library.
- iarduino_GSM → Core logic: implements · Header defines the interface; source file implements the behavior.
- Core logic → Serial port: reads/writes · Library sends commands and receives modem responses over UART.
- Core logic → AT protocol: formats · Core code builds and parses AT command text.
- AT protocol → GSM shield: controls · AT commands drive modem lifecycle and feature operations.
- GSM shield → Cell network: connects · The shield uses the cellular network for SMS and voice service.
- Core logic → Lifecycle: manages · Begin, power, reset, PIN, and PUK handling.
- Core logic → SMS: manages · SMS send/read and encoding support are handled in the modem layer.
- Core logic → Calls: manages · Call detection, dialing, answer, hangup, and audio controls.
- Core logic → USSD: manages · USSD requests are issued as a modem command path.
- A6 HW → Demo sketches: contains · HardwareSerial demos for the A6 shield variant.
- A6 SW → Demo sketches: contains · SoftwareSerial demos for the A6 shield variant.
- A9 HW → Demo sketches: contains · HardwareSerial demos for the A9 shield variant.
- A9 SW → Demo sketches: contains · SoftwareSerial demos for the A9 shield variant.
- Demo sketches → Sketch API: demonstrates · Example sketches show how to call the library from Arduino programs.
- PDU notes → SMS: documents · PDU notes support SMS transport and encoding behavior.
- Arduino package → iarduino_GSM: packages · Arduino library metadata and IDE keyword support wrap the core library.