![]() |
SparkFun Iridium 9604
v1.0.0
Library for the Iridium 9604 Hybrid LTE-M Cellular + Iridium Satellite (SBD) + GNSS IoT module
|
A library to allow you to communicate over both LTE-M and SBD using the Iridium 9604 IoT Module. Written for the SparkFun RockBLOCK 9604 Shield, but compatible with any microcontroller interfaced to the Iridium 9604 over UART.
You can install this library using the Arduino IDE Library Manager: search for SparkFun Iridium 9604
You can also install this library as an Espressif ESP-IDF Component
On ESP32, if you need non-default serial pins, call Serial1.begin(baud, SERIAL_8N1, rxPin, txPin) before myModule.begin(Serial1, baud). The library preserves your pin selection.
The library uses <vector>, so it does not build on the standard AVR (Uno / Mega) boards.
Examples 13 and 14 use u-blox AssistNow (Live Orbits and Predictive Orbits, via Thingstream Zero Touch Provisioning) with the Iridium 9604's internal u-blox M10 GNSS. Examples 15 and 16 need the SparkFun u-blox GNSS v4 library and an external u-blox RTK GNSS module (e.g. ZED-F9P) connected via I2C: the M10's firmware does not support RTCM corrections.
Add the component to your project's main/idf_component.yml:
Or clone this repository into your project's components folder - in a folder called sparkfun_iridium_9604_library. (ESP-IDF uses the directory name as the component name.) ESP-IDF v5.3 or later is required.
On ESP-IDF, text values (sfe_string_t) are std::string and IP addresses (sfe_ip_address_t) are SfeIPAddress. On Arduino they are String and IPAddress. Debug messages go to stdout by default: myModule.enableDebugging(). All of the Arduino examples have ESP-IDF versions in idf_examples.
The examples in this library can be run on the ESP32-S3 processor on the SparkFun RockBLOCK 9604 Shield, but some extra code is needed to adapt the examples so they will run on the Shield hardware. This extra code is described in the Shield repository. Please consult Iridium_9604_Library.md for more details.
The 9604 PWR_ON and RESET_N inputs are active low, with internal pull-ups. They must not be driven high by an external device (PWR_ON's absolute maximum input is 1.65 V). If they are connected to GPIO pins, pass the pins to the constructor - SFE_IRIDIUM_9604 myModule(powerPin, resetPin); - and the library pulls them low and releases them (makes them inputs). Use invertPowerPin(true) if PWR_ON is driven through an inverting FET.
If the pins are not connected directly to GPIO pins, use setPowerOnPinWriteCallback() and setResetPinWriteCallback() to provide your own write functions: void callback(bool state). state is the level the 9604 pin should see: false = pull it low (assert it); true = release it. The callbacks are used by modulePowerOn(), hwReset() (RESET_N low for 200 ms: reset / reboot) and hwEmergencyShutdown() (PWR_ON low for 20 s), and by begin() if it needs to power-cycle the module.
The library is based on the SparkFun u-blox SARA-R5 Arduino Library v1.1.12, restructured following the SparkFun u-blox GNSS v4 library so that it builds for both Arduino and ESP-IDF. The SARA-R5 methods are all still available - without the SARA-R5 name: e.g. SARA_R5_SUCCESS is now IRIDIUM_9604_SUCCESS.
SparkFun_Iridium_9604::IridiumDeviceBus is the abstract UART interface. SfeSerial implements it, using HardwareSerial on Arduino and the ESP-IDF UART driver on ESP-IDF (see sfe_bus.h and sfe_bus_esp_idf.h). You can provide your own bus with setCommunicationBus().SfeDebugPrint / SfePrint replace the SARA-R5 _debugPort prints. enableDebugging() and enableAtDebugging() take any Print (Arduino) or SfeOutput (ESP-IDF).src/urcHandlerVector.h. Comment a handler out to save memory. Register callbacks with the typed helpers (setSocketReadCallback(), setPingCallback(), setSatelliteSignalQualityCallback() ...) or generically with setURCCallback(prefix, callback, index). See src/urcHandler.h for how to add a new URC.setNMEAoutput() enables a message as a +UUGNMEA URC (output 2) or in module memory (output 1). setNmeaCallbackPtr() registers a callback. getNMEA() / getNMEAfield() poll a message (AT+UGNMEA?) and read a field by name. getNmeaMessageField(), getNmeaMessageBlockField() and their ...Callback() versions read fields by name. These replace the SARA-R5 gpsEnableRmc(), gpsGetRmc() and parseGPRMCString() (+UGRMC is deprecated on the 9604).sendSBDText(), sendSBDBinary(), sendReceiveSBDText() and sendReceiveSBDBinary() are similar to the SparkFun IridiumSBD library. setRAT() / getRAT() (+URAT) select LTE Cat M1 or satellite.All of the AT commands used by the SARA-R5 library were checked against the Iridium 9604 AT commands manual (v1.5 BETA) and adapted where needed.
setRAT() (AT+URAT). The module reboots when the RAT is changed.rssi() (AT+CSQ) is cellular only. The satellite signal quality comes from the +CIEV URC: setIndicatorEventReporting(), getSatelliteSignalQuality(), waitForSatelliteSignalQuality().getSBDErrorString().+UUGNMEA: "$...*hh". The GNSS system enum includes BeiDou B1C and QZSS L1S; the aiding mode enum includes PointPerfect.gpsEnableRmc() and gpsGetRmc() have been replaced by the NMEA methods above.setPDPconfiguration(), performPDPaction(), getNetworkAssignedIPAddress() and setPSDActionCallback() have been removed. The internal TCP/IP stack (sockets, ping, DNS, HTTP, MQTT) uses the PDP (Packet Data Protocol) context set by AT+UDCONF=19 (cid 1 - the default EPS bearer - activated during the LTE attach). Use getDefaultPDPcontext() (AT+UDCONF=19), getPDPcontextState() (AT+CGACT?), activatePDPcontext() (AT+CGACT) and getPDPaddress() (AT+CGPADDR) instead.Iridium_9604_AT_commands.h): +ULOC, +UULOC and +ULOCCELL (CellLocate). +USECPRF and +USECMNG are referenced by the manual, but have no section of their own.API documentation is generated with Doxygen and published to GitHub Pages from the main branch:
https://docs.sparkfun.com/SparkFun_Iridium_9604_Library
This library is open source!
Please see LICENSE.md for full details.