TI SensorTag Starter Guide

Mikael KindborgBlogs, Tutorials

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+

TISensorTagCC2650_FrontIn this guide you will find everything needed to get started with creating mobile applications in JavaScript for the TI Bluetooth Smart SensorTag. With the SensorTag and Evothings Studio it is very easy to prototype and develop novel mobile IoT applications that can use all sorts of sensor data available to produce many types of applications. Read on to find out how to get started!

IoT made easy with the TI SensorTag

The TI Bluetooth Smart SensorTag is a new type of smart device that packs many different sensors into a small battery-powered unit. You can use the SensorTag for a wide variety of IoT applications.

It is perfect to use the device for quick prototyping, for example new kinds of fitness applications, various sensor-based alarms, interaction devices that use the accelerometer/gyroscope, game controllers, smartwatch prototypes, sports sensors and much more. For all these, mobile applications play a central role to display information to the end user.

With Evothings Studio it is easy to prototype and develop IoT applications that use the SensorTag. Use the open-source Evothings JavaScript library for the Bluetooth Smart SensorTag to get started quickly – it takes care of all the heavy lifting and both iOS and Android are supported. Find out the details below.

The Bluetooth Smart SensorTag uses Bluetooth Low Energy (BLE) to communicate with a mobile phone or tablet. There are also upcoming versions for WiFi and for 6LoWPAN/ZigBee. Support for these will be added to the Evothings Studio as they become available.

What you need to get started

Here is what you need to get up and running:

  • TI Bluetooth Smart SensorTag (order at the TI web site)
  • Evothings Studio (download for OS X, Windows and Linux)
  • Evothings Client app (install on iOS or Android phones/tablets, get it from Apple App Store or Google Play)
  • WiFi network that allows client connections (network client isolation must be disabled)
  • Basic knowledge of Evothings Studio (you can also learn as you go through this tutorial)
  • To build an application to distribute yourself you will need the Apache Cordova build tools

Good to know

If you are new to Evothings Studio, take a moment to read the Introduction in the documentation to get a basic understanding of the development tools used. We also recommend reviewing the Evothings Starter Guide.

Apache Cordova is a build system for creating native apps developed in HTML5 and JavaScript. You can use Evothings Studio without Cordova as we provide the Evothings Client app to run your applications in, but if you want to create your own application for publishing it is required. We have written a lot more on this topic in the Cordova IoT Starter Guide.

Run the example apps

Try out the TI SensorTag Accelerometer example

The quickest way to get started with the device and the development environment is to explore the SensorTag example apps that comes with the Evothings Studio download:

  • Launch Evothings Workbench on your computer
  • Launch Evothings Client on your mobile phone(s), press SCAN and connect to the Workbench running on your computer
  • Locate the example app “TI SensorTag Accelerometer” in the Workbench project list
  • Click RUN
  • Activate the SensorTag by clicking the activate button on the tag (see picture below)
  • Hold the SensorTag with front side up and tilt it to move the Evothings Logo on the screen.


Make changes to the code

Next step is to try out making some changes to the code:

  • Click CODE – this opens a file browser with the source code of the app
  • Open file index.html in a text editor and make some changes to the code. For example, change size of the #sprite element by changing the CSS width to this: width: 100px;
  • Save the file
  • The app will reload on all the connected mobile device(s) and reflect the updates

You can also change the image file sprite.svg to your own image. Any image file (PNG, JPG, GIF) work just fine, but remember to update the image reference in the HTML code, for example:

<img id="sprite" src="MyImage.png" />

Explore more example apps

You should also explore the other example apps for the SensorTag. Here is a quick overview of the examples:

  • TI SensorTag Accelerometer – move a UI object using the accelerometer (this example uses the high-level library tisensortag.js)
  • TI SensorTag Sensors – displays all the sensors available (uses the high-level library tisensortag.js)
  • TI SensorTag Demo – Charts sensor data on an HTML5 canvas (this is a low-level example that writes/read directly to the BLE services and characteristics of the SensorTag)

The TI SensorTag JavaScript library

The SensorTag high-level JavaScript library is in file tisensortag.js – it uses the easyble.js library which in turn uses the underlying native cordova-ble plugin. It has been written in a way to work transparently with the original SensorTag and the latest one available from TI.

On the Evothings API overview page you will find more information about these libraries and links to technical documentation.

A good way to get started is to examine the TI SensorTag Sensors example app that comes with Evothings Studio and see how the tisensortag.js library is used. This example is quite elaborate, and for a smaller example check out TI SensorTag Accelerometer.

How to create a custom SensorTag app

An Evothings application is just a folder with HTML/JavaScript files (and other assets such as CSS files and images). The minimal project is just a single HTML file.

A project needs to have a main HTML file, which is the file launched when the app starts. This file is typically named “index.html”. Simply drag and drop your main HTML file into the Workbench project list, it will be added seamlessly and then click RUN to start it.

Here is a quick summary of the steps required to create an app for use with Evothings Studio:

  • Create a folder for the app
  • Create content files (HTML, JavaScript, CSS, etc)
  • Add any JavaScript libraries needed
  • Drag the main HTML file into the Workbench window
  • Click RUN

A quick and easy way to create a custom application is to just copy an example app and modify it. You can use the one of the SensorTag example app, or any of the example apps as a starting point.

Build a native app

In order to build a native app, you will need to generate a Cordova project and copy or move your files to the “www” folder in the Cordova project. Read more about Cordova and how it works in the Cordova IoT Starter Guide.

Useful links

Get started now – up and running in 5 minutes

With Evothings Studio it is easy to prototype and develop IoT applications. Download Evothings Studio now and spend 5 minutes to get started. Order the TI SensorTag and familiarize yourself with Evothings Studio to be ready to hack away upon delivery of the device!