16 October, 2017

Taking telematics to the cloud: Galileosky data on Amazon servers

We took a Galileosky tracker and used flespi to push its telemetry into AWS IoT cloud. Now the world-class services are available to store, process, analyze, and leverage these data.

We have a generic "flespi to AWS" knowledgebase article with detailed step-by-step instructions on establishing the communication between the platforms.

The modern industrial world is getting highly specialized — companies hone in their expertise based on core competencies and outsource the rest. You can hardly expect any complex product to originate from a single manufacturer. The Boeing 787’s 2.3 million parts come from 5400 suppliers around the globe! The same is true in the virtual (or software) world.

In this article, we will connect a tracking device manufactured by Galileosky to the Amazon Web Services via the flespi platform.

But before we go any further, let’s clarify why we need this. Think of the standard features of a modern telemetry device:

  • reliable hardware (a set of internal sensors and battery, precise GPS, stable connection);
  • multiple connectivity options to support third-party sensors: RS-485, Modbus, 1-wire, USB, CAN, regular input-output ports;
  • blackbox to store device telemetry for several months in case tracker goes offline;
  • endurance in extreme conditions from -50ºC (-58F) in the snows of Alaska to +60ºC (140F) and more on the roads of Dubai.
  • remote device configuration tool

The above set of requirements is not abstract — it is a partial tech-specs list for Galileosky devices. Yesterday’s unique and advanced features are the must-have of today. And proactive companies are on the look-out for new goodies that will impress the customers tomorrow. One of the promising directions for GPS hardware manufacturers is integrability into third-party platforms.

We have already written how to connect flespi instances to the Amazon Web Services IoT hub. But we haven’t covered the advantages of using AWS. Here are the perks that Amazon cloud can add to your tracker’s functionality:

  • cheap long-term storage (0.0235$ per 1GB for backup files in Amazon S3 bucket)
  • table-view of message parameters with a handy view and sorting features of AWS DynamoDB
  • email alerts based on telemetry values with AWS SQS (Simple Queue Service)
  • push service for any mobile OS to report irregular situations (with AWS Simple Push Service)
  • real-time analytics of telemetry data in Amazon Elasticsearch Service using Big Data algorithms
  • the computing power of AWS Lambda
  • monitoring scenarios with Amazon CloudWatch system

Now, let’s start connecting a Galileosky device to AWS. To make it more exciting, consider the following scenario. We have a remote server-room, where we are going to set up access control and temperature monitoring. We install there a Galileosky tracker with a 1-wire temperature sensor and iButton lock. What advantages can we get from the Galileosky → flespi → AWS union?

Getting a tracker into flespi platform

The overall goal here is to connect a physical Galileosky tracker to the flespi platform via a channel over the galileosky protocol. Use the flespi panel to walk through the next actions:

  • create a channel working over galileosky protocol
  • create a new flespi device which will be a virtual representation of the physical tracker within the platform; pick the previously created channel from the drop-down list; take the tracker’s unique ident value from the label at the bottom of the device:
    galileo_imei.jpg
  • create a stream over aws_iot protocol to forward telemetry data to the AWS IoT cloud. We will fill in the Configuration tab for the stream at a later stage.

See a more detailed step-by-step guide with screenshots in a flespi test drive article (or Youtube videos).

Setting up flespi stream to AWS IoT

Now that we have the avatar of our Galileosky tracker in the flespi platform, most setup will take place on the Amazon side. Open the AWS IoT section of the AWS console. To configure a valid entry point for the MQTT stream from flespi follow these steps:

1. Register a thing

Click Register a thing button on the Manage things tab and type a thing name.

register thing aws iot flespi

2. Create, download, and activate certificate

  • select One-click certificate creation
  • download and save thing-certificate.pem.crt and thing-private.pem.key certificates to later use for MQTT stream setup
  • activate the certificate in one click

create, download, activate aws iot certificate flespi

3. Create a policy

AWS policies allow managing permissions for different things. We can simply grant full permissions for testing purposes. It looks like:

{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"iot:Publish",
"iot:Subscribe",
"iot:Connect",
"iot:Receive"
],
"Effect": "Allow",
"Resource": "*"
}
]
}

create policy in aws

4. Attach thing and policy to the certificate

attach thing and policy to aws certificate

NOTE: there is a shortcut for the above four steps. You can simply click the Onboard tab and select Get started button in Configuring a device section. Then follow intuitive steps to have your device set up.
shortcut connect to aws iot

Setting up AWS_IoT stream for flespi device

Now we’ve got everything to set up an AWS stream for our flespi device:

  1. fill in thing-certificate.pem.crt downloaded at step 2 above
  2. fill in the endpoint (see AWS IoT settings)
  3. fill in thing-private.pem.key downloaded at step 2 above
  4. [optional] fill in MQTT topic for messages from the given device (without topic no messages will be delivered)
  5. [optional] add thing_name to AWS stream configuration. This will update the thing’s shadow in AWS IoT.

galileosky endpoint setup flespi panel

If done right, you will see the updated thing shadow and will be able to subscribe to the MQTT topic from your device. Now you can see all Galileosky device parameters in the thing shadow and read live messages by subscription to the MQTT topic.

galileosky device parameters mqtt topic

Configuring rules in AWS

Now let’s set up some notifications for our server monitoring device. This is how to set up rule specification with AWS SQL-like language:

configuring rules in aws iot

The list of possible actions is long, so you can write very flexible and specific rules:

list of actions for aws rules

For testing let’s pick SQS (Simple Queue Service) — it allows setting up simple messages queue in a couple of clicks and receiving live messages if the rule triggers. We’ll use the following SQL-like rule to monitor our server room ibutton access:

SELECT ibutton_code_1 AS ibutton FROM 'server_room1' WHERE ibutton_code_1 <> 164446398 AND ibutton_code_1 <> 0

Where 164446398 is allowed code and 0 is a default value if no keys were used (for regular messages). “<>” is a NOT EQUAL sign. It is possible to use many operations in SQL-like rules; the full list is available in AWS documentation.

Conclusions and benefits

As a result, we can conclude that a high-level solution based on high-quality Galileosky hardware with popular and flexible Amazon Web Services through the flespi platform takes just mouse clicks and a few fast and clear operations.

More broadly this case illustrates how flespi helps eliminate boundaries for hardware manufacturers:

  • Galileosky can now attract clients who opt for AWS IoT platform as their preferred telematics data collection and analytics tool;
  • no programming efforts are required on the manufacturer’s side — flespi supports galileosky protocol and establishes a connection with the tracker in a matter of seconds;
  • integration of standard GPS trackers into IoT platforms (in our case AWS IoT cloud) takes minutes opening new markets for telematics service providers.

Stay tuned for more practical cases. Use us to open new horizons for your business.