IBM Watson IoT Platform provides powerful application access to IoT devices and data to help you rapidly compose analytics applications, visualization dashboards and mobile IoT apps. It is a service that is available in IBM Bluemix. Watson IoT Platform allows you to perform powerful device management operations, and store and access device data, connect a wide variety of devices and gateway devices. It provides secure communication to and from your devices by using MQTT and TLS. Instances of the Watson IoT Platform can be created in the Bluemix dashboard. The Watson IoT Platform can be integrated with other Bluemix services and accessed by using the Bluemix dashboard. MQTT.fx tool is used to monitor the messages exchanged between cloud and device.
This Help Article discusses how to use CYW943907AEVAL1F EVK for connecting to IBM Bluemix.
- Open the pub_sub_bluemix.zip file provided along with this post in WICED Studio 5.1 or above.
- Open the file wifi_config_dct.h to configure the Device Configuration Table (DCT). Modify the values of the macros CLIENT_AP_SSID and CLIENT_AP_PASSPHRASE to match your Wi-Fi access point SSID and password respectively. Ensure that the AP is connected to the internet.
- In pub_sub_bluemix.c file, following macros have to be set with proper values to connect to the IBM Bluemix.
#define ORG_ID " "
#define DEVICE_TYPE " "
#define DEVICE_NAME " "
#define TOKEN " "
ORG_ID is unique organization ID you get after creating account. Click on the upper right corner of Bluemix console. Red box shows the organization ID. Type the device type, device name and authorization token you get while registering the device.
As we are making the unsecured connection, change the Security settings in Bluemix console. Go to Security Section. Click on the edit tab.
Select 'TLS Optional' option from the list.
After updating the above information, create make target, run & download program to device CYW943907AEVAL1F.
To verify the output, open the MQTT.fx tool. On the main window, click on the setting tab.
In the pop-up window, set the broker address in the following format:
To generate Client ID and password, open the Bluemix Console. Select APPS section from the Bluemix console window and click on Generate API key.
In the pop-up window, you will see the API key and Authentication token generated as below. Copy the credentials and click on Generate.
Now paste these credentials as User Name and Password in User Credentials tab.
- The MQTT client ID is in the following format: a:org_Id:appId
- The MQTT user name is the API key, for example, a-org_Id-a84ps90Ajs
- The MQTT password is the authentication token, for example, MP$08VKz!8rXwnR-Q
For more information, you can browse the link: MQTT connectivity for applications
Click on OK.
Click on Connect to connect to the IBM Bluemix. You should see a green circle after connection.
Devices can subscribe to commands which have following format:
command_id is the ID of the command, for example, update. It can be any string permitted by MQTT.
format_string is the format of the event payload, for example, json, text, bin.
Similarly devices publish the events which have the following format:
device_type and device_name are the type and name of the device you have registered.
For more information, you can browse the given link.
Type some message in the box below and click on Publish. You will see that message on UART terminal.
pub_sub_bluemix.zip 7.2 K