M37-Skillbuilder_iridium

If you’re old enough to remember the pre-cellphone era, you’ve probably already heard of Iridium (the company, not the chemical element). Deployment of the Iridium satellite constellation began in the early 1990s and, by the time the company launched its globe-spanning consumer satellite phone service in late 1998, had cost an estimated $5 billion.

It was a disaster. Phones were expensive, bulky, and unreliable compared to ground-based cell services. Iridium LLC filed for Chapter 11 bankruptcy less than a year later and, in 2001, the satellite constellation and other assets were sold off for a scant $25 million. At one point, there was serious talk of deorbiting the entire fleet of satellites to prevent them becoming hazardous space junk.

Given all that, you may be surprised to hear that the Iridium network is still up and running. You may be even more surprised to hear that plans are underway to launch a second-generation Iridium constellation, starting in 2015, called Iridium NEXT. And whatever the fate of that venture may be, the original satellites are expected to remain in service until the 2020s.

FUN FACT: There are almost 100 Iridium satellites in low orbit. Each has three large polished flat antennae, which frequently reflect fast-moving spots of sunlight onto an area of Earth’s surface about 16 km2. These “flares” are easily visible to the naked eye, and are entirely predictable. To find out when the next one will happen near you, visit heavens-above.com.

Makers Take Over

Though the U.S. Department of Defense remains a major user of the Iridium network, the big fizzle of the company’s original world-spanning private satphone service has resulted in a surplus of unused bandwidth spinning, quite literally, right over our heads. It’s a buyer’s market, and the tech to access it is now trickling down to hobbyists and entrepreneurs.

The RockBlock Naked Iridium modem costs about $250 (plus small monthly access and data charges) and lets you communicate with your project, through the web, anywhere on the surface of the planet you can get 100mA at 5V DC.
The RockBlock Naked Iridium modem costs about $250 (plus small monthly access and data charges) and lets you communicate with your project, through the web, anywhere on the surface of the planet you can get 100mA at 5V DC.

British developer Rock Seven Mobile, for instance, recently introduced an Arduino-compatible Iridium satellite transceiver called RockBlock (above). It can’t make real-time voice phone calls, but it can send “text messages” using Iridium’s short burst data (SBD) service. Outgoing messages of up to 340 bytes can be directed to an email address or a web server as an HTTP post. Incoming messages are limited to 270 bytes and can be received through the same channels.

RockBlock modems are being installed in high-altitude balloons, free-drifting ocean buoys, autonomous boats, and fixed-wing drone gliders, just to name a few. Connected to a low-cost GPS module, an AVR microcontroller, and a power source, the RockBlock becomes a global tracking device. As long as the power supply holds out and the antennae can see the sky, you can track this stack of circuit boards anywhere it goes, anywhere in the world, from anywhere you can access the web.

Getting Started

Follow the bundled instructions to set up your RockBlock account, then connect the modem to your Arduino, and your Arduino to your GPS module, as shown in Figure B.

Each RockBlock ships with a 10-pin JST-terminated cable that snaps onto the board and exposes the various signal lines client devices can connect to. The simplest setup, shown here, is what Iridium calls a “3-wire” TTL serial interface, with signal lines for TX, RX, and Sleep. (To connect your Arduino and GPS as shown, see page 59.)
Each RockBlock ships with a 10-pin JST-terminated cable that snaps onto the board and exposes the various signal lines client devices can connect to. The simplest setup, shown here, is what Iridium calls a “3-wire” TTL serial interface, with signal lines for TX, RX, and Sleep. (To connect your Arduino and GPS as shown, see Finding Your Way with GPS.)

Grab the sketch GlobalBeacon.ino below, download the IridiumSBD library, plug in your Arduino, and upload the code.

#include <IridiumSBD.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h> // NMEA parsing: http://arduiniana.org
#include <PString.h> // String buffer formatting: http://arduiniana.org

#define BEACON_INTERVAL 3600 // Time between transmissions
#define ROCKBLOCK_RX_PIN 18
#define ROCKBLOCK_TX_PIN 19
#define ROCKBLOCK_SLEEP_PIN 10
#define ROCKBLOCK_BAUD 19200
#define GPS_RX_PIN 3
#define GPS_TX_PIN 4
#define GPS_BAUD 4800
#define CONSOLE_BAUD 115200

SoftwareSerial ssIridium(ROCKBLOCK_RX_PIN, ROCKBLOCK_TX_PIN);
SoftwareSerial ssGPS(GPS_RX_PIN, GPS_TX_PIN);
IridiumSBD isbd(ssIridium, ROCKBLOCK_SLEEP_PIN);
TinyGPSPlus tinygps;

void setup()
{
  // Start the serial ports
  Serial.begin(CONSOLE_BAUD);

  // Setup the RockBLOCK
  isbd.attachConsole(Serial);
  isbd.attachDiags(Serial);
  isbd.setPowerProfile(1);
}

void loop()
{
  bool fixFound = false;
  unsigned long loopStartTime = millis();

  // Step 0: Start the serial ports
  ssIridium.begin(ROCKBLOCK_BAUD);
  ssGPS.begin(GPS_BAUD);

  // Step 1: Reset TinyGPS++ and begin listening to the GPS
  Serial.println("Beginning to listen for GPS traffic...");
  tinygps = TinyGPSPlus();
  ssGPS.listen();

  // Step 2: Look for GPS signal for up to 7 minutes
  for (unsigned long now = millis(); !fixFound && millis() - now < 7UL * 60UL * 1000UL;)
    if (ssGPS.available())
    {
      tinygps.encode(ssGPS.read());
      fixFound = tinygps.location.isValid() && tinygps.date.isValid() &&
        tinygps.time.isValid() && tinygps.altitude.isValid();
    }

  Serial.println(fixFound ? F("A GPS fix was found!") : F("No GPS fix was found."));

  // Step 3: Start talking to the RockBLOCK and power it up
  Serial.println("Beginning to talk to the RockBLOCK...");
  ssIridium.listen();
  if (isbd.begin() == ISBD_SUCCESS)
  {
    char outBuffer[60]; // Always try to keep message short
    if (fixFound)
    {
      sprintf(outBuffer, "%d%02d%02d%02d%02d%02d,",
        tinygps.date.year(), tinygps.date.month(), tinygps.date.day(),
        tinygps.time.hour(), tinygps.time.minute(), tinygps.time.second());
      int len = strlen(outBuffer);
      PString str(outBuffer, sizeof(outBuffer) - len);
      str.print(tinygps.location.lat(), 6);
      str.print(",");
      str.print(tinygps.location.lng(), 6);
      str.print(",");
      str.print(tinygps.altitude.meters());
      str.print(",");
      str.print(tinygps.speed.knots(), 1);
      str.print(",");
      str.print(tinygps.course.value() / 100);
    }
    else
    {
      sprintf(outBuffer, "No GPS fix found!");
    }

    Serial.print("Transmitting message: ");
    Serial.println(outBuffer);
    isbd.sendSBDText(outBuffer);
  }

  // Sleep
  Serial.println("Going to sleep mode for about an hour...");
  isbd.sleep();
  ssIridium.end();
  ssGPS.end();
  int elapsedSeconds = (int)((millis() - loopStartTime) / 1000);
  while (elapsedSeconds++ < BEACON_INTERVAL)
    delay(1000);
}

GlobalBeacon.ino

You’ll probably need to take everything outside to get a GPS fix and an Iridium link. Open the Arduino IDE’s Serial Monitor window at 115,200 baud and follow along as the code first establishes a GPS fix, then uploads it to the Iridium network, then puts the hardware into low-power “sleep” mode. Left alone, it will “wake up” every hour and repeat this process. Log on to the Rock Seven web portal to read the received messages and set up message handlers.

Going Further

This is just a simple proof-of-concept system powered by the USB connection. The first step toward a real-world application would likely be untethering it from your computer, perhaps with an off-the-shelf USB external battery pack or solar charger.

Don’t forget that the RockBlock can both send and receive messages, opening up a world of possibilities beyond basic tracking and monitoring apps. Want a robot that travels to some remote location, reports back on conditions there, and waits for instructions on how to proceed? This technology makes it not just possible to do that, but relatively cheap and easy. The sky — quite literally — is the only limit.