Skill Level: Intermediate

SNAP PAC makes the electrical connections to the THINGS in the IoT and IIoT. This recipe shows you how to configure the PAC hardware, create a device & gateway in IBM Watson IoT, configure a Node-RED flow to connect the PAC to Watson, & display data.


What you’ll need:

· An org account with IBM Bluemix, follow the steps on the screen to create one.

· An Opto 22 PAC controller with firmware version R9.5 or higher with its RESTful server enabled. In this example, we’re communicating with a SNAP-PAC-R1 that’s part of a SNAP-PACLC  Learning Center. This Learning Center hardware also includes a temperature probe.

· A Node-RED flow to connect the Opto 22 hardware to an IBM device.

Easy steps:

1.     Configure the Opto 22 PAC Hardware

2.     Create a Gateway device in IBM Watson IoT platform

3.     Configure the Node-RED flow to connect the Opto 22 PAC to IBM Watson

4.     Deploy Node-RED and check out your data in the IBM cloud!



Opto 22 manufactures controllers, I/O, solid-state relays, and software products that link electrical, mechanical, and electronic devices to networks and computers.

Our customers use our products to monitor, control, and get data from all the machines and devices that are essential to their business. Examples of machines, devices and assets are:

- sensors, actuators (valves, motor starters, pilot lights, etc.) and instrumentation (pressure, temperature, level, flow, etc.)

- pumps, tanks, motors, compressors, etc.

- machinery, systems & processes (e.g. HVAC, plastic injection molding, metal processing, industrial furnaces, power distribution systems, food processing, packaging machinery, Oil & Gas machinery, brewing & distillation processes, energy systems, etc.).

You can find many interesting examples on the Opto 22 Video Case Studies landing page.


SNAP PAC System is a modular system. I/O (input/output) modules make the electrical connections to the "things" in the IoT and IIoT. Examples of inputs are sensors, switches & electrical loads.  Examples of output are actuators, motor controllers, & HVAC systems. The controller is programmed (with our software) to provide "edge processing", in the way of automation & control schemes. It also provides communications (via wired & wireless Ethernet) to local & cloud systems via common protocols. More information can be found at www.opto22.com.








This video walks you through the process outlined in the following steps.


  1. 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.

  2. 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.



  3. Configure Node-RED Flow to Connect the Opto 22 PAC to Watson IoT Node

    · Log into the groov AR1 Node-RED console, as described on this NodeRED for groov.

    · 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.



  4. 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.

    o Voila!



  5. What Next?

    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.




3 comments on"Connect Real-World Industrial Devices to IBM Watson IoT"

  1. […] 22 has provided a recipe for developers to get started in connecting industrial systems to the Watson IoT Platform, as well […]

  2. […] 22 has provided a recipe for developers to get started in connecting industrial systems to the Watson IoT Platform, as well […]

  3. […] 22 has provided a recipe for developers to get started in connecting industrial systems to the Watson IoT Platform, as well […]

Join The Discussion