Table of Contents

Introduction

The Sensors BoosterPack code example is a feature-rich code example that utilizes a variety of different sensors on the Sensors BoosterPack. Each sensor has it’s unique BLE profile and provides all relevant data from periodic sensor readings. When possible, each sensor characteristic tries to present readings in a human readable format (such a floats for temperature data) and provides a format presentation descriptor for convenience.

Hardware Prerequisites

The Sensors BoosterPack code example requires the standard configuration of an MSP-EXP432P401R LaunchPad with an attached BOOSTXL-CC2650 BoosterPack. Additionally, the Sensor BoosterPack code example requires the use of the Sensors BoosterPack. There is no specific order of stacking the LaunchPad/BoosterPacks, however to easily get to the sensor for testing it is recommended to put the Sensors BoosterPack on top. This hardware configuration is shown in the below image:

Sensors hardware setup

Note that due to memory limitations on the CC2640R2 SNP the CC2650 BoosterPack must be used.

For reference, the sensors that are included on the Sensors BoosterPack (and utilized in this code example) are as follows:

Software Prerequisites

This code example has been tested with IAR Embeded Workbench 8.20, Code Composer Studio v8.0, and gcc-arm-none-eabi-6-2017-q1-update. For more information on how to import this project into your IDE workspace and build/run, please refer to the main user’s guide.

Note that this code example relies heavily on the Sensor and Actuator Interface Library (SAIL) Plugin. The SAIL plugin will provide all necessary software libraries and sensor interfacing APIs that are used to read out sensor data from the Sensors BoosterPack. This plugin must either be downloaded manually from the SAIL Plugin Product Page or from TI Resource Explorer in order for this code example to work correctly.

Service/Profile Table

Purpose UUID Format Unit Properties Profile Source
IR Temperature Data F000AA01-0451-4000-B000-000000000000 IEEE-754 32-bit floating point °C Notify ir_temp_service.c
IR Temperature Config (enable) F000AA02-0451-4000-B000-000000000000 Integer N/A Read/Write ir_temp_service.c
IR Temperature Notification Period F000AA03-0451-4000-B000-000000000000 Integer ms Read/Write ir_temp_service.c
Humidity Data F000AA21-0451-4000-B000-000000000000 IEEE-754 32-bit floating point Percent Notify humidity_service.c
Humidity Config (enable) F000AA22-0451-4000-B000-000000000000 Integer N/A Read/Write humidity_service.c
Humidity Notification Period F000AA23-0451-4000-B000-000000000000 Integer ms Read/Write humidity_service.c
Barometer Data F000AA41-0451-4000-B000-000000000000 Integer Pascals Notify barometer_service.c
Barometer Config (enable) F000AA42-0451-4000-B000-000000000000 Integer N/A Read/Write barometer_service.c
Barometer Notification Period F000AA43-0451-4000-B000-000000000000 Integer ms Read/Write barometer_service.c
Optic Data F000AA71-0451-4000-B000-000000000000 IEEE-754 32-bit floating point lux Notify optic_service.c
Optic Config (enable) F000AA72-0451-4000-B000-000000000000 Integer N/A Read/Write optic_service.c
Optic Notification Period F000AA73-0451-4000-B000-000000000000 Integer ms Read/Write optic_service.c
Movement Data F000AA81-0451-4000-B000-000000000000 Integer Custom Notify movement_service.c
Movement Config (enable) F000AA82-0451-4000-B000-000000000000 Integer N/A Read/Write movement_service.c
Movement Notification Period F000AA83-0451-4000-B000-000000000000 Integer ms Read/Write movement_service.c

Usage

Once the sensors code example starts the output to the terminal will notify the user of initialization and then set the state of the application to idle:

Sensors Initialization

In idle mode, the application is in a low power mode and not actively advertising. In order to start advertising, the S1 switch on the LaunchPad needs to be pressed. The S1 switch can be found on the left side of the LaunchPad as pictured below:

Button Positions

Once the S1 button is pressed, the device will start advertising itself with a device name of “MSP432 SensorHub”. Also note that once advertising (and while connected) the LED on the MSP432 LaunchPad’s LED1 pin is turned red to signify activity.

Device list

After connecting to the MSP432 SensorHub device, the terminal screen should print that the peer was connected and also print the ID of the peer:

Connection Log

At this point the device is connected and successfully negotiated the connection details. Scrolling down past the product information (this might be different depending on your client) there should be a list of four different characteristics and their corresponding properties/values (these are described in detail in the following sections):

Characteristic list

Note that for each sensor service there are three different characteristics. The first characteristic (data) is a notification characteristic of the actual read sensor value. This notification only starts when an integer value of 1 is written to the second (conf) characteristic. Without writing a 1 value to the conf characteristic no data will be sent to the data notification characteristic. Writing a value of 0 to this characteristic will subsequently halt notifications. The third characteristic (period) is the period (in ms) of the notifications and can be changed at the user’s preference. The enabling/disabling of data notifications for each individual sensor is omitted from the subsequent systems for the sake of simplicity.

Also note that multiple notifications can be enabled in parallel without issue. All of the enabling of sensor notifications is logged through the UART console:

Notifications log

IR Temperature Data (UUID: F000AA01-0451-4000-B000-000000000000)

The temperature service gathers sensor readings from the TI TMP007 optical sensor. This is a contactless temperature sensor that can read temperature values at variable distances. Once enabled, place your finger on (or right above) the TMP007 sensor on the BoosterPack and you should see the temperature steadily rise. Note that for legible temperature readings you might need to set your mobile application to display float values.

Temperature data

Humidity Data (UUID: F000AA21-0451-4000-B000-000000000000)

The humidity service probes the Bosch BME280 sensor for a humidity reading and presents it as a percentage in float format. Once enabled, breath with some humidity directly on the BME270 sensor and you should see the humidity steadily rise (unless you are performing this test in a jungle somewhere). Note that for legible temperature readings you might need to set your mobile application to display float values.

Humidity data

Optical Data (UUID: F000AA71-0451-4000-B000-000000000000)

The optical service provides ambient light data (in lux) via the TI OPT3001 ambient light sensor. Once enabled, shine a bright light on the OPT3001 (perhaps with your phone’s LED) and you should see the lux value steadily rise. According to Wikipedia, the average lux level of an office environment is around 80 lux so shining an LED directly into the sensor should cause it to jump to around 2000 lux (as seen below):

Optic data

Barometer Data (UUID: F000AA41-0451-4000-B000-000000000000)

Barometric pressure information is provided by the Bosch BME280 sensor and is presented in Pascal units as an integer value. After enabling the service, a steady stream of barometric pressure notifications should occur. Also according to Wikipedia, the standard barometric pressure is 101325 Pascals- so use this as a benchmark if you are living on Earth.

Barometric data

Movement Data (UUID: F000AA81-0451-4000-B000-000000000000)

The movement service provides several different positional and movement measurements from the Bosch BMI160 - accelerometer/gyrometer/magnetometer. The measurement format for this characteristic is a bit unique and consists of an 18 byte array with three different 6 byte sections. Each 6 byte sections contains the x/y/z measurements from the respective sensor.

Movement data

For example, say that the sensor broadcasts a complete 16 byte array of values as:

0x010000000000 DEFFC5FFD83F 53FFB9FEA301

Parsing out each sensor reading, we would have:

Parsing out either further (and converting from little endian):

Note these values are parsed directly from the BMI160 registers readings. For more information on how to interpret the values, please refer to the BMI160 sensor datasheet.

SimpleLink SDK Explorer

SimpleLink SDK Explorer is a customized mobile application from Texas Instruments that is designed to compliment various aspects of the SimpleLink SDK mobile ecosystem. Currently this application is available for iOS and Android devices. The code examples included in the SimpleLink SDK BLE Plugin are fully modeled and showcased as a part of SimpleLink SDK Explorer. From the Apple AppStore or Google Play Store search for SimpleLink SDK and download the SimpleLink SDK Explorer.

The app can also be found at the links below:

Apple AppStore: https://itunes.apple.com/us/app/simplelink-sdk-explorer/id1237329921?ls=1&mt=8

Google Play: https://play.google.com/store/apps/details?id=com.ti.simplelinksdkexplorer&hl=en

Additionally, the full BSD licensed source code for both applications can be found at the link below: https://www.ti.com/tool/download/SIMPLELINK-SDK-BLUETOOTH-PLUGIN

Open the mobile application once it has been downloaded:

SimpleLink SDK Explorer Main Menu

From the main screen select the Profile Examples menu item. This will take you to a list of profile examples that correspond to each code example in the SimpleLink MSP432 SDK Bluetooth Plugin:

SimpleLink SDK Explorer Profiles

Select the Sensors BoosterPack menu item. On the next screen SimpleLink SDK Explorer will automatically scan for BLE devices in your vicinity. Make sure Bluetooth is enabled on your iOS device or else no devices will show up in this view. After pressing S1 on your MSP432 LaunchPad the Sensors Code Example will start to advertise and show up as “MSP432 SensorHub”:

SimpleLink SDK Explorer Device View

Select this device. After a series of negotiation and handshaking the sensors overview is displayed:

SimpleLink SDK Config

All sensors will automatically be enabled and the period of each sensor will be set to a period of 100ms. Each sensor task will also have an associated graph view. These graphs are accessible through the tab bar located at the bottom of the screen. Click on the movement tab to open the gyrometer graph:

SimpleLink SDK Explorer Graph

One the graph view you will have the ability to change the period of the sensor sampling rate. Move the LaunchPad around on the screen and you will see the X, Y, and Z values change on the graph and value labels accordingly.

SBL Update

Updating the firmware on the CC2650 BoosterPack uses the SBL libraries to invoke the CC2650’s bootloader and transfer the new firmware over serial. For Sensor BoosterPack, the method to trigger this invocation is to press and release the S2 button on the LaunchPad. Note that in order to trigger the firmware update, no active BLE device can be connected. Once S2 has been pressed, LED2 on the LaunchPad will toggle red to signal the BSL start:

SBL LED

*** Note that due to memory limitations in the CC2640R2 the CC2650 must be used for the Sensors BoosterPack example. ***

The console screen will print the status of the firmware update as well as signal when the update has finished. At the end of the update the status of the update will be printed over the serial port and the MSP432 will reboot itself:

SBL log