RuBAN on the fog Quick start article


NOTE: This documentation is not fully applicable to the most recent release of RuBAN on the Fog.

TIP: You can find a video tutorial for RuBAN on the Fog on the following page:

Tutorial: RuBAN On The Fog Quick start


RuBAN-on-the-Fog (ROTF) is designed to allow sensors to communicate with the RuBAN Platform Server.

ROTF can be installed on edge devices based on Linux. ROTF allows developers write edge specific device applications that can harness the potential of the edge’s hardware such as an integrated CAN bus, a General Purpose Input/Output port (GPIO) or integrate application specific sensors.

Davra Networks provide a set of out-of-the-box components which can be drag and dropped onto a work flow which allows the harvesting of data from the edge device sensor, aggregation of the data with other data source such as GPS data and the transmission of this aggregated data back to the RuBAN platform.

ROTF is implemented and built on IBM’s Node-Red (http://nodered.org/) and allows the developer to perform Rapid Application Development. Being built on Node-Red allows the developer to incorporate other modules into their application using the Node Package Manager (npm). Please see the Node-Red Documentation here http://nodered.org/docs/.

In the tutorial, all of the required modules to implement the example code are installed as part of the ROTF installation but there is nothing stopping the developer from importing other modules to integrate with an existing module that may address a particular need such as a node module to communicate with a specific sensor.



ROTF Installation

In order to install ROTF the device must be running a Linux distro, (so far it has been tested the code on CentOS 6.6, Ubuntu 14.X, Arch and RPi Model B2 with Raspian Jessie Light 09-02-16*)

Make sure you have the IP address of the RuBAN server you will be attaching the edge device to. Having this IP address can save you some time later when using/creating new flows.  

Preconditions:

  1. The installation requires that the user is logged in as root on the edge device.
  2. The device must have full internet access in order to load dependencies and other modules required.
  3. The device should have a minimum of 2GB of free disk space for the complete installation.
  4. A RuBAN server from which to check and verify the operation of the ROTF device.

These are the steps required to complete the installation of a CentOS 6.6 Minimal based device and the steps should be the same for most distros.

Step 1.

Download the latest ROTF version from Davra's download page: Downloads

Copy the downloaded tar file onto the edge device (using WinSCP, for instance, if you have downloaded onto a windows machine).

You could also use curl to download the file from Dropbox.

Step 2.

Logged in as root, un-tar the install file as follows

tar –zxf ruban-ote-fog-x.x.xx (using the file name you just downloaded)

This will create a folder called ruban-ote-fog in the root directory.

Step 3.

cd /root

bash ./ruban-ote-fog/install.sh –r 192.168.0.xxx > /root/rotf_install.log 2>&1

The –r parameter followed by the IP address of the RuBAN server. This parameter is optional but is recommended as it makes the sending of data to the RuBAN simple (see notes in Step 5 for more detail). If a second terminal session is opened to the device and user is logged in as root, the output of the installation process can be tailed to the console of the second terminal session.

tail –f rotf_install.log

This installation may take some time depending on device you are installing on as the install will load all modules and compile the code to the architecture you are installing onto such as x86 or ARM based devices.

When the installation process is finished you should see the following


If you don’t see this message then you will need to check the rotf_install.log to view the errors. Usually the issues are around the user not logged in as root or the internet is not available.

** Further pre-requisite are required for installation on the Raspberry PI Model B 2

Step 4.

In a browser enter the address of the lP address of the ROTF device along with the port number 1880 (default port number for your ROTF installation)/ruban-fog/ to view the work-flow for the example application.



http://192.168.0.XXX:1880/ruban-fog/



Step 5.

Select the second tab labelled ‘RuBAN Integration’



If you have installed using –r option with the RuBAN server IP address, the example flow should be ready to run. If you now tap on the two components called ‘timestamp’ the flow should now start sending data to RuBAN.

If you have not used the –r option when installing ROTF please see Step 7 to set the RuBAN Server IP address.

Going to the RuBAN Server and opening up the IoT Gateways, you should now be able to see the ROTF edge device you have just setup in the IoT Gateway panel see screen shot below.

Once the device appears in this panel you should now be able to create charts to display the data being sent from the edge device.

Step 6.

Now at this stage RuBAN will be saving the harvested data that is being sent back from the edge device, this data can be visualised in a dashboard.


You can create a simple dashboard in RuBAN to display the data being sent using the procedure in the RuBAN documentation to create a new dashboards.

https://davranetworks.atlassian.net/wiki/display/KT/Setting+up+a+Dashboard+and+viewing+Metrics+in+RUBAN

Select the Line chart  from the list of available chart types, edit the chart by clicking on .

Select the two metrics CPU and memory, select your ROTF edge device from the dropdown filter.



You can also create gauge Dashboards using the same metrics.


N.B. Don’t forget to Save your dashboards.

You should get a dashboards something similar to the screenshots below.

Creating the gauge chart is similar to above except you can only have one metric per gauge.

Step 7.

If you did not use the –r option when installing ROTF you will need to add the RuBAN Server that the data should be pushed to into, any of the nodes which have the word Auto-config underneath the node name will need to have that node point at the correct server.

You will need to do this with every node of this type (that is why you should always install with the –r option as it will save you time later). Also don’t forget to re-deploy the application to the ROTF device once you have made the changes.



To change Click on the down arrow and select Add new ruban-server, then click on the edit icon (pencil) to the right of the drop down list and the following should be displayed.

All of these variable can be changed to whatever is required but please note the two port settings don’t usually change.  Check with your RuBAN administrator for these settings if they have been changed from their defaults.


Once the settings are correct, the new ROTF edge device should appear in the RuBAN administrator’s panel for IoT Gateways.


You will notice the last two devices in this screenshot are both ROTF devices and are showing green heart beats to show they are sending data back to RuBAN.

Installation notes for the Raspberry Pi Model B2.

(Please refer to the Raspberry Pi documentation for all things Raspberry Pi as this is beyond the scope of the ROTF Documentation.

Install with the Raspbian Jessie Lite release.



https://downloads.raspberrypi.org/raspbian_lite_latest

Once you have downloaded the Linux Image to SD card, log in as root ensure you expand the file system to use all of the card using RASPI-CONFIG.

Ensure you have the latest version of node.js as the one which ships with this release is out-of-date.

sudo apt-get update

sudo apt-get upgrade

wget https://node-arm.herokuapp.com/node_archive_armhf.deb

sudo dpkg -i node_archive_armhf.deb

npm install serialport


Once the serial port has been installed start and follow each of the steps above.

Notes for Ubuntu / Debian

Tested on Ubuntu 14.04

Install pre-requisites:

apt-get install nodejs

apt-get install ntp

apt-get install npm

ln - /usr/bin/nodejs /usr/bin/node

Now continue from Step 1.

Wrap Up.

In this example you have been shown how to create a simple flow which transmits some metrics back to RuBAN. The flow can be further enhanced by adding other modules such as GPS which can be used to get Latitude/Longitude of the particular edge device and this to can be aggregated into the data being sent back to RuBAN.

If you intention is to use an edge device with a particular sensor, check with the manufacturer to see if they have provided a Node-Red module which can be integrated in to the flow to allow capture of data from the sensor.