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! Same is true in the virtual (or software) world.
In this article, we will connect a tracking device manufactured by Galileosky in Russia, to the US-based Amazon Web Services through the flespi platform developed in Belarus.
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 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:
- 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 out Galileosky tracker in the flespi platform, most setup will take place on the Amazon side. Open AWS IoT section of the AWS console. To configure a valid entry point for 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.
2. Create, download, and activate certificate
- select One-click certificate creation
- download and save
thing-private.pem.key certificates to later use for MQTT stream setup
- activate the certificate in one click
3. Create a policy
AWS policies allow to manage permissions for different things. We can simply grant full permissions for testing purposes. It looks like:
4. Attach thing and policy to the 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.
Setting up AWS_IoT stream for flespi device
Now we’ve got everything to set up an AWS stream for our flespi device:
- fill in
thing-certificate.pem.crt downloaded at step 2 above
- fill in the endpoint (see AWS IoT settings)
- fill in
thing-private.pem.key downloaded at step 2 above
- [optional] fill in MQTT topic for messages from given device (without topic no messages will be delivered)
- [optional] add thing_name to AWS stream configuration. This will update the thing’s shadow in AWS IoT.
If done right, you will see the updated thing shadow and will be able to subscribe to 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.
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:
The list of possible actions is long, so you can write very flexible and specific 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 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.