Skill Level: Any Skill Level

This recipe is suitable for all and is a great foundation for IoT projects.

Connect the Wi-Fi LaunchPad directly to the Watson IoT Platform and send data to the cloud. This recipe demonstrates how to push data to the Quickstart service for easy web browser display.


In this tutorial, you will be connecting a Texas Instruments SimpleLink CC3220S/SF Wi-Fi LaunchPad to the IBM Watson IoT Platform. The SimpleLink MCU Platform (http://www.ti.com/simplelink) delivers flexible hardware, software and tool options for your Internet of Things (IoT) applications. Ā The CC3220S/SF SimpleLink MCU Platform is optimised for IoT applications with an ARM Cortex-M4 host processor and a rich set of peripherals, including an easy-to-use embedded Wi-Fi Network Processor.

For this tutorial you will need one of the following development boards.

You will also need a Windows/Linux or MAC development host and will need to install the following tools.

A serial terminalĀ applicationĀ will also be useful for visualising the status of the system.


  1. Configuring the development environment for SimpleLink Wi-Fi LaunchPad using the Project-0 Example

    The first step is to ensure the CC3220 LaunchPad and the development environment is setup and ready for use.Ā 

    Please follow this SimpleLink Academy Training which gives an overview of the hardware, software and development environment.


    At the end of this short training, the development environment will be ready for creating and running applications using Wi-Fi.

  2. Running the SimpleLink Wi-Fi MQTT Example Application

    We will use an MQTT protocol connection to interact with the IBM Watson Platform, so first step is to load and run the MQTT client application contained in the SimpleLink MCU Software Development Kit (SDK). Ā This example application connects to the Eclipse Paho MQTT Sandbox Broker.

    Please review the following ‘simplelink-academy’ documentation which discusses setup of this MQTT client application, and verify that the LaunchPad can be connected successfully to the sandbox broker.


  3. Modifying the MQTT Client Example to Connect to IBM Watson Platform QuickStart

    The IBM Watson Platform offers a ‘QuickStart’ service which allows devices to connect without being registered, in order to evaluate the Platform and verify connection setup.

    There are several steps required in order to modify and prepare the MQTT Client example for connection to the IBM Watson Quickstart service.

    1. Ā Modify the SERVER address to point to the IBM Quickstart Broker

    #define SERVER_ADDRESS "quickstart.messaging.internetofthings.ibmcloud.com"

    2. Ā Set the Published Message Topic and define a larger unitialised buffer for the message to be sent.

    /* Publishing topics and messages */
    const char *pub_topic = {"iot-2/evt/status/fmt/json"};
    const char data[1024];

    3. Configure the WILL message

    #define WILL_TOPIC    "iot-2/evt/status/fmt/json"
    #define WILL_MSG "{\"d\":{\"state\":\"LastWillAndTestament\"}}"
    #define WILL_QOS MQTT_QOS_0
    #define WILL_RETAIN false

    4. Ā Remove Topic Subscription (since QuickStart service is publish only and doesn’t allow subscriptions)

    #if 0
    /* Subscribe to topics */
    if (gUiConnFlag == 1)
    uint8_t subIndex;
    MQTTClient_SubscribeParams_t subInfo[SUB_TOPIC_COUNT];

    for( subIndex = 0; subIndex < SUB_TOPIC_COUNT; subIndex++ )
    subInfo[subIndex].topic = topic[subIndex];
    subInfo[subIndex].qos = qos[subIndex];

    if (MQTTClient_subscribe(gMqttClient , subInfo, SUB_TOPIC_COUNT) < 0)
    UART_PRINT("\n\r Subscription Error \n\r");
    gUiConnFlag = 0;
    for (iCount = 0; iCount < SUB_TOPIC_COUNT; iCount++)
    UART_PRINT("Client subscribed on %s\n\r,", topic[iCount]);

    5. Ā Configure the ClientId. Ā This should be of the form d:quickstart:<device-type>:<device-id>. Ā We’ll use a pre-defined type of ‘ti-simplelink’ and use the MAC address of the Wi-Fi as a unique device id.

    #include <stdio.h> // for sprintf() below.

    // Allocate larger buffer since this needs to include d:<org>:<type>:<id>
    char ClientId[64];

    int32_t DisplayAppBanner(char* appName, char* appVersion)

    // for (Index = 0; Index < 6; Index++)
    // {
    // ClientId[Index] = (char)macAddress[Index];
    // }
    // Format ClientID, using MAC address
    sprintf(ClientId, "d:quickstart:ti-simplelink:%02x%02x%02x%02x%02x%02x",

    UART_PRINT("\t MQTT ClientId: %s", ClientId);

    6. Ā Configure the message to send. Ā  We’ll send a json payload of the LaunchPad button state (SW2) which we will toggle each time the button is pressed. Ā We also need to send the message at MQTT_QOS_0.

     switch (queueElemRecv.event)
    Ā  static int buttonToggle = 0;


    buttonToggle = !buttonToggle;
    sprintf(data, (const char *)"{\"d\":{\"button\":%d}}", buttonToggle);

    /* send publish message */
    lRetVal = MQTTClient_publish(gMqttClient, (char*) pub_topic, strlen((char*)pub_topic), (char*)data, strlen((char*) data), MQTT_QOS_0 | MQTT_PUBLISH_RETAIN );

    7. Ā Rebuild the MQTT application with these changes and reload/run the application. Ā You should see the following on the serial console.

     MQTT ClientId: d:quickstart:ti-simplelink:010203040506

    CC3220 MQTT client Application

    Device came up in Station mode
    [WLAN EVENT] STA Connected to the AP: XX , BSSID: 11:22:33:44:55:66
    [NETAPP EVENT] IP acquired by the device

    Device has connected to XX
    Device IP Address is

    Version: Client LIB 1.1.0, Common LIB 1.2.0.
    C: FH-B1 0x10 to net 0, Sent (122 Bytes) [@ 3]C: Rcvd msg Fix-Hdr (Byte1) 0x20 from net 0 [@ 3]C: Cleaning session for net 0
    C: Msg w/ ID 0x0000, processing status: Good
    C: FH-B1 0x31 to net 0, Sent (47 Bytes) [@ 9]

    8. Ā Each time the User button (SW2) is pressed, a message with the button state will be sent.

    Ā CC3200 Publishes the following message
    Topic: iot-2/evt/status/fmt/json
    Data: {"d":{"button":1}}

    9. Ā Now connect to IBM QuickStart to view the data :Ā https://quickstart.internetofthings.ibmcloud.com/Ā and use the MAC address of the LaunchPad as shown on the serial console to see the data!

    Ā quickstarttoggle2


    Congratulations! Your SimpleLink MCU Platform CC3220 Wi-Fi LaunchPad is now connected to the IBM Watson Platform!

Join The Discussion