Giter VIP home page Giter VIP logo

sparkfun_iridiumsbd_i2c_arduino_library's Introduction

SparkFun IridiumSBD I2C Arduino Library

  • This library can be installed through the Arduino Library Manager: please search for IridiumSBDi2c

  • Iridium SBD is Mikal's original library which does not (currently) support I2C.

The Iridium 9602 and 9603N are fascinating communications modules that give devices like Arduino or Raspberry Pi™ access to the Iridium satellite network. This is a big deal, because it means that your application can now easily and inexpensively communicate from any point on or above the globe, from the heart of the Amazon to the Siberian tundra, from the Arctic to the Antarctic. This library, IridiumSBD, uses Iridium's SBD ("Short Burst Data") protocol to send and receive short messages to/from the Iridium hub. SBD is a "text message"-like technology that supports the transmission of text or binary messages up to a certain maximum size (270 bytes received, 340 bytes transmitted).

Breakout boards for the 9602 and 9603N are available in different formats. Most of these breakouts use serial (UART) interfacing but I2C (Qwiic) is possible too and this version of the library supports both.

Grateful thanks go to:

  • Mikal Hart for writing the original versions of IridiumSBD and for TinyGPSPlus

Repository Contents

  • /documentation - Full documentation for the library (.md).
  • /examples - Example sketches for the library (.ino). Run these from the Arduino IDE. They demonstrate how to use both serial and I2C interfaces.
  • /src - Source files for the library (.cpp, .h).
  • keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
  • library.properties - General library properties for the Arduino package manager.

Documentation

You can find documentation for the library in the documentation folder

Products That Use This Library

  • WRL-13745 - The original Rock7 RockBLOCK, available from your friends at SparkFun.
  • WRL-14498 - The Rock7 RockBLOCK 9603, available from your friends at SparkFun.
  • SPX-16394 - Qwiic Iridium 9603N: provides I2C support instead of serial, allowing you to add Iridium SBD communication to any Qwiic or I2C project.
  • SPX-16469 - Artemis Global Tracker: combining the Iridium 9603N, u-blox ZOE-M8Q and TE MS8607 into a single compact tracker.

History

Versions 1 and 2 of this library were written by Mikal Hart with generous support from Rock 7 Mobile.

This version is based on Version 2.0 of IridiumSBD but has been modified to provide I2C support for the Qwiic Iridium 9603N. Serial will still work too of course. New examples demonstrate how to use the I2C interface. The serial examples have also been restructured and enhanced.

This version of the library contains a new function called clearBuffers which can be used to clear the Mobile Originated or Mobile Terminated message buffers. This allows you to overcome the 'feature' (bug?) where the 9603N will automatically re-transmit the last MO message when checking for new MT messages. This closes Issues #10 and #11 in Mikal's repo.

  • clearBuffers(ISBD_CLEAR_MO) will clear the MO buffer (default)
  • clearBuffers(ISBD_CLEAR_MT) will clear the MT buffer
  • clearBuffers(ISBD_CLEAR_BOTH) will clear both buffers

The library also includes Pull Requests #14 Get IMEI and #21 header import guards. There are new serial and I2C examples for getIMEI.

Also included is a correction for Issue #12 weak diagnostics.

Also includes a fix to let the serial Ring example work properly.

License

Like versions 1 and 2 of Mikal's library, this version is also distributed under a GNU Lesser General Public Licence v2.1.

sparkfun_iridiumsbd_i2c_arduino_library's People

Contributors

adamgarbo avatar paulzc avatar sfemark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparkfun_iridiumsbd_i2c_arduino_library's Issues

IridiumSBD I2C and SparkFun u-blox library conflict with RockBLOCK 9603

Hi there,

It appears that the IridiumSBD I2C and SparkFun u-blox libraries are conflicting when using a SparkFun Qwiic Micro and RockBLOCK 9603 over serial.

Components used:

  • SparkFun Qwiic Micro
  • RockBLOCK 9603

Steps to reproduce:
This can be observed by running any of the Serial_Examples__Rockblock with u-blox library included:
#include <SparkFun_Ublox_Arduino_Library.h>

After adding the library, for instance using Example5_Sleep, results in error 5, no modem detected:

Output:

Starting modem...
17:00:50.165 -> Calling internalBegin
17:00:50.165 -> Powering on modem...
17:00:50.653 -> >> AT

17:00:50.653 -> AT
Waiting for response OK
17:00:50.653 -> 
17:00:50.653 -> << >> AT

17:01:20.638 -> AT
Waiting for response OK
17:01:20.638 -> 
17:01:20.638 -> << >> AT

17:01:55.728 -> AT
Waiting for response OK
17:01:55.728 -> 
17:01:55.728 -> << >> AT

17:02:25.826 -> AT
Waiting for response OK
17:02:25.826 -> 
17:02:25.826 -> << >> AT

17:02:51.716 -> AT
Waiting for response OK
17:02:51.716 -> 
17:02:51.716 -> << >> AT

17:03:20.631 -> AT
Waiting for response OK
17:03:20.631 -> 
17:03:20.631 -> << >> AT

17:03:50.650 -> AT
Waiting for response OK
17:03:50.650 -> 
17:03:50.650 -> << >> AT

17:04:20.630 -> AT
Waiting for response OK
17:04:20.630 -> 
17:04:20.630 -> << No modem detected.
17:04:50.639 -> Powering off modem...
17:04:50.639 -> Begin failed: error 5
17:04:50.639 -> No modem detected: check wiring.

Potential cause:

I believe this is because the u-blox library defines Serial as SerialUSB:
https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/blob/97bd455b0e7a05b92bfe5a528c28cc47f2e2d289/src/SparkFun_Ublox_Arduino_Library.h#L55-L67

However, on the Qwiic Micro, we use Serial as the port for the RockBLOCK:

#define IridiumSerial Serial
IridiumSBD modem(IridiumSerial, SLEEP_PIN);
IridiumSerial.begin(19200);

It doesn't seem to matter what order the definitions are made, the u-blox library seems to have final say as to what Serial will be. I wonder if a possible solution is to have a check in the u-blox library for the Qwiic Micro, and not declare Serial as SerialUSB.

Cheers,
Adam

getSystemTime() incorrect result due to tm_isdst not initialised

The getSystemTime() function uses mktime() to do the Iridium epoch offset, but does not set the tm struct's tm_isdst member, which may lead to incorrect time conversions (ie a random/junk DST offset).

It looks like the conversion code should either set epoch_start.tm_isdst = 0 or use mk_gmtime(&epoch_start) to get the epoch start timestamp.

When to clear the MO buffer?

I am looking for some help re: clearing the MO buffer.

I understand that when one of the sendSBDText, sendSBDBinary, sendReceiveSBDText, sendReceiveSBDBinary are called, the library does consecutive retries within ISBD_DEFAULT_SENDRECEIVE_TIME seconds. Either there is a timeout, successful transmission or fatal error. This timeout can be adjusted by the adjustSendReceiveTimeout() function.

I have then seen in the send/receive example that after the send/receive functions terminate you always clear the MO buffer. This would make sense in the case when the transmission was successful, but I don't understand why you do it also in the case that it failed. Can't I just call again the send/receive functions without clearing the MO buffer? Is it because when calling them, I have to pass the buffer to be sent?

Apollo3 Core v2.x incompatibility: WString.h is deprecated

Hi @PaulZC,

I discovered today that v2.x of the Apollo3 Core is not compatible with the IridiumSBD I2C library, as it no longer includes WString.h. The core does include the following helpful note:

// including WString.h is deprecated, for all future projects use Arduino.h instead

I'm not overly familiar with WString.h but it appears to be used extensively within the library. Should we try to have it included in the v2.x core or is Arduino.h capable of replacing its functionality?

Cheers,
Adam

ISBD_PROTOCOL_ERROR - More details?

Hi @PaulZC,

I've been dealing with the dreaded "ISBD_PROTOCOL_ERROR" error recently with a RockBLOCK 9603, and I'm curious, is there a way to dig deeper into the IridiumSBD library to actually determine what's happening when presented with this error? Looking at the code, it appears to be somewhat of a catch-all error return code for a wide range of functions.

Hmm, I do notice that it is most commonly associated with !waitForATResponse. I wonder if it my issue coudl be AT timeout-related. The RockBLOCK is powered directly by a 3.7 V LiPo and the supercapacitors are constantly charged, so everything should be snappy.

Cheers,
Adam

No need to remove unused data after a Wire.requestFrom().

In the file "IridiumSBD.cpp", currently at line 1403, there is this code:

while (wireport->available())
{
  wireport->read(); // Mop up any unexpected bytes
}

That code can be removed, since the Wire library uses packages of data and not a stream of data. There is no need to remove unused data.

Explanation: Common-mistakes#4

In the code above that, is this:

wireport->requestFrom((uint8_t)deviceaddress, 2); // Request two bytes
if (wireport->available() >= 2)

The peripheral can not send less or more. There is no need to allow that it is higher than 2.
If two bytes are requested, then test for two bytes:

if (wireport->available() == 2)

Sleep Pin (on/off control) in RockBLOCK 9603 v3.F

Due to supply-chain shortage, some components in RockBLOCK 9603 3.F have been replaced with alternatives. This does not adversely affect the normal operation of the device.

Because of these component changes, 3.F now includes a transistor circuit on the On/Off control pin to ensure correct power up at all supply voltages. The On/Off control pin should not be clamped below the RockBLOCK supply voltage and should be disconnected/left floating to turn on.

Potential issue:
This change has introduced an issue when interfacing directly to a 3V3 microcontroller pin while supplying the RB with 5V. The new On/Off circuitry now provides a high impedance (1Meg resistor) to the super cap voltage, equal to the supplied voltage. This may exceed the maximum IO voltage of the micro.

If the RB was supplied by 5V, the connecting device should also be 5V tolerant. If not, it is recommended to use an interfacing circuit, eg MOSFET, transistor, relay, etc. to connect to a microcontroller.

More info:

https://docs.rockblock.rock7.com/docs/power-supply#onoff-control

Feature request: adjustStartupTimeout()

Hi @PaulZC,

I've found myself on several occasions needing to decrease the value of ISBD_STARTUP_MAX_TIME from 240 seconds to something shorter for testing or other purposes. This usually involves going in and modifying the library directly, but I was thinking that it could be useful to have a function that could set this timeout value directly.

Please let me know what you think! Happy to whip up a PR.

Cheers,
Adam

Arduino Compile Errors for SAMD51 - Adafruit Itsybitsy M4

I am trying to use the I2C Iridium modem with an Itsybitsy M4.

I am getting compile errors for the library attributed to SAMD51 problems. Help?

Arduino: 1.8.13 (Mac OS X), Board: "Adafruit ItsyBitsy M4 (SAMD51), Enabled, 120 MHz (standard), Small (-Os) (standard), 50 MHz (standard), Arduino, Off"

.../Documents/Arduino/libraries/SparkFun_IridiumSBD_I2C_Arduino_Library-master/src/IridiumSBD.cpp: In member function 'int IridiumSBD::getSystemTime(tm&)':
.../Documents/Arduino/libraries/SparkFun_IridiumSBD_I2C_Arduino_Library-master/src/IridiumSBD.cpp:237:14: error: aggregate 'tm epoch_start' has incomplete type and cannot be defined
  237 |    struct tm epoch_start;
      |              ^~~~~~~~~~~
...Documents/Arduino/libraries/SparkFun_IridiumSBD_I2C_Arduino_Library-master/src/IridiumSBD.cpp:257:24: error: 'mktime' was not declared in this scope; did you mean 'mktemp'?
  257 |    time_t epoch_time = mktime(&epoch_start);
      |                        ^~~~~~
      |                        mktemp
.../Documents/Arduino/libraries/SparkFun_IridiumSBD_I2C_Arduino_Library-master/src/IridiumSBD.cpp:259:16: error: 'localtime' was not declared in this scope
  259 |    memcpy(&tm, localtime(&now), sizeof tm);
      |                ^~~~~~~~~
.../Documents/Arduino/libraries/SparkFun_IridiumSBD_I2C_Arduino_Library-master/src/IridiumSBD.cpp:259:40: error: invalid application of 'sizeof' to incomplete type 'tm'
  259 |    memcpy(&tm, localtime(&now), sizeof tm);
      |                                        ^~
exit status 1
Error compiling for board Adafruit ItsyBitsy M4 (SAMD51).


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Receive Data

To receive data, the method is send a blank MO message, with this method(blank message), it will not consuming the credits,
but sometimes with same syntax, it send non-empty message, so it consuming the credits,
i dont know why it sometimes send blank message, and sometimes send non-blank message

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.