How to connect your device to IBM Watson Cloud Platform using TapNLink IoTize Primer
IoT platforms provide many integrated services and infrastructures like data storage, connectivity, display, control etc. Hence, they reduce the amount of investment required to deploy IoT solutions and this is one of the main reasons behind some of the most successful IoT solutions around. IBM Watson IoT platform is an industry grade IoT platform frequently used by big industries to store and analyze the data gathered from IoT devices.
TapNLink could be used as a facilitator for connecting your device to IBM Watson IoT Platform. In this tutorial we will setup an IBM Watson account, send 'Sensor Demo' data to it, and visualize this data using the platform's tools.
TapNLink Primer WiFi Evaluation Kit: this kit allows IoT designers to evaluate all the advantages of IoTize TapNLink products for building a connected electronic system. You can purchase a TapNLink Primer Evaluation Kit from Digikey.
IoTize Studio: the PC-based configuration software that configures the TapNLink Primer to communicate with IBM Watson IoT Platform. You can download and install the software from IoTize website.
Step1: Setup your IBM Watson IoT Platform account
The first step is to create an IBM Cloud account: https://cloud.ibm.com/.
Then create an IBM Watson IoT Platform, by going to "Create resource" on the IBM Cloud Dashboard and selecting the Internet of Things platform.
- Once you have created the IoT resource, you can launch the IBM Watson IoT Platform:
Step2: Register your device on your IoT Platform
In this step we will create a device twin in Watson IoT Platform service that represents your physical device.
The data management component of Watson IoT Platform service includes a device twin feature. A device twin is a cloud-based digital representation of your device that is connected to Watson IoT Platform service. Once it is defined and instantiated, the device twin provides a consistent means of interacting with your device from the IoT hub.
- Within your IBM Watson IoT Platform, select Devices tab and click on Add Device button.
- Fill in the device details, the DeviceID will be a unique identifier for your device. You can use the DeviceType to group your devices.
- You may provide additional information about your device but it is not mandatory. Select the security tab to set up your device authentication token. You can either choose an auto-generate token or provide your own authentication token. It is very important that you keep a note of your token when it appears on the summary screen, as when you proceed past the summary stage, the token will not appear again. You will need to provide the information displayed on the summary page when configuring your TapNLink to communicate with Watson IoT Platform.
Step3: Configure TapNLink to handle IBM Watson Connectivity
The STM32 Blue Pill board that is included in the TapNLink Primer Evaluation Kit is pre-programmed with the STM32_Sensor application which demonstrates a few simple features like blinking the LED, measuring the internal temperature and voltage etc. In this guide, we will configure TapNLink to send some information to Watson IoT Platform.
Launch IoTize Studio and open sensor_demo.iotz config file installed in the Sensors_STM32_Demo subdirectory of the installed examples.
Select IoT Platform and setup the configuration: - Select IBM Watson IoT Platform - Provide the previously created Device Twin information to enable TapNLink to connect directly to your Watson IoT Platform. - Setup the frequency (in seconds) of the Twin Status Update sent to the platform.
You could also select a specific Cloud Profile to control the access privileges of the connected 'IoT Platform'.
The Data sent to IBM Watson IoT Platform corresponds to the datalog variables' values. To select a Variable to be included in the datalog, select its Bundle container and setup the corresponding Datalog Period. To remove a Bundle from the datalog list, set its Datalog Period to 0.
Step4: Setup the WiFi Settings and Configure TapNLink
Make sure that TapNLink is configured to 'Store variable information' and the Wireless Communication is 'Network(Station)' with the proper settings to enable TapNLink to connect to the Internet.
Click on the "Configure" button to re-configure TapNLink, then use Test|Reboot Tap to retart TapNLink. Now TapNLink will dynamically connect to your IBM Watson IoT Platform and update your registered device twin with the datalog information you set during this configuration.
Step5: Display Sensor_0000B data in your Watson IoT Dashboard
TapNLink is now configured and running. Every 60 seconds it will send the values of the selected variables. We will now setup a gauge to visualize the values of the logged "Temperature" directly from Watson IoT Platform.
To build a Custom Dashboard for your IoT device, go to your Watson IoT Platform and select 'Boards' .
- Click Add New Board to create a new board for displaying Sensor_000B data. Setup this new Board to be your landing page.
- Once the board is created, we will add a Gauge Card to the board to display the current Temperature data sent from your device.
- As TapNLink is continuously sending a status message to the platform, you can select status from the Event field. Once this type of message is selected you can click on the Property field to list the available values. Select Temp from this list. Change the Type to Number and select °C as Unit.
- Setup the other settings with a 'Gauge' and a color for your card then click Submit.
Et Voilà! The Temperature gauge displays the reported Temperature from Sensor_0000B. The value of the gauge will be refreshed every 60 seconds according to the way we configured TapNLink.
To go further
- To learn more about IoTize TapNLink products, refer to IoTize documentation center.