Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Integrate Iot Devices, Mesh Networks, and Iot Gateways With RoboMQ

DZone's Guide to

Integrate Iot Devices, Mesh Networks, and Iot Gateways With RoboMQ

Create the next killer IoT app with B+B Smartworx devices, brought together by RoboMQ.

· IoT Zone
Free Resource

In this age of cloud, devices, and things, every tiny thing can be connected and made “smart” by providing information aboutitself 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 Device to Dashboard – Real Time Analytics, you might be interested in the guaranteed delivery of sensor data withno 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 Wzzardis an easy to use, completely wireless sensor connectivity platform for the rapid deployment of scalable, intelligent, and 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 simplesteps, 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 andRoboMQ. 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  IoTgateway 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 privatenetworks 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  JSONformat 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… Solets 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 modelsalso 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 BrokerEnable & MQTT Broker Port: Keep the “MQTT Broker Enable” to Off.
  3. MQTT BridgeEnable: On. (This is needed to have the device nodes and the gateway connect to RoboMQ)
  4. MQTT BridgePort: 1883
  5. MQTT BridgeAddress: The IP address or FQDN of broker. You must configure DNS server for the gateway if you choose FQDN.
  6. MQTT BridgeUser: Your RoboMQ tenant ID + “:” + Your RoboMQ username.
  7. MQTT BridgePassword: Your RoboMQ tenant password.
  8. MQTT BridgeClient Identifier: Unique ID for each B+B Smartworx gateway.
  9. Click Save.

After a few seconds, you will be able to see theMQTT connection established from the gateway to RoboMQ on the RoboMQ management UI. 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 gatewayand send the data of interest

Now go back to the edge node. Install a WzzardSensor APP on your Android device then follow the below instructions toconfigure the node.

1. The APP willscan 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 and Network Join Key that you configured and took note while configuring the IoT gateway. Also enter theUsername and Password. If you have not already changed it, then the default username is “admin” and the default password is “admin”. Click “Save” once you're 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 the 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 useof the sensor data. You could use the real-time analytics engine as mentionedabove. You could alternatively integrate the sensor data with Salesforce, CRM,relational databases, MongoDB, CouchDB, analytics engines, or operationalsystem. RoboMQ provides the Things Connect suite of adapters and connectors toconnect all SaaS and enterprise systems with Internet of Things over anystandard 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 devicecreating 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!

Topics:
iot app development ,message queue

Published at DZone with permission of eamin.hang, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}