Skip to content

Latest commit

 

History

History
337 lines (226 loc) · 24.8 KB

RockBLOCK.md

File metadata and controls

337 lines (226 loc) · 24.8 KB

Tracking Your Beacon via the RockBLOCK Gateway

The Iridium 9603N Beacon can be used to track high altitude balloons and other mobile assets. To the best of my knowledge, it hasn't yet been used to track an elephant. But who knows! Time will tell...

I have used Iridium 9603N modules provided by other suppliers, but I recommend Rock7 since:

  • They provide excellent customer support and rapid answers to technical queries
  • Their web portal is really easy to use
  • You can top up message credits and the monthly line rental for your modules by credit card (you don't need to set up a monthly 'standing order' payment)
  • They won't charge you line rental for months where you don't make use of your 9603N module
  • They provide message forwarding via their RockBLOCK Gateway which you can use to track your beacon(s) from anywhere using another beacon as a 'base'

RockBLOCK_Operations_1

Rock7 also provide the excellent RockBLOCK, RockSTAR, RockFLEET and are responsible for YB (Yellow Brick).

The beacon will send Short Burst Data messages containing its location, speed, heading, altitude, pressure and other data every five minutes by default. Each message is automatically forwarded to whatever email address(es) you add to RockBLOCK Operations. You can simply read the email message contents and copy and paste the position (latitude and longitude) into (e.g.) Google Maps to show where your beacon is located:

RockBLOCK_Message

RockBLOCK_Operations_3

If you have an internet connection and you want to use these emails to display the location and route of your beacon(s) on a map, you can do this using the Iridium_Beacon_GMail_Downloader_RockBLOCK.py and Iridium_Beacon_Mapper_RockBLOCK.py mapping software described below.

Beacon with Internet

If you want to be able to track your beacon(s) from somewhere without an internet connection, you can use another beacon as a base, use the RockBLOCK Gateway to automatically forward messages from your mobile beacon(s) to the base, and then display the location and route of your beacon(s) on a map using the Iridium_Beacon_Base.py mapping software described below. Map tiles for your destination can be downloaded before your travel.

Beacon without Internet

Vector graphics by Alice Clark

Message delivery via an HTTP post is possible too but, as I find email easier to work with, I won't discuss HTTP options further here.

Configuring your Beacon via RockBLOCK Operations

The beacon uses flash memory inside the ATSAMD21G18 processor to store several settings. As flash memory is non-volatile, the settings are not forgotten if the beacon loses power or is reset. The settings are:

  • INTERVAL: the (minimum) interval between message transmissions. By default, this is set to 5 minutes
  • RBDESTINATION: the serial number of the destination RockBLOCK for messages forwarded via the RockBLOCK Gateway. By default, this is set to zero which disables message forwarding
  • RBSOURCE: the RockBLOCK serial number of the 9603N module on the beacon. By default, this is set to 1234 as it is not required unless you want to use message forwarding to an Iridium Becon Base

If you want to change the beacon transmission interval during a flight, you can do this through RockBLOCK Operations using the Send a Message function. Select the RockBLOCK serial numbers of the beacon(s) you want to update and send a plain text message using the format [INTERVAL=nnn] where nnn is the new message interval in minutes. The interval will be updated the next time the beacon wakes up for a transmit cycle.

RockBLOCK_Operations_4

If you want to enable message forwarding via the RockBLOCK Gateway, you can do this by including the text [RBDESTINATION=nnnnn] in the RockBLOCK message where nnnnn is the serial number of the destination 'base' RockBLOCK. You can disable message forwarding again by sending a message containing [RBDESTINATION=0]. You can change the source serial number which is included in the messages by including the text [RBSOURCE=nnnnn] in the RockBLOCK message where nnnnn is the serial number of the RockBLOCK 9603N on the beacon.

The Send a Message function can also be used to control the beacon. The commands are:

  • RELAY: this controls the OMRON relay on the beacon. The relay can be switched ON or OFF, or pulsed on for 1-5 seconds
  • RADIO: this allows you to send a radio message from the beacon using the optional Iridium Beacon Radio Board

If you want to change the state of the OMRON relay during a flight, you can do this by including the text [RELAY=ON] or [RELAY=OFF] in the RockBLOCK message. The state of the relay will be updated after the next transmit cycle. If you want to pulse the relay on for 1-5 seconds, to trigger e.g. a cut-down device, include the text [RELAY=1] to pulse the relay on for 1 second then off again. [RELAY=5] will pulse the relay on for five seconds then off again. Only integer pulse durations of 1-5 seconds are valid, other values will be ignored.

If you want to send a message via the radio board, you can do this by including the text [RADIO=nnnnnnnn] in the RockBLOCK message where nnnnnnnn is the message you want the eRIC radio module to transmit (e.g. the serial number of a radio-enabled cut-down device, causing it to activate). The radio board is optional, the beacon code will work as normal without it.

The beacon can also be configured and controlled via messages from an Iridium Beacon Base.

Tracking your beacon with an internet connection

Beacon with Internet

Mapper

If you will be tracking your Iridium Beacon from somewhere with a good internet connection, then you can use:

Iridium_Beacon_GMail_Downloader_RockBLOCK.py to check for new SBD messages and download them from a Google GMail account using the Google Mail API.

Create yourself a GMail address, follow these instructions to create your credentials and enable access for Python, add the email address to RockBLOCK Operations, then when you run the code it will automatically check for the arrival of any new messages and, when it finds one, will download the SBD .bin attachment to to your computer, mark the message as seen (read) and 'move' it to a folder called SBD by changing the message labels. You will need to manually create the SBD folder in GMail before running the code.

RockBLOCK_Operations_2

Iridium_Beacon_Mapper_RockBLOCK.py uses the Google Static Maps API to display the locations and paths of up to eight beacons. It will check once per minute for the appearance of new .bin files, parse them and display the data in a Python Tkinter GUI.

You will need to download the blank map image too. This is displayed until a .bin file is processed or whenever the GUI isn't able to download map images from the API.

You can find more details about the Google Static Maps API here. To use the API, you will need to create your own API Key, which you can do by following the instructions here. Copy the Key and save it in a file called Google_Static_Maps_API_Key.txt so the mapper can read it. You will need to register payment details with Google before they will issue you with a Key, but the Standard Plan allows you to download 25,000 map images per day for free before you start being charged.

The intention is that you have Iridium_Beacon_Mapper_RockBLOCK.py and Iridium_Beacon_GMail_Downloader_RockBLOCK.py running simultaneously. Start Iridium_Beacon_Mapper_RockBLOCK.py first and allow it to build up a dictionary of any existing .bin files, then start Iridium_Beacon_GMail_Downloader_RockBLOCK.py. When any new SBD messages arrive in your GMail inbox, the attachments will be downloaded and then added to the map automatically.

The displayed map is automatically centered on the position of a new beacon. The center position can be changed by left-clicking in the image. A right-click will copy that location (lat,lon) to the clipboard. The zoom level defaults to '15' but can be changed using the zoom buttons.

A pull-down menu lists the latest locations of all beacons being tracked. Click on the entry for a beacon to center the map on its location and copy its location to the clipboard.

The beacon's path is displayed as a coloured line on the map. The oldest waypoints may not be shown as the map URL is limited to 8192 characters.

The GUI uses 640x480 pixel map images. Higher resolution images are available if you have a premium plan with Google.

The GUI has been tested with Python 2.7 on 64-bit Windows and on Linux on Raspberry Pi. You will need to install the Python libraries listed below.

Tracking your beacon without an internet connection

Beacon without Internet

Iridium_Beacon_Base_2

Another reason I really like Rock7 is that if you prefix your SBD message with the serial number of another 'RockBLOCK', they will automatically forward your message to that module. This means the messages from your mobile Iridium Beacon can be automatically forwarded to another Iridium Beacon acting as a 'base' allowing you to track the beacon from anywhere. See the last two pages of the RockBLOCK-9603-Developers-Guide for further information.

In the Arduino directory, you will find Arduino code for both the mobile Iridium9603NBeacon_V5 and the base Iridium9603NBeacon_V5_Base.

Connect the Iridium Beacon Base directly to your computer using a USB cable (as if you were going to configure it using the Arduino IDE). The Beacon Base does not need batteries, it will draw all of its power from the USB port. The Base Python software has been tested on both a Windows laptop and Raspberry Pi.

To enable message forwarding from beacon to base, you can:

To enable message forwarding in the Arduino code: edit Iridium9603NBeacon_V5.ino, and change the line which says #define RB_destination 0 . Change the zero to the the serial number of the destination RockBLOCK which is acting as the base. Also change the line which says #define RB_source 1234 . Replace the 1234 with the serial number of the RockBLOCK 9603N you are sending the messages from.

You will be charged twice for each message: once to send it from the Beacon (Mobile Originated); and a second time to receive it on the base (Mobile Terminated).

Before you travel, download a set of Google Static Map tiles using Google_Static_Maps_Tiler.py. 1 degree tiles are useful for large areas, 0.1 degree or 0.01 degree for smaller areas. Put all the StaticMapTile----.png files in the same directory as Iridium_Beacon_Base.py. By default, the Tiler will ask Google for roadmap map_type images. You can change this to satellite, terrain or hybrid by editing the Python code before you run it.

Iridium_Beacon_Base.py is very similar in its operation to Iridium_Beacon_Mapper_RockBLOCK.py except that the beacon data is received via Iridium rather than by email. The software talks to Iridium9603NBeacon_V5_Base via Serial (over USB) and displays the beacon and base locations using the Google Static Maps API.

To use the Google Maps API, you will need to create your own API Key, which you can do by following the instructions here. Copy the Key and save it in a file called Google_Static_Maps_API_Key.txt so the mapper can read it. You will need to register payment details with Google before they will issue you with a Key, but the Standard Plan allows you to download 25,000 map images per day for free before you start being charged.

Before running the Iridium_Beacon_Base.py code, plug the Iridium Beacon Base into your computer and find out its serial port number:

  • Under Windows, you can run Device Manager from the Control Panel or using the search tool (magnifying glass). Open the entry for Ports (COM & LPT). The base will be listed as a COM port
  • Under Linux (e.g. on Raspberry Pi), you can find the port number by typing ls /dev in a terminal window. The base will usually appear as /ttyACM0

Every 'update' seconds the GUI talks to the base beacon and:

  • requests its GNSS data including time, position and altitude;
  • starts an IridiumSBD session and downloads a packet from the mobile terminated queue (if any are present).

The GUI and base provide access to the RockBLOCK FLUSH_MT function, so an excess of unread Mobile Terminated messages from your beacon(s) can be discarded if required (note that you are still charged from these messages!).

The software logs all received packets to CSV log files. Each beacon gets its own log file.

The software makes extensive use of the Google Static Map API:

  • The displayed map is automatically centered on a new beacon position.
  • The center position can be changed by left-clicking in the image.
  • A right-click will copy the click location (lat,lon) to the clipboard.
  • The zoom level is set automatically when a new beacon is displayed to show both beacon and base.
  • The zoom can be changed using the buttons.

When you are online, the path of each beacon is displayed as a coloured line on the map. The oldest waypoints may be deleted as the map URL is limited to 8192 characters.

A pull-down menu lists the locations of all the beacons being tracked. Clicking on a menu entry will center the map on that location and will copy the location to the clipboard.

A second pull-down menu shows the location of the base. Clicking it will center the map on that location and will copy that location to the clipboard.

A third pull-down menu lets you send a configuration update message to a beacon. See Configuring your Beacon via Iridium Beacon Base for further details.

A fourth pull-down menu lets you set the update interval of the base software. You are charged each time you check for new messages, so make sure you set update to a sensible value. If your beacon is transmitting messages every 10 minutes, then set the update interval to 10 minutes too. If there is a backlog of messages you want to download, then reduce update accordingly. But remember to set it back to 10 minutes afterwards to avoid being charged unnecessarily. If you are tracking two beacons each sending messages every 10 minutes, then set update to 5 minutes.

The GUI uses 640x480 pixel map images. Higher resolution images are available if you have a premium plan with Google.

When you are online, the user interface will look like this:

Iridium_Beacon_Base_1

When you are offline, the software will use the map tiles from the Tiler. Base and beacon locations will be shown on the offline maps but not path information

Iridium_Beacon_Base_2

Configuring your Beacon via Iridium Beacon Base

Iridium_Beacon_Base.py has a pull-down menu which allows you to send a message to one of your beacons so you can control or configure it.

Iridium_Beacon_Base_3

By default, RBDESTINATION is set to zero in the Iridium Beacon code which disables message forwarding. To enable message forwarding, we need to change the RBDESTINATION to the RockBLOCK serial number of the Iridium Beacon Base. Messages from the beacon will then be sent by email as usual, but also automatically forwarded via a second Iridium message to the base so the base can track the beacon. You are charged for both messages.

If the base software is not currently tracking any beacons, the Beacon Messaging pull-down menu will only contain a dummy entry for RB0000000. Click on that entry and a dialogue box will appear containing the text RB0000000[INTERVAL=5]. Delete all of the text and replace it with:

  • RBxxxxx[RBDESTINATION=yyyyy][RBSOURCE=xxxxx]

where

  • xxxxx is the RockBLOCK serial number of the 9603N on the beacon
  • yyyyy is the RockBLOCK serial number of the 9603N on the base

and then click OK.

Make sure you include the square brackets. Any commands not enclosed in square brackets are ignored.

The message will be sent from the 9603N on the base, through the Iridium network to the RockBLOCK Gateway. The RockBLOCK Gateway will then automatically forward the message back through the Iridium network to beacon xxxxx. Beacon xxxxx will receive the new RBDESTINATION and RBSOURCE the next time it wakes up and transmits a fix.

Now, each time beacon xxxxx sends a message, it will be automatically prefixed with the serial number of the base (RByyyyy) and forwarded to the base through the RockBLOCK Gateway.

Once the base software has received a message from beacon xxxxx, its serial number will appear in the Beacon Messaging pull-down menu to make it easier to send more messages to that beacon.

If you want to disable message forwarding, send a message to beacon xxxxx containing the text:

  • RBxxxxx[RBDESTINATION=0]

If you want to change the message interval of a beacon, send it a message containing:

  • RBxxxxx[INTERVAL=nnn]

where

  • nnn is the new message interval in minutes

Valid values are 1 to 1440 (once per minute to once per day). The beacon will download and process the message during its next transmit cycle. The new interval will take effect after the following transmission.

If you want to change the status of the OMRON relay on board the beacon, add the text [RELAY=ON] or [RELAY=OFF] to the message. If you want to pulse the relay on for 1-5 seconds, to trigger e.g. a cut-down device, add the text [RELAY=1] to pulse the relay on for 1 second then off again. [RELAY=5] will pulse the relay on for 5 seconds then off again. Only integer pulse durations of 1-5 seconds are valid, other values will be ignored. The relay status will be updated at the end of the beacon's transmit cycle.

If you want the (optional) radio board to transmit a message, add the text [RADIO=nnnnnnnn] to the message, where nnnnnnnn is the message you want the radio board to transmit. Usually nnnnnnnn is the serial number of the eRIC radio module on a cut-down device.

Extras

Iridium_Beacon_Stitcher_RockBLOCK.py will stitch the .bin SBD attachments downloaded by Iridium_Beacon_GMail_Downloader_RockBLOCK.py together into a single .csv (Comma Separated Value) file which can be opened by (e.g.) Microsoft Excel.

Iridium_Beacon_CSV_DateTime.py will convert the first column of the stitched .csv file from YYYYMMDDHHMMSS format into DD/MM/YY,HH:MM:SS format, making the message timing easier to interpret using Excel.

Iridium_Beacon_DateTime_CSV_to_KML_RockBLOCK.py will convert the .csv file produced by Iridium_Beacon_CSV_DateTime.py into .kml files which can be opened in Google Earth. The path of the beacon can be shown as: 2D (course over ground) or 3D (course and altitude) linestring; points (labelled with message sequence numbers); and arrows (indicating the heading of the beacon).

Iridium_Beacon_BIN_to_KML_RockBLOCK.py will convert the individual .bin SBD attachments downloaded by Iridium_Beacon_GMail_Downloader_RockBLOCK.py into .kml files which can be opened in Google Earth. The path of the beacon can be shown as: 2D (course over ground) or 3D (course and altitude) linestring; points (labelled with message sequence numbers); and arrows (indicating the heading of the beacon).

Iridium_Beacon_habhub_habitat_uploader_RockBLOCK.py will parse the data in the .bin SBD attachments downloaded by Iridium_Beacon_GMail_Downloader_RockBLOCK.py and upload the data to the excellent HabHub Habitat Tracker. Start the uploader first and allow it to build up a list of any existing SBD .bin files, then start the GMail_Downloader. When any new SBD messages arrive in your GMail inbox, they will be downloaded and then uploaded to habitat automatically. You will find the lines that actually upload the data to Habitat are commented out. Only uncomment them once you have registered your flight with UKHAS and are ready to upload real data.

Required Python 2.7 Libraries

To get the tools to run successfully you will need to install the following libraries:

GMail API and oauth2client

  • pip install --upgrade google-api-python-client oauth2client

PIL ImageTk

  • sudo apt-get install python-pil.imagetk

Matplotlib

  • sudo apt-get install python-matplotlib

Kyle Lancaster's simplekml

CouchDB

  • pip install couchdb

or

CRCMOD

  • pip install crcmod

or

Enjoy!

Paul