Configure the Opto 22 PAC Hardware
Assemble and program the SNAP-PAC-R1 as described in the SNAP PAC Learning Center User’s guide, Opto 22 form 1638.
Configure and enable the RESTful client using the steps outlined on the website developer.opto22.com
Note: While this recipe describes how to read/monitor three paramaters, a variable (fuel level), an analog input (store temperature) and a digital input (light level), controlling an output, such as turning on/off a digital output or adjusting an analog value can also be done via similar steps.
Create a Gateway Device in IBM Watson IoT Platform
· To create and register a Gateway device log on to IBM Watson IoT Platform.
o Once logged on, select your Organization.
o Next, select Devices from the menu on the left.
o Click on Add Device.
o Click on Create Device Type.
o As this recipe focues on adding a Gateway Device, click Create Gateway Type.
o Name the Device Type that is being added, then click Next in the bottom right corner of the screen.
o Observe that a template page is given where you can select and define one or more attributes. All of these attributes are optional. They will be used as a template for new Gateway devices that are assigned this device type. Attributes that you do not define may still be edited individually later when you add the Gateway. You can define one or more attributes by selecting them and clicking Next as shown below.
o Optionaly define the selected attributes like Manufacturer and Model, then click Next.
o Define optional Metadata in JSON format, or you can choose not to set this attribute. Click Create.
o Enter a unique device ID, which will distinguish your Gateway from all other devices that you might connect to the Watson IoT Platform, the click Next.
o In the next page, you can either add your own authentication token, or allow the Watson IoT Platform to generate a token for you. If you chose to add your own token, ensure that each gateway device token is different. Click Next.
o As shown below you will be given a summary page to verify the details before adding the Gateway to the IoT Platform. Verify and click Add.
o At this step, the Gateway is registered to your Organization and you will be provided with the registration details. To connect to and send data to your Gateway (Step 3 below), you will need the credentials, so make note of them now.
This is very important. This is the only time you will see the Gateway Authentication Token. It is better to cut and paste this information than to take a screen shot, as you will need to type out the information in a few minutes. Be sure and save the information in a safe place where you can refer back to it at any point in the future.
o Click Close to get back to the main dashboard and observe that the Gateway is added to your Organization.
Configure Node-RED Flow to Connect the Opto 22 PAC to Watson IoT Node
· Install Node-RED Watson IoT node (wiotp out) by following the Opto 22 forum post on adding new nodes to Node-RED.
· Create a flow using the inject, snap pac read and watson iot output nodes.
o inject node: how often to send data.
Select an interval or none not to repeat.
o SNAP PAC read node:
o Add your SNAP PAC controller using it’s IP address or host name. Enter the key ID and value pair you selected for your controller when enabling RESTful interface.
o Unless SSL certificate is used, make sure to select HTTP from the drop down menu.
o After the SNAP PAC controller is added, choose the data type and the tag name for the point you want to see in the Watson iot platform. The tag name is found in your PAC Control strategy.
o Watson IoT node:
o Connect as Gateway, click on Credentials and enter the credentials for your Gateway device.
Deploy Node-RED and Check Out Your Data in the IBM cloud!
· Click on Deploy in Node-RED.
· Now the data is flowing from your Node-RED flow to the IBM IoT Cloud at the interval you selected.
· Open the Watson IoT platform if it’s not already opened.
· Click on Devices. The Gateway device and attached devices created will show here.
· Double click on the Gateway, and you will see information such as connection information, recent events, errors, etc., including the attached devices you created in Node Red.
· Create cards in the Watson IoT platform to see your data trend or be presented in some other user-friendly way. We will use a trend (line graph) for our temperture.
o Click on Boards on top left corner.
o Create a new board.
o Double click on the board created.
o Click on Add new card. Here you have few options (gauge, line graph, bar graph etc.) to present the data.
o Click on line graph.
o Select your Device.
o Click next.
o Click on connect new dataset.
o Leave Event as event and property as value.
o Name the point, choose the type and engineering unit, precision, min and max.
o Click next.
o You should see the line graph with the data on it. Under setting you can make the graph small, medium or large. O th next screen you have options for color.
o Click next and give it a title.
o Click submit.
You can similarly get data from other input points and signals (“Devices”) on the SNAP PAC Learning center (“Gateway). Try the Fuel Level as shown above in the gauge. Also, try using the tools in Watson to trigger an output point on the SNAP PAC Learning Center., based on a condition Further, IBM Bluemix and Watson have a host of tools that will allow you to gather data, visualize patterns, advance to analytics and ultimately infer with cognitive.
The SNAP PAC System from Opto 22 and IBM Bluemix are the perfect combination to deploy in industrial IoT applications for increased actionable business intelligence.