Other Parts Discussed in Post: CC2650

In most Internet of Things (IoT) use cases there is a need to send sensor data to an IoT cloud solution. Data sent and stored in an IoT cloud solution can then be analyzed and utilized for a number of different purposes. For example, the SimpleLink™ multi-standard CC2650 SensorTag kit using Bluetooth® low energy can easily be connected to a mobile phone app, with the phone acting as a gateway for passing sensor data to the cloud.

In this two-part tutorial, we will show you how to use existing solutions to easily connect your SensorTag kit to the Amazon AWS (AWS) cloud. Some basic skills in web technologies and JavaScript are the only programming knowledge you need since the application is developed with these technologies. The application used in this tutorial can also be easily modified for other use cases.

In this first article, I will provide an overview of the different components needed and detail how the mobile application works. The second part of the tutorial will cover the hands-on steps to get the solution working.

The below information will show you how to connect the SensorTag kit to the AWS cloud, customize the solution for your own needs, and share tips on other solutions involving the CC2650 SensorTag kit and mobile applications.

What you need to follow this tutorial:

-        A SimpleLink multi-standard CC2650 SensorTag demo kit (CC2650STK)

-        An AWS account (easy to set up and free for basic usage)

-        A copy of Evothings Studio – an easy to download and install mobile application development tool that comes with example apps for the CC2650 SensorTag kit (the basic version is free to use)

-        30 minutes to complete the tutorial

Introduction to the CC2650 SensorTag kit:

The CC2650 SensorTag kit is an IoT demo platform designed to be used to develop a variety of different IoT solutions. The device has 10 low-power sensors, including a 9-axis motion sensor, magnetic sensors, temperature, humidity, pressure, ambient light and more. The heart of this device is an ARM® Cortex®-M3 processor with enough processing power for advanced uses. It is powered by a coin cell battery which is easy to replace. The embedded software pre-installed on the device can also be modified for other advanced applications.

Learn more about the SensorTag kit here

Introduction to Evothings Studio:

Evothings Studio is a mobile application platform tailored for Industrial IoT. Its purpose is to enable industrial companies and developers to rapidly and efficiently create mobile IoT applications. A focus area for Evothings is mobile applications for sensor platforms like the CC2650 SensorTag kit.

Evothings Studio includes several examples for the CC2650 SensorTag kit, along with many tutorials on how to combine the CC2650 SensorTag with mobile applications. Links to these different resources may be found below.

Introduction to the mobile application:

The mobile application used in this tutorial was developed with Evothings Studio using standard web technologies for both developing and customizing apps. Hybrid technology combines web and native applications, making it possible to use web technologies for development while still accessing advanced functions and APIs on mobile devices – features that reach beyond the capabilities of web browsers on a smartphone or tablet. One example is Bluetooth low energy. Evothings provides a comprehensive solution that makes it easy to use Bluetooth low energy for a number of use cases and IoT devices.

The application used in this tutorial has three basic main functions:

1.     Read sensor data from the SensorTag kit over Bluetooth low energy

The mobile application is preconfigured to read temperature data, but can be easily modified to use any of the other sensors. Each sensor corresponds to a Bluetooth low energy service, each with its own unique identifier (UUID). When a smartphone connects to the SensorTag kit, a list of the available services is returned.

Each service has a list of characteristics, holding data that corresponds to the current sensor values and other services such as Bluetooth radio signal strength and the device’s battery level.

There are two main methods for fetching sensor data from the TI SensorTag device.

  • readCharacteristic(): This approach reads the value once each time the function is called. In order to get new values continuously a loop is created around the function, which polls data at regular intervals.
  • enableNotification(): Once this method is enabled, an event listener is set and a corresponding callback function is called each time a sensor value is changed.

The latter method allows for more frequent readings and having multiple sensors configured to invoke notifications requires less call backs from each one.

2.     Send data to the AWS cloud using a standard HTTP connection

This internet connection is required either via cellular or Wi-Fi®. You must also set up an AWS account in accordance with the below instructions for the application to work.

 

In order to use AWS, a set of credential keys are generated for each instance when the cloud connection is initiated. The function evothings.aws.initialize() reads the configuration data containing permissions for reading and writing to the cloud.

Writing to AWS Lambda is as easy as variable name, its value and two callbacks, depending on a successful update or failure:

  • evothings.aws.update('Temperature', temperature, successCallback, errorCallback)

AWS Lambda uses a standard RESTful API to expose HTTP endpoints which can use regular web calls like GET and POST over HTTP.

3.     Read sensor data from the AWS cloud and display the information in the app

Values are stored in a Dynamo.db database where the apps use two methods to access the stored data from the SensorData table.

  • The Update() function stores each value along with a Timestamp and Sensor ID, allowing several sensors to be recorded in the same time series.
  • The Query() function retrieves and sorts the 20 most recent sensor readings, each with its sensor ID handle, returning an array of these values.

Other application use cases in the Evothings studio also cover different IoT technologies, security solutions and more. By combining code from the different examples, more comprehensive solutions can be developed within a limited time frame. The applications may also be built for iOS or Android and published to the corresponding stores.

In part 2 of this series we will cover how to perform the tactical steps for getting the AWS cloud and mobile application working together with the CC2650 SensorTag kit. Stay tuned for more next week!

Additional resources:

Anonymous