Skip to main content

Connecting TI LAUNCHXL-CC26X2R1 to the Cloud

Letters IoT over a red city background

Image Source: TierneyMJ/shutterstock.com

By Greg Toth for Mouser Electronics

Published May 20, 2020

The Texas Instruments LAUNCHXL-CC26X2R1 LaunchPad™ Development Kit supports the development of applications using Bluetooth® Low Energy (BLE) and IEEE 802.15.4-based protocols, including Thread, ZigBee®, and TI 15.4. The Medium One IoT Platform is a cloud-based IoT platform designed to help early-stage developers prototype IoT projects or connect existing hardware to the cloud. In this project, we'll set up an IoT development environment using the LAUNCHXL-CC26X2R1 LaunchPad™ Development Kit, a sensor add-on board, and a Wi-Fi connectivity module to read temperature, humidity, and pressure sensors and send the data to the Medium One cloud where it can be processed and viewed using programmable workflows and configurable widget dashboards.

Project Materials and Resources

The project BOM lists components used in this project. Additional hardware and software development tools are also identified.

Project Bill of Materials (BOM)

Hardware

  • Personal computer (PC) running Microsoft Windows®, MacOS or Linux
  • Five (5) Male-to-Female Dupont style jumpers
  • Soldering iron

Accounts and Software

  • Web browser for accessing software download sites and Medium One IoT Platform
  • Login account for the Medium One IoT Platform
  • Texas Instruments Code Composer Studio Integrated Development Environment (IDE)
  • Application project files available in GitHub repositories
  • Arduino IDE for configuring the HUZZAH32 board
  • Serial terminal program such as Tera Term on the PC
  • Wi-Fi access point connection details including SSID and password

Project Technology Overview

TI LAUNCHXL-CC26X2R1 LaunchPad Development Kit

The Texas Instruments LAUNCHXL-CC26X2R1 LaunchPad™ Development Kit (Figure 1) supports rapid prototyping using the TI CC2652R wireless microcontroller. It has a 32-bit ARM® Cortex®-M4F processor running at 48MHz with 352KB flash and 80KB RAM along with a full complement of peripherals such as I2C, SPI, UART, digital and analog input/output, advanced cryptography accelerators, and a Sensor Controller Engine (SCE). The radio section supports IEEE 802.15.4-based protocols, including Thread, ZigBee®, and TI 15.4 in addition to Bluetooth® Low Energy (BLE). The board features an integrated PCB antenna for 2.4GHz, onboard XDS110 JTAG emulation tool for flashing and debugging firmware, two user buttons, two user LEDs, 8Mbit serial flash memory, access to all GPIO pins, and connectors for BoosterPack add-on boards. Power is provided through USB, which also supports programming and debugging as well as serial UART connectivity to a host computer. An alternate power source can also be used instead of USB.

More detailed information about the board can be found here and here.

TI LAUNCHXL-CC26X2R1 LaunchPad Development Kit

 

Figure 1: TI LAUNCHXL-CC26X2R1 LaunchPad Development Kit (Source: Mouser Electronics)

TI BOOSTXL-SENSORS BoosterPack Plug-in Module

For this project, we'll use a Texas Instruments BOOSTXL-SENSORS (Figure 2) add-on board to provide sensors that our application will read. The BOOSTXL-SENSORS board contains:

  • BME280 Integrated Environmental Unit measuring pressure, humidity, and temperature
  • BMI160 6-Axis Inertial Measurement Unit with 3-axis accelerometer and 3-axis gyroscope
  • BMM150 3-Axis Geomagnetic Sensor for eCompass applications
  • TMP007 Contactless Temperature Sensor
  • OPT3001 Ambient Light Sensor

More detailed information about the board can be found here.

TI BOOSTXL-SENSORS Sensors BoosterPack Plug-in Module

 

Figure 2: TI BOOSTXL-SENSORS Sensors BoosterPack Plug-in Module (Source: Mouser Electronics)

Adafruit HUZZAH32

The LAUNCHXL-CC26X2R1 does not have built-in Wi-Fi Internet connectivity, and for this project, we'll use an Adafruit HUZZAH32 board as a co-processor providing Wi-Fi connectivity and secure MQTT communications. The HUZZAH32 will be programmed with an application that provides AT-style commands that will be controlled by the LAUNCHXL-CC26X2R1 through one of its serial UART interfaces.

TI Code Composer Studio

Firmware programs that run on microcontrollers are typically developed and tested using an Integrated Development Environment (IDE) running on a personal computer. The IDE provides an editor, compiler, linker, debugger, and a mechanism for transferring binary program images to the microcontroller.

The LAUNCHXL-CC26X2R1 can be programmed using Texas Instruments Code Composer Studio, an Eclipse-based IDE that runs on Windows, Mac, and Linux computers. It connects to the LaunchPad board using a USB cable that supports programming and debugging. Code Composer Studio can be downloaded for free from the Code Composer Studio site.

Project Application Source Code Files

For this project Code Composer Studio was used to create an initial set of project source code files that have been modified and extended to work with the Medium One IoT Platform. The resulting files have been put in a GitHub repository that you can download for this project. The project files will be imported into Code Composer Studio where they'll be compiled and downloaded to the LaunchPad board. The project files consist of a main application program and supporting functions for I/O and cloud connectivity.

Software for the HUZZAH32 board is available in a second GitHub repository that you will download and program onto the HUZZAH32 using the Arduino IDE.

Medium One IoT Platform

The Medium One IoT Platform (Figure 3) is designed to help early-stage developers prototype their IoT project or connect their existing hardware to the cloud. It offers an IoT Data Intelligence platform enabling customers to quickly build IoT applications with less effort. Programmable workflows allow you to quickly build processing logic without having to create your own complex software stack. Configurable dashboards allow you to visualize application data and view real-time data in various formats. Medium One's iOS and Android apps allow you to build simple mobile app dashboards that can communicate with your devices through the IoT platform.

TI BOOSTXL-SENSORS Sensors BoosterPack Plug-in Module

 

Figure 3: Medium One IoT Platform (Source: Mouser Electronics)

IoT devices can exchange data with Medium One through either a REST API or MQTT. More detailed information about the Medium One IoT Platform can be found here and on the Medium One site.

The Setup (Software)

While setting up the hardware, be sure to remember that electronic components are static-sensitive so handle accordingly.

Personal Computer (PC)

Power up the personal computer and allow it to boot up.

Wi-Fi Access Point

Make sure your Wi-Fi access point is running with an active connection to the internet and a DHCP server that assigns IP addresses. You'll need to know the access point SSID and security credentials to be used later when configuring the Wi-Fi connection.

LAUNCHXL-CC26X2R1 LaunchPad Development Kit

Follow the getting started instructions to set up the LAUNCHXL-CC26X2R1. The main steps will include:

  • Connecting the board to your computer using the included USB cable
  • Downloading the SimpleLink Starter smartphone app
  • Running the SimpleLink Starter app to verify the board is working

BOOSTXL-SENSORS BoosterPack Plug-in Module

Connect the BOOSTXL-SENSORS board to the BoosterPack connectors on the top side of the LaunchPad board. The two boards will form a stack with the Sensors BoosterPack on top.

Adafruit HUZZAH32

Unbox the HUZZAH32 and follow the setup and assembly instructions found here. Instead of soldering the plain male headers into the board, solder the female short headers into the board so the sockets face up as shown in Figure 4. Software setup will be covered in the next section.

Board-to-Board Connections

Use male-to-female jumper wires to connect pins on the LaunchPad board to the HUZZAH32 (Figure 4) according to Table 1.

Board-to-Board Connections

 

Figure 4: Board-to-Board Connections (Source: Mouser Electronics)

Table 1: Wiring Between LaunchPad and HUZZAH32 (Source: Mouser Electronics)

LaunchPad HUZZAH32 Notes
Pin # Signal Pin # Signal  
30 DIO1 UART1 TX RX TX -> RX Serial transmit/receive
29 DIO0 UART1 RX TX RX <- TX Serial receive/transmit
5V +5V USB +5VDC Power
GND GND GND Ground Ground
18 DIO11 RST Reset Hardware Reset

 

The Setup

Code Composer Studio (CCS)

Web browse to the Code Composer Studio site and download CCS for your PC. Make sure SimpleLink CC13xx and CC26xx Wireless MCUs is included in the components to be installed. Connect the LaunchPad board to your PC and then launch CCS and allow it to apply any updates.

Click on the Resource Explorer tab and navigate through the Software tree to install the following components:

  • Software > SimpleLink CC13x2 26x2 SDK - x.xx.xx.xx
  • Software > SimpleLink SDK Plugins > SimpleLink Sensor and Actuator Pluging - x.xx.xx.xx

Components are installed by mousing over the component name until three vertical dots appear to the right of the component, then clicking the three dots and selecting Install from the menu that pops up. After a component is installed it will have a green or gray checkmark icon showing to the right of the component (Figure 5).

Code Composer Studio with SDKs Installed

 

Figure 5: Code Composer Studio with SDKs Installed (Source: Mouser Electronics)

Download and Open the Project Application Source Code Files

Web browse to the GitHub repository https://github.com/IoTDevLabs/ma15_files and find the TI_CC26X2R1_MediumOne_1.0.0.zip file. Download that file to your computer, but do not unzip it.

In CCS, select File > Import … and then Code Composer Studio > CCS Projects, then click Next. Checkmark Select archive file and click Browse … to pick the TI_CC26X2R1_MediumOne_1.0.0.zip you downloaded from GitHub. Click Select All and then click Finish. After a successful import, the Project Explorer window should look like Figure 6.

After Importing Projects into CCS

 

Figure 6: After Importing Projects into CCS (Source: Mouser Electronics)

We'll come back to the source code files later after setting up Medium One.

Set Up the Medium One Bridge Running on HUZZAH32

Web browse to GitHub repository https://github.com/IoTDevLabs/esp32_mediumone_bridge and follow the instructions for downloading the repository, installing the Arduino IDE and supporting libraries, opening the application program, and uploading the program to the HUZZAH32 board. After the HUZZA32 board is programmed, you can disconnect it from your computer.

Set Up the Medium One IoT Cloud

Web browse to the Medium One IoT Platform and log in, after which you should see an initial dashboard resembling Figure 3. If you have trouble logging in, check your Medium One credentials to make sure you're using the latest URL provided with your sandbox subscription. Click Setup > Manage Users > Add New User. Set Username to mydevice, create a password of your choosing and enter it in both password fields, then click Save. In the Manage API Users list, you should see a new user account having Login ID = mydevice and an auto-generated user MQTT ID like Figure 7.

Newly Created User ID

 

Figure 7: Newly Created User ID (Source: Mouser Electronics)

Click Setup > MQTT and you should see a Project MQTT ID and a set of port numbers like Figure 8.

Project MQTT ID

 

Figure 8: Project MQTT ID (Source: Mouser Electronics)

Medium One uses MQTT usernames and passwords for authentication. The MQTT username is created by combining the Project MQTT ID, a forward slash, and the user MQTT ID. For example, if the Project MQTT ID is "ZHxxxxxxx0Y" and the user MQTT ID is "sTxxxxxxx8w" the corresponding MQTT username would be "ZHxxxxxxx0Y/sTxxxxxxx8w".

Next, we'll create the MQTT password. Navigate to Setup > Manage API Keys > Add New API Key. Set the description to mydevice, make sure Enabled is check-marked, and click Save. The result should look like Figure 9.

Newly Created API Key

 

Figure 9: Newly Created API Key (Source: Mouser Electronics)

The MQTT password is created by combining the API Key, a forward slash, and the mydevice user password. For example, if the API Key is "PZxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMBQ" and the mydevice user password is "AaaaBbbb3" the corresponding MQTT password would be "PZxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMBQ/AaaaBbbb3".

Update Application Source Code Files for Medium One Account Parameters

 

Set Wi-Fi Connection Parameters

In Code Composer Studio, expand the sensor_mediumone_CC26X2R1_LAUNCHXL_tirtos_ccs project and open file sensor_mediumone.c. Find these constants and set them to your own Wi-Fi SSID and password:

  • WIFI_SSID
  • WIFI_PASSWORD

Set Medium One Connection Parameters

In sensor_mediumone.c, find these constants and set them to your own Medium One MQTT parameter strings as described earlier:

  • MQTT_USERNAME
  • MQTT_PASSWORD
  • MQTT_PUB_TOPIC

Save the modified file and build the project. Verify the code compiles without errors. If you see compilation errors, check the changes you made to sensor_mediumone.c.

Save the Application

Make sure the LaunchPad board is connected to the PC through USB and the boards are configured as described in the setup steps. Build the program and then download to the LaunchPad board and run it. Open the board's serial port in your serial terminal program and set the serial parameters to 115200,N,8,1. You should see messages on the serial port indicating the processing steps being performed.

How the Application Program Works

This program was created by modifying one of the TI example applications to work with the Medium One cloud. The high-level program flow includes:

  • Initialize hardware
  • Maintain processing state machine
  • Initialize serial connection to ESP32 bridge
  • Connect to Wi-Fi via bridge
  • Connect to Medium One MQTT broker via bridge
  • Periodically read sensors
  • Generate JSON formatted MQTT payload messages and send to Medium One MQTT broker via bridge

MQTT Payload Format

MQTT messages are formatted as JSON strings, according to the Medium One MQTT payload specification. Here’s an example message:

{"event_data":{"iteration":546,"timestamp":4650868,"temp":72.35,"humidity":40.178,"pressure":99.818 }}

Fields:

  • iteration = counter that increments by 1 each event_data message
  • timestamp = milliseconds since board started
  • temp = temperature in degrees F
  • humidity = relative humidity percentage
  • pressure = barometric pressure in KPa

Try heating or cooling the temperature sensor to see the data values change.

View Data in the Medium One Dashboard

In the Medium One dashboard, navigate to Data Viewer > Data Streams and click raw Events. You should see raw messages (Figure 10) being received. Click the “+” sign to view message details.

Raw Message Display

 

Figure 10: Raw Message Display (Source: Mouser Electronics)

Click Dashboard on the top left, then clickAdd Widget > Single User Real Time Events Stream to add an event stream widget to the dashboard.

In the Select user dropdown, select mydevice. You should now see messages appearing in the Real Time Events Stream widget (Figure 11). Click the dashboard save icon in the upper right corner to save your modified dashboard.

Real Time Events Stream Widget Display

 

Figure 11: Real Time Events Stream Widget Display (Source: Mouser Electronics)

Add More Widgets

To display more widgets, we need to enable specific data fields contained in the message payload. Navigate to Config > Data Streams and click on raw Events. The Schema Map should be pre-populated with fields detected in the incoming messages, however, they are currently disabled. Check-mark the Active box on raw.humidityraw.iterationraw.pressureraw.temp, and raw.timestamp, then click Save Data Stream. These fields are now available for use in other dashboard widgets.

Back on the dashboard, click the Single User Last Value Table widget and select the mydevice user within the widget. Click the widget’s Tag Config icon to the right of the mydevice user selection and check-mark raw:humidityraw:iterationraw:pressureraw:temp, and raw:timestamp, then click Save. The Last Value Table should now populate with the most recent received values for each field (Figure 12). Click the dashboard save icon toward the upper-right corner to save the updated dashboard.

Last Value Table Widget Display

 

Figure 12: Last Value Table Widget Display (Source: Mouser Electronics)

Now let’s add dashboard widgets for the temperature, humidity, pressure, and iteration counter. Click Single User Real Time Gauge and select the mydevice user. Click the widget’s Tag Config icon and check-mark raw:humidityraw:iterationraw:pressure, and raw:temp, then click Save. The updated dashboard should look like Figure 13. Click the dashboard save icon to save the updated dashboard. Try heating or cooling the temperature sensor to see the gauge values change.

Real Time Gauge Widgets Added to Dashboard

 

Figure 13: Real-Time Gauge Widgets Added to Dashboard (Source: Mouser Electronics)

At this point, your boards are running continuously, periodically reading the sensors and transmitting data measurements to the Medium One cloud through the Internet. Remember to power off the board when you’re done, otherwise, the board will continue to send messages to Medium One and consume daily message allotments.

Troubleshooting Tips

  • Make sure the board-to-board wiring is correct.
  • Make sure HUZZAH32 is set up and programmed according to the instructions.
  • Make sure Code Composer Studio is installed and configured according to the instructions.
  • View information messages on the LAUNCHXL-CC26X2R1 USB serial port.
  • View information messages on the HUZZAH32 USB serial port.

Conclusion and Where to Go Next

This project created an end-to-end sensor-to-cloud application that sends real-time sensor data to the Medium One IoT Platform through the internet. It can be modified and extended in a number of ways and here are a few examples:

  • Dive deeper into the application code and board hardware by reading the TI user guides and studying the source code.
  • Add more widgets to the Medium One dashboard, such as a real-time line chart of temperature and humidity readings.
  • Learn about the Medium One Workflow Studio, which lets you create data processing workflows to transform your sensor data.
  • Experiment with the Medium One mobile apps.
  • Modify the sensor data publishing interval by modifying the application source code.
  • Read other sensors on the BOOSTXL-SENSORS board and include the data in messages sent to Medium One.
  • Explore other TI BoosterPack boards that are available.

About the Author

Founder and CEO, IoT Development Labs. Greg is an architect, engineer and consultant with more than 30 years experience in sensors, embedded systems, IoT, telecommunications, enterprise systems, cloud computing, data analytics, and hardware/software/firmware development. He has a BS in Electrical Engineering from the Univ. of Notre Dame and a MS in Computer Engineering from the Univ. of Southern California.

Profile Photo of Greg Toth