Wednesday, June 8, 2016

Oracle IoT Cloud Service: concepts and introduction.

Risultati immagini per picture for idea concept
Probably this will become a rather long blog post. I hope interesting too.
First of all, let’s recall what we commonly mean with the name “Thing”.
A “Thing” is a real-world (physical) object, that has attached a device, with:
  • computing capability
  • sensors
  • actuators
  • connectivity to the network
A Thing, through the attached device, therefore is capable to run some code (more or less powerful), is able to measure some physical properties (for example, the location, the temperature), is able to act on the physical world, for example turning on a light or an engine, and can communicate through the network.
The last capability probably is considered the most important. Without network connectivity we can call it “an embedded device”, but we don’t use the term “Thing”, in the sense of IoT.
Now, with more and more “devices” capable of computing capabilities and connectivity, the set of solutions available in the industrial and “Makers” world is rapidly increasing.
One example? The first one that comes to my mind: imagine a fleet of trucks transporting food that needs to be kept at low temperature. Or maybe medicines.
You want to be able to:
  • control the temperature inside the truck (the fridge)
  • control the location of the truck (Is the driver taking a too long nap?)
  • verify if the fridge is open and for how long
Well, today you can.You need:
  • A “computing board"
  • A GPS sensor
  • A temperature sensor
  • A 4G shield, to connect through 4G network and send messages.
Now, what you want to do with these “travelling” devices and their streams of data?
Well, you may have many different requirements.
I’ll try to list some:
  • Security is important
  • You want to register “devices” in order to avoid that “a fake” truck drive you mad
  • Receive in a reliable way messages from devices with data
  • Analyze in real time these data, in order to identify quickly that something wrong is happening (temperature is rising above threshold) and send a SMS alert to the driver
  • reset a board.
 As I have already written in this blog before, a really interesting board is Intel Edison. It is low cost (less than 100$) but really powerful. You can connect many different sensors. It can run Linux and (Oracle) Java. The most interesting thing is that it hosts a CPU based on X86 architecture. You realize what it means.
But, how to support the collection and analysis of all the data coming from, for example, 1000 trucks traveling around your country?
You can use Oracle IoT Cloud Service.
It is a Cloud Service provided by Oracle, as part of its PaaS platform, with many interesting functionalities for IoT.
With Oracle IoT CS you can develop applications, running on the device, in Java, C, NodeJS. In the rest of the post I’ll consider Java development.
First of all, with Oracle IoT CS, you can register a device. Only registered (and activated devices) can send messages to the IoT CS.
You can register a single device, using the Web UI, or register many devices with a batch, using a csv file.
When you register a device, you associate an ID and a “secret” to the device. These will be used to uniquely identify a device and secure the communication.
Next step is to install, on the device, the Device Client Library, provided by Oracle. You can download it from the Oracle site. At the end, you will need to put in the classpath a single JAR file ( device-library.jar).
Afterwards you will need to generate “a trusted assets store”, that will contain the keys and certificates needed to protect, with TLS, the communication between the device and IoT CS. The trusted assets store (a keystore generated with a provided Oracle tool) is private to the single device.
After having registered the device (or the set of devices) you will need to define a “Device Model”. A Device Model defines the interface between your “Things” and Oracle IoT CS. Again, you do this using Oracle IoT Cs Web UI (or, as we will see in another post, calling a REST API).
The Device Model defines:  format of messages exchanged, actions (methods) that you can call on the “Thing”, format of Alert messages.
A Device can have more than one Device Model attached.
Next step is to give a name to the IoT application you’re creating. You will associate the Device Model to the application and in this way you will be able to monitor the flow of messages from the IoT CS console.
Another step is to develop, compile and test the Java application that will run on the board. It will use a set of classes provided by the Device Client Library. For example the “Device Virtualization API”, that abstracts and simplifies the interactions between the devices and IoT CS. Behind the scene, the communication is based on messages exchanged through REST calls, protected by TLS.
At this point you’re able to start sending messages to Oracle IoT CS  and monitor the flows of messages using the Web UI.


NewImage

In the picture you see that the IoT application ApplicationEdison1 has received 12 messages.
And you can imagine 1000 connected devices sending their messages. Each one identified by the device id and some other metadata.
Now, the Analytics part: you want to analyze the streams and identify when some conditions are met (for example: temperature greater than 10 degree (10 C)).
Oracle IoT gives you an already configured and integrated instance of Oracle Stream Explorer.

NewImage

You can define a Source of Data, starting from a Device Model, and can define an “Exploration”. In this exploration you can specify filters conditions and therefore you will define an output stream that will give only device-id and timestamp for those messages where the condition is met (temperature > 10 )
Lastly, you can define an action, and send the output stream to a Java app that expose a REST service. This Java app will receive a JSON message for each situation where the threshold is crossed (T > 10) and can trigger what you want (for example, send an SMS).
The Java App can be hosted in Oracle Java Cloud Services or Oracle Application Container Cloud Services (based on Docker).
Ok… this is only a first introduction to concepts and what you can do with Oracle IoT CS.

One last thing: as you can see from my Linkedin profile, I work for Oracle. But I’m interested in many (iot) things and, as I have a degree in Physics, I’m always happy when I have time to play with measures and electronics.
Stay tuned.

2 comments:

  1. Cloud Ace Technologies is offering Implementation Services on Cloud Computing, Cloud Services, IT Security and Colocation Service Providers in Chennai

    ReplyDelete