Predix is GE’s application platform for the Industrial Internet. Built on Cloud Foundry, Predix is optimized for secure connectivity and analytics at scale - in the Cloud and on the Edge.
On a sunny day in Cheltenham, England, three Predix developers from GE Aviation (myself Peter Belcher, Andrew Moffat and Sebastian Belcher) set ourselves a challenge; hooking up a Raspberry Pi to Predix and letting the data flow!
The aim of the activity was to build an understanding of how to complete one of the most fundamental uses cases; reading data from a file system and flowing that data into Predix without the need for manual intervention.
The good news is that we were able to get it working; we learned some interesting results and would like to share them with you!
The solution and its parts
The solution comprised of several components including: Predix’s User Account and Authentication and Time Series services, java app, python temperature data collector, a Raspberry Pi B+ model running the Predix Machine OSGI container, an OTS DHT11 temperature sensor and a web dashboard hosted as a standalone Predix app.
The Predix Services
The foundation of our app comprised the Predix services that, based on the Predix architecture, allow you write once and deploy on multiple devices as we proved.
Pretty much any Predix service you want to consume requires the use of the User Account & Authentication Service (UAA), and it is CRITICAL that any app you are making uses it. Because the Predix cloud is globally accessible, any data you store needs to be appropriately secured. The UAA documentation goes into this in great detail, and you can bind multiple apps to the single service if you wish.
In order to store the data that was being extracted from the PI, the Time Series Service is a perfect candidate. Already offered as a service, once you have authentication to the service set up within an app (the data pusher app in our case), you can start sending JSON!
The Time Series service uses attributes (‘tags’) within your service datastore to identify your data, so any data that is sent should also be tagged to make it easier to retrieve / analyze / slice in future. As we were writing a simple test, we just wanted to retrieve any data sent by the PI, so our JSON looks like this:
Next we need a service to read the data out of the Time Series store and plot us a pretty graph. In our case, we used the dashboard seed tutorial as the base for our GUI.
Onto the Pi!
Once all the core services were in place, we were ready to get going with the Pi. Another Predix component focused on the ‘Edge’ is the Predix Machine software. This is a bit of software that has been compiled to run on many different architectures and is essentially a self-contained system within the host system.
Called the ‘OSGI Container’, you can generate one using the Predix Eclipse Plugin that allows you to download all the services required to connect and authenticate with the Predix cloud and with your java applications.
This bundle can be deployed to a remote device - the Pi in our app- and can use a whole host of Predix services natively within the container. In our case, we used websockets to establish a connection with our Time Series service, feeding our data from the sensor (data extraction written in python), through the websocket and into our timeseries service. One of the nice things about using an OSGI container is that authentication is performed within the container as a whole, removing the need for each local java services to also have its own OAuth authentication mechanism.
So we are there! We built ourselves a Java app running within the OSGI container that can read data from a text file (populated by some simple python). The app sends data to the Predix Time Series data store via websockets (with the OSGI container performing OAuth validation), and then a views service that can read the data!
You can register for a Predix account here and begin using this tutorial to hook up a Raspberry Pi to Predix at Predix.io.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.