Thursday, February 18, 2016

Integrate IoT devices, mesh networks and IoT gateways with RoboMQ

In this age of cloud, devices and things , every tiny thing can be connected and made “smart” by providing information about itself and the surrounding environment.  The goal of RoboMQ is to make these connections as simple and seamless as using an app. If you happen to have read our blog Deviceto Dashboard – Real Time Analytics , you might be interested in the guaranteed delivery of sensor data with no programming needed. Today we can make it even simpler by using one of the industrial grade device and IoT gateway platform from B&B Smartworx (now acquired by Advantech).

RoboMQ has been successfully partnering with B+B SmartWorx for over a year. The B+B Wzzard is an easy to use, completely wireless sensor connectivity platform for the rapid deployment of scalable, intelligent, reliable IoT networking in remote and demanding environments. It support variety of connectivity protocols including mesh networks, Wi-Fi, Cellular and wired.  This blog will illustrate, in just a few simple steps, how to connect B+B Wzzard devices with RoboMQ and send data through our distributed, guaranteed delivery integration platform.

This article assumes that you have signed up a free trial or a subscription of RoboMQ. If you have not, please signup for a free trial. The free trial will allow you to connect up to 5 devices. It is a great way to get started and build your prototype and MVPs.
(Note: This article will be mainly focused on the integration between B+B Smartworx and RoboMQ. If you have questions specifically about B+B Smartworx not covered in this blog, you may refer to its documentation at http://bb-smartsensing.com/technical-documentation/ )

B+B Wzzard kit consists of an IoT gateway and several mesh network-connected edge nodes. Nodes and the Gateway communicate with each other over ZigBee mesh network. The gateway provides the last mile IP connectivity and it can connect to Internet or private networks using Ethernet or Cellular connectivity with provision of a backup/fail-over connectivity option. The nodes collect data from attached sensors and publish the data in JSON format using MQTT protocol through the IoT gateway. There are different types of edge nodes with built in support for different types of sensors.

Figure 1: B&B Smartworx IoT gateway and Edge nodes


Ok… So lets get to work and get started. The setup is as simple as 1-2-3…
  • Wire your sensors to a B+B edge node
  • Configure the gateway to connect to RoboMQ Integration Middleware
  • Configure the nodes to connect to the IoT gateway and send the data of interest

Let’s further break down each step with more details:
1) Wire your sensors to a B+B edge node
B+B Smartworx documentation provides elaborate wire specification for each node model on how to connect the sensors and use the inbuilt sensors. You should read the B&B Smartworx documentation to accomplish step 1. Typically, an edge node will provide voltage, ground, digital input and analog input pins. Some models also come with pre-installed sensors. You will have multiples choices to configure and customize your edge nodes.

2) Configure the IoT gateway to connect to RoboMQ Integration middleware
Once the sensor setup is done, connect your laptop or computer to the IoT gateway over the Ethernet port, and open http://192.168.1.1 in your browser. It will lead you to the configuration page of the IoT gateway. Click User Modules -> IoT Gateway, and you will see the page below.

Figure 2: Setting up IoT Gateway

Follow the instruction below to fill out the form then save it.
  1. Network ID & Join Key: Remember them! Nodes will connect to the gateway using these as the credential. This is the credential and joining key for local mesh network.
  2.  MQTT Broker Enable & MQTT Broker Port: Keep the “MQTT Broker Enable” to Off.
  3. MQTT Bridge Enable: On. (This is needed to have the device nodes and the gateway connect to RoboMQ)
  4. MQTT Bridge Port: 1883
  5. MQTT Bridge Address: The IP address or FQDN of broker. You must configure DNS server for the gateway if you choose FQDN.
  6. MQTT Bridge User: Your RoboMQ tenant ID + “:” + Your RoboMQ username
  7. MQTT Bridge Password: Your RoboMQ tenant password
  8. MQTT Bridge Client Identifier: Unique ID for each B+B Smartworx gateway.
  9. Click Save.
After a few seconds, you will be able to see the MQTT connection established from the gateway to RoboMQ on the RoboMQ managementUI. The URL to the management UI along with the credentials is provided upon signing up for RoboMQ free trial or subscription.


Figure 3: RoboMQ management UI showing established connection from IoT Gateway
  
      3) Configure the nodes to connect to the IoT gateway and send the data of interest
Now go back to the edge node. Install a Wzzard Sensor APP on your Android device then follow the below instructions to configure the node.

1. The APP will scan for B+B nodes over the bluetooth. Long press configuration button on the node to prepare it for configuration, then select the node in the APP.
Figure 4: Select the edge node for configuration

On the next screen Select “Radio Setup” to go to the detailed configuration page.


Figure 5: Select Radio Configuration option

2. Once on the Radio Setup screen, input the Network ID & Network Join Key that you configured and took note while configuring the IoT gateway. Also enter the Username and Password. If you have not already changed  it, then the default username is “admin” and default password is “admin”. Click “Save” once done.
Figure 6 Radio configuration on the edge node
    
3. Now go back to “Select a category screen” as shown in Figure 5 and select “Sensor Setup”. It should present you with the screen as shown below.

Figure 7 Sensor configuration 


On this screen, configure “Publish Interval” and sensor specific data rules and formats.

At this point, you have completed the setup and you are all set!!
B+B Wzzard will now collect sensor data and publish to it RoboMQ at the configured time intervals. Below is a snippet of the MQTT messages that you will receive on RoboMQ queues. As you can see, the MQTT topic is the node ID and message payload is JSON formatted sensor data.

Topic
Payload
BB.0013430F2535.data
{"s":2,"t":"2015-11-24T20:14:58Z","q":192,"c":5,"do2":false,"ai1":2.0,"ai2":2.03}
BB.0013430F2535.data
{"s":2,"t":"2015-11-24T20:14:58Z","q":192,"c":5,"tempint":71.9,"vbatt":3.29}
BB.0013430F2535.data
{"s":1,"t":"2015-11-24T20:14:48Z","q":192,"c":5,"ai2":2.03}
BB.0013430F2535.data
{"s":1,"t":"2015-11-24T20:14:48Z","q":192,"c":5,"do2":false,"ai1":2.02}
BB.0013430F2535.data
{"s":1,"t":"2015-11-24T20:14:48Z","q":192,"c":5,"tempint":73.0,"vbatt":3.29}
BB.0013430F2535.data
{"s":0,"t":"2015-11-24T20:14:38Z","q":192,"c":5,"ai2":2.03}
BB.0013430F2535.data
{"s":0,"t":"2015-11-24T20:14:38Z","q":192,"c":5,"do2":false,"ai1":2.02}
BB.0013430F2535.data
{"s":0,"t":"2015-11-24T20:14:38Z","q":192,"c":5,"tempint":72.6,"vbatt":3.29}

You could not consume these messages and build applications using IoT device data. For example, you will be able to build IoT visualization, as shown, below in couple of minutes to monitor the sensor data. To do so simply follow the second half of our previous blog Deviceto Dashboard – Real Time Analytics
Once you have configured RoboMQ “Device toDashboard” real time analytics and visualization engine, you should be able to visualize your sensor stream real-time with absolutely no programming needed!!

Figure 8: RoboMQ Device to Dashboard real time analytics and visualization engine


With RoboMQ, you have endless options for the use of the sensor data. You could use the real-time analytics engine as mentioned above. You could alternatively integrate the sensor data with Salesforce, CRM, relational databases, MongoDB, CouchDB, analytics engines or operational system. RoboMQ provides ThingsConnect suite of adapters and connectors to connect all SaaS and enterprise systems with Internet of Things over any standard integration protocol.  You may refer to our blog on how to connect your device data to Salesforce at http://robomq.blogspot.in/2015/04/hello-i-need-help-iot-devices-talking.html. This blog talks about the use case of a device creating a case in Salesforce upon observing an abnormal environmental condition.

As you might have experienced yourself by now, Any-to-Any integration is extremely easy with RoboMQ. Sign up for a free trial today and please feel free to reach out to us at info@robomq.io for further assistance. If you need more assistance, you may engage us for a proof of concept to give us an opportunity to show how we can help you realize your next IoT killer app!!


No comments:

Post a Comment