Tag Archives: IOT

Connect Tiva Connected Launchpad to Exosite Cloud using TI Simplelink WiFi CC3100

Connect Tiva Connected Launchpad to Exosite Cloud using TI Simplelink WiFi CC3100

Device Connection to Exosite Cloud

This project connects Tiva Connected Launchpad to Exosite Cloud using TI SimpleLink WiFi CC3100.

Features:

  1. Sends temperature data from Sensor Hub Booster Pack TMP006 Sensor to Exosite Cloud. The temperature data is displayed at a Exosite Dashboard Widget.
  2. Tiva Connected Launchpad on board led’s D2 and D3, are toggled on and off from Exosite Dashboard.
  3. Sends Tiva Connected Launchpad switch press count to Exosite cloud. The switch press count is displayed at a Exosite Dashboard Widget. Switch press count is limited to 15 only, for demoing purposes. The switch press count is reset to 0 after reaching the set limit of 15.
  4. Sends an email alert if Tiva Connected Launchpad on-board switch 1 press count have reached the set trigger level. This is set at Exosite Dashboard.

Hardware Block Diagram:

Hardware Block Diagram1

Hardware Setup:

IMG_0250
Sensor Hub BP connected to BP1 connector. CC3100 BP connected to BP2 connetor

Overall Pin Compatibility:

tivabp1sensorhub

tivabp2cc3100bp

bpchecker7
Using TI online Booster Pack Checker Tool

Exosite Cloud Overview:

onep_hierarchy_overview1
Photo Resource: http://docs.exosite.com/oneplatform

Exosite is a internet of things software as a service(Saas) company that provides a platform for Internet of Things.

Using the Exosite Platform, data from your device can be virtualized and represented graphically using Exosite Dashboard Widgets. Some Exosite Dashboard Widgets are Big Number Widget, Line Graph Widget, On/Off Switch Widget,  which all can be seen at the Exosite Dasboard screenshot below for this project.

Temperature data from my device is sent to Exosite Cloud and is being represented graphically at Exosite Dashboard, using Big Number Widget and Line Graph Widget.

exosite dashboard1

Note: More information about Exosite Services can be found at their website.

Exosite Dashboard

To display your data at a Exosite Dashboard Widget stored at a Dataport or Data Source named Sensor Hub BP Temp. Set it as Data Source for that Exosite Dashboard Widget. See, as shown above.

Exosite Terms:

  • CIK (Client Interface Key)
    • Device private key.
    • Generated when you make a new device at Exosite Portal Account.
  • Dataport
    • Data storage of time stamped values that can be written and read from.
  • Dataport Alias
    • Use to identify a Dataport.
  • Dataport Type
    • integer, float, string
    • For “string” type, the maximum size of a value that can be written is 64KB.

Tools to generate HTTP Requests to Exosite:

  1. curl command line tool.
  2. Exoline, a command line tool that works with Exosite Services.

Write to Exosite Dataport:

  • Using curl command line tool. Input below at Windows command prompt.
curl http://m2.exosite.com/onep:v1/stack/alias -H "X-Exosite-CIK: YOUR_CIK_HERE" -H "Accept: application/x-www-form-urlencoded; charset=utf-8" -d sensortemp=77"
  • Using Exoline. Input below at Windows command prompt.
exo write YOUR_CIK_HERE sensortemp --value=“77“
  • Using exosite write C API.

exosite_write(“sensortemp=77”, 13); 

Note: replace YOUR_CIK_HERE with your device CIK.

Read to Exosite Dataport:

  • Using curl command line tool. Input below at Windows command prompt.
curl http://m2.exosite.com/onep:v1/stack/alias?sensortemp -H "X-Exosite-CIK: YOUR_CIK_HERE" -H "Accept: application/x-www-form-urlencoded; charset=utf-8"
  • Using Exoline. Input below at Windows command prompt.
exo read YOUR_CIK_HERE sensortemp
  • Using exosite read C API.

char cbuffer[20];
uint16_t response_length = 0;
Read_status = exosite_read("sensortemp", cbuffer, 20, &response_length);

Note: replace YOUR_CIK_HERE with your device CIK.

Program Resources:

  1. TI Code Composer Studio 6.1.0.
  2. TI CC3100 SDK, SimpleLink API’s.
  3. Exosite C library for SimpleLink devices.
  4. Tivaware for Tiva Connected Launchpad.
  5. getting_started_with_wlan_station for Tiva Connected Launchpad + CC3100 BP.
  6. temperature_tmp006 example program for Tiva Connected Launchpad + Sensor Hub Booster Pack.

SPI communication between Tiva MCU and CC3100 BP:

  • SPI API’s are mapped to SimpleLink API’s.
    • spi_Open(), initializes the Tiva MCU SPI Peripheral and Interrupt to communicate with CC3100 BP.
    • spi_Open() is mapped to SimpleLink API sl_IfOpen().
    • sl_IfOpen(), is called within sl_Start().
    • sl_Start(), is called within your main function to start the SimpleLink device.

Basic steps to connect your device to Exosite:

  1. Initialize device.
  2. Connect device to WiFi Access Point using SimpleLink API’s.
  3. Create socket to Exosite using SimpleLink API’s.

exosite_write() and exosite_read() key facts:

  • Calls exosite_pal API which internally calls SimpleLink API sl_Socket(), that creates socket to Exosite.
  • Calls exosite_pal API which internally calls SimpleLink API sl_Send(), that sends data to an open TCP Socket.
  • Calls exosite_pal API which internally calls SimpleLink API sl_Close(), that closes socket to Exosite.

exosite_pal(Physical Application Layer) API’s:

  • Part of Exosite C Library for SimpleLink Devices.
  • Calls SimpleLink API’s.

Program Flowchart:

Presentation Flowchart1

 

Slide2

Program: wlan_station_exosite_write_read

Tera Term Output:

TeraTermExosite1

TeraTermExosite2

Tiva Connected Launchpad Led On/Off, from Exosite Dashboard:

 

Send switch press count to Exosite Dashboard:

Links to Resources:

  1. TI Code Composer Studio
  2. TI Tiva Connected Launchpad
  3. TI SimpleLink WiFi CC3100 BP
  4. TI Sensor Hub BP
  5. Exosite Documentation

Texas Instruments Booster Pack Checker Tool

bpchecker1

Texas Instruments recently release a online Booster Pack Checker Tool. The tool shows pin compatibility between Texas Instruments Launchpad and Booster Packs.

Without using the Booster Pack Checker Tool, to ensure that a TI Launchpad is pin compatible with Booster Pack, you would need to compare the pin outs using their board datasheets. Which would take some time and is for some a strenuous task to do. What I would do, before I connect a Booster Pack to my TI Launchpad, is that I would make pin out tables at Microsoft Excel . See, sample pin out tables below. The highlighted green table cells below indicates pin compatibility between Tiva Connected Launchpad Booster Pack 2 Interface Connector and CC3100 Booster Pack.

TivaBP2CC3100

Using the Booster Pack checker tool prevents unnecessary buying of Booster Packs that was thought to be initially compatible with their TI Launchpad. In some cases the TI Launchpad was damaged by interfacing to a Booster Pack that is not pin compatible.

The reason for Booster Packs to be not compatible with a specific TI Launchpad, is that many Booster Packs are designed for MSP430 Launchpad, since MSP430 Launchpad is one of the first TI Launchpad released in the market. These Booster Packs compatible with MSP430 Launchpad became not pin compatible with succeeding TI Launchpad, like TI Tiva Launchpad. However, you can interface a TI Launchpad to a not pin compatible Booster Pack by re-wiring the  pin connections using a protoboard.

Here below are some features of the TI Booster Pack Checker Tool.

  1. Shows incompatible Booster Packs. bpchecker2
  2. Shows pin compatibility status.bpchecker3
  3. For TI Launchpad with 2 Booster Pack Connectors,  there is a option to switch to either TI Launchpad Booster Pack Connector, for checking Booster Pack pin compatibility.bpchecker4
  4. You can check pin compatibility of stacking multiple Booster Packs to a TI Launchpad.bpchecker5

Some things to consider using the TI Booster Pack Checker Tool.

  1. Although, the TI Booster Pack Checker tool can indicate that several Booster Packs are stackable to a TI Launchpad, it does not show power requirements of each Booster Pack. Successful designs begin with adequate power. So, before interfacing multiple Booster Packs to a TI Launchpad, you need to make sure that they have adequate power.
  2. Although, the TI Booster Pack Checker tool can show pin compatibility of a TI Launchpad pin to a Booster Pack pin, you still need to check a TI Launchpad pin default function. MCU’s GPIO’s have multiple alternate function. Some MCU GPIO’s defaults as NMI or Non-Maskable Interrupt. For these MCU GPIO’s that defaults as NMI, you would need to re-configure that GPIO pin, to your desired alternate GPIO function using a code.

Using the TI Booster Pack Checker tool, I have confirmed that my Sensor Hub Booster Pack is pin compatible to Booster Pack 1 connector of my Tiva Connected Launchpad and my CC3100 Booster Pack is pin compatible to Booster Pack 2 connector of my Tiva Connected Launchpad.

bpchecker6

With my pin compatible, Tiva Connected Launchpad + Sensor Hub Booster Pack + CC3100 Booster Pack, I can send sensor data through WiFi, to a Cloud Service Provider like Exosite.

IMG_0250

See, project at the link below.

CONNECT TIVA CONNECTED LAUNCHPAD TO EXOSITE CLOUD USING TI SIMPLELINK WIFI CC3100

Send Notification from TI CC3200 Launchpad to Iphone4s using “If This Then That”

IFTTT or If This Then That provides a way to interact two web services in a “If This Then That” condition. The two web services that are paired up at IFTTT are called recipe.

At IFTTT setting both web services to work together are like cooking the web service ingredients to become one recipe.

Here are some recommended recipes from IFTTT:

  • Tweet your Facebook Status Updates
  • Save your new Instagram photos to Dropbox
  • Rain Tomorrow? Get notification
  • Save new texts your receive in a Google Spreadsheet
  • Get an email if there will be rain in your area tomorrow
  • Mute your phone when you arrive at work
  • Unmute my phone when I get home
  • Get Notified with your Teams Final Score
  • Document your daily activity in a Google Spreadsheet
  • Every day at 6 AM, add today’s weather report to my calendar

I am going to use TI Adrian Fernandez guide on “how to trigger an event with the Texas Instruments LaunchPad & the IFTTT Maker Channel”. From the guide, what is used is, MSP-EXP432P401R LaunchPad and CC3100 Wi-Fi BoosterPack from Texas Instruments. What I will use instead is TI CC3200 Launchpad. Using Energia Sketch I will just need to set the target board to “Launchpad w/ cc3200EMT (80MHz)”.

The ingredients for this IFTTT recipe are Maker Channel and Boxcar 2.

ifmthbsmall

The Maker Channel enables you to connect IFTTT to any microcontroller board that can make or receive a web request.

Boxcar 2 is an app, that provides notifications to your mobile phone. It provides services similar to Pushover and Parse Push Notifications.

I upload the Energia Sketch Project to my TI CC3200 Launchpad and run it.

Tera Term Output:

ifttt

Notification at my Iphone4s:

IMG_0238

Upon pressing the Notification, Boxcar App opens showing the Notification contents:

IMG_0239

Testing Parse quickstart example program using TI CC3200 Launchpad

parse
Successful Quickstart Test

Parse is one of those companies that offers public cloud services for IoT-enabled devices. Below, quoted from the Parse website.

“Instantly add a powerful cloud database, push notification services, and analytics tracking to your app. Choose from over thirteen native SDKs for mobile, desktop, and IoT devices and discover all that Parse has to offer”

Parse has chosen TI SimpleLink Wi-Fi CC3200 Wireless MCU to be one of the microcontroller platforms supported by Parse SDK. Surely is a good choice, since SimpleLink Wi-Fi CC3200 Wireless MCU has the reputation of being the industry’s first programmable Wi-Fi wireless MCU and having won several IoT industry awards.

Parse provides an example program to Send Push Notifications using TI CC3200 Launchpad. Here below is the link to Parse Guide for testing the example program “quickstart” using TI CC3200 Launchpad.

Parse Quickstart Guide using TI CC3200 Launchpad

As of this blog post writing the Parse Quickstart Guide and the Quickstart Program has issues. Your excitement following the guide will turn from enthusiasm to disappointment. Hopefully when you try out the Parse Quickstart Guide, Parse has already fixed the issues.

Two issues following the Parse Quickstart Guide.

  1. quickstart example program has build errors.
  2. At the guide it says there “Using Uniflash, open quickstart\uniflash\quickstart_release.ucf”. However there are no .ucf file at that folder location. What is there are two .usf files. These .usf files cannot be recognized by Uniflash.

Here are the quickstart build errors that I have encountered using CCS Version 6.0.0.00190

Description Resource Path Location Type
#10008-D cannot find file quickstart C/C++ Problem
#10010 errors encountered during linking; “quickstart.axf” not built quickstart C/C++ Problem
#10234-D unresolved symbols remain quickstart C/C++ Problem
unresolved symbol parseInitialize, first referenced in ./main.obj quickstart C/C++ Problem

After this I upgraded my CCS to Version: 6.1.0.00104, I got these build errors.

Description Resource Path Location Type
#10008-D cannot find file “C:/ti/CC3200SDK_1.1.0/cc3200-sdk/example/CC3200StarterProject-1.0.0/cc3200/samples/quickstart/../../../cc3200/src/Debug/libparse.a” quickstart C/C++ Problem
#10010 errors encountered during linking; “quickstart.axf” not built quickstart C/C++ Problem
<a href=”file:/C:/CCSV6/ccsv6/tools/compiler/dmed/HTML/10234.html”>#10234-D</a> unresolved symbols remain quickstart C/C++ Problem
unresolved symbol parseInitialize, first referenced in ./main.obj quickstart C/C++ Problem

The other build error messages are after adding the code lines mentioned at the guide.

I posted this problem at Texas Instruments E2E Community seeking advice how to resolve the build errors. TI E2E Guru Rafael De Souza, generously provided the solution to the build errors.

File Search Path Settings that results to build errorsquickstartwithoutfix

File Search Path Settings that resolves the build errors

desouzaquicstartfix

After, you have made the necessary changes at Code Composer Studio File Search Path Settings, build quickstart example program. The build errors should have been resolved.

At Code Composer Studio, press the “Debug” button, and “Run” quickstart example program

Following the Parse Quickstart Guide further down, click the “Test” button to send a push.

A successful push screen capture can be seen on the top of this blog post.

To send a custom push notifications, go to Parse Dashboard.

succesful push notification

To see the push details select your push notification at Parse Dashboard.

Push Details

Next, I will try to integrate this Parse quickstart example program to a mobile app.

Testing WLAN Station with CC3100 Booster Pack and Tiva Connected Launchpad

IMG_0218

The WLAN station example program using CC3100 connects to a Wi-Fi access point and then checks for internet connectivity by pinging “www.ti.com”.

Earlier version of CC3100 SDK only includes WLAN station example program for Tiva Launchpad. Several TI e2e members including me modify the WLAN station to work for Booster Pack 1 connector for Tiva Connected Launchpad. From Tiva Connected Launchpad and CC3100 Booster Pack photo on top of the post the Booster Pack 2 connector is at the right side of the Tiva Connected Launchpad, near the debug USB cable.

During my try to modify the WLAN station to work for Booster Pack 1 connector for Tiva Connected Launchpad, I downloaded a fresh copy of CC3100 SDK, and found a WLAN station example program for Tiva Connected Launchpad. I imported the WLAN station example program to my Code Composer Studio workspace for Tiva Connected Launchpad. I build it and I got a build error pointing out that my Tivaware Installation path is not setup at Code Composer Studio.

I corrected the Path Variable TIVAWARE_ROOT and set the folder location to my Tivaware installation directory (C:\EK-TM4C129)

To change Path Variables go to CCS Project Properties->Resource->Linked Resources.

I rebuild the WLAN station example program for Tiva Connected Launchpad and the build errors got resolved.

After reviewing the WLAN station example program for Tiva Connected Launchpad, I found out that it is setup for Tiva Connected Launchpad Booster Pack 2 Connector

Here below is the pin connections table of Tiva Connected Launchpad Booster Pack 2 Connector and CC3100 Booster Pack

.TivaBP2CC3100

The highlighted “green” cells at the table indicates the pin compatibility of Tiva Connected Launchpad and CC3100 Booster Pack.

At Code Composer Studio, I “run” the WLAN station example program and got the desired output at Tera Term.

WLAN Station output at Tera Term

wlanstation

Later on I got to review the WLAN station example program for Tiva Connected Launchpad, to learn in depth how the entire program works.

The WLAN station example program for Tiva Connected Launchpad is a good starting point for anyone, who want to develop products with similar application.

I hope this guide be of some help to those trying out the WLAN station example program with CC3100 Booster Back and Tiva Connected Launchpad.

Texas Instruments “Connect More With TI” Freebies

I just received another box today, containing more freebies from Texas Instruments.

  1. Cloud Shaped USB Thumb Drive.                                                       IMG_0118
  2. Bag.                                                                                                        IMG_0120
  3. Grey T-Shirt.                                                                                          IMG_0121
  4. Ball Pens.                                                                                              IMG_0123
  5. Screw Driver.                                                                                        IMG_0124
  6. Water Tumbler for Hot and Cold Drinks.                                                                           IMG_0126

Post Updates to Twitter from TI CC3200 Launchpad Using Temboo Choreo and Energia Sketch

Here is YouTube video below after I have copied the Temboo Choreo code to Energia and build without errors.

Requirements to post updates to Twitter from CC3200 Launchpad:

  1. You need a Temboo account. If you don’t have one yet, you can register for free here.
  2. Get the latest version of Energia Sketch here.
  3. Twitter account.
  4. A TI CC3200 Launchpad.
  5. A WiFi internet connection.

Register your Application at Twitter:

  1. You need to register your application at Twitter here.
  2. At the “Create and Application” page, enter your Application Name and Description at the corresponding fields. At the Website field, enter https://www.temboo.com/oauth_helpers/confirm_twitter/.
  3. Agree to the “Developers, Rules of the Road”, and then finish creating your Twitter Application.
  4. In order to post Tweets to Twitter, set Permissions to either Read and Write, or Read, Write and Access direct messages.
  5. At the Key and Access Tokens tab, generate your Access Token.
  6. Copy your Twitter Application Access Token, Access Token Secret, Consumer Key, and Consumer Secret.

Auto-Generate your Launchpad Energia Sketch Code from Temboo:

  1. Log in to Temboo, and go to Twitter->Tweets->StatusUpdate Choreo Library.
  2. Turn the IoT Mode switch to ON, and select Texas Instruments Launchpad from the drop down menu. Also, at “How is it Connected” drop down menu, select TI CC3200 Launchpad (Wifi) and provide the details of your WiFi internet connection.
  3. Enter your Twitter Application Access Token, Access Token Secret, Consumer Key, and Consumer Secret at the Input fields.
  4. Click “Run” to test the Twitter->Tweets->StatusUpdate Choreo. If there are errors after the test, means that you have a wrong value at the input fields. If pass, your C codes below are good to be copied into Energia Sketch. (YouTube video after step 4 is shown at the top of this post)

CC3200tembootwitter.c Energia Sketch code.

//CC3200tembootwiter.c

#include <WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account information

WiFiClient client;

int numRuns = 1; // Execution count, so this doesn't run forever
int maxRuns = 1; // Maximum number of times the Choreo should be executed

void setup() {
 Serial.begin(9600);
 
 int wifiStatus = WL_IDLE_STATUS;

 // Determine if the WiFi Shield is present.
 Serial.print("\n\nShield:");
 if (WiFi.status() == WL_NO_SHIELD) {
 Serial.println("FAIL");

 // If there's no WiFi shield, stop here.
 while(true);
 }

 Serial.println("OK");

 // Try to connect to the local WiFi network.
 while(wifiStatus != WL_CONNECTED) {
 Serial.print("WiFi:");
 wifiStatus = WiFi.begin(WIFI_SSID, WPA_PASSWORD);

 if (wifiStatus == WL_CONNECTED) {
 Serial.println("OK");
 } else {
 Serial.println("FAIL");
 }
 delay(5000);
 }

 Serial.println("Setup complete.\n");
}

void loop() {
 if (numRuns <= maxRuns) {
 Serial.println("Running StatusesUpdate - Run #" + String(numRuns++));

 TembooChoreo StatusesUpdateChoreo(client);

 // Invoke the Temboo client
 StatusesUpdateChoreo.begin();

 // Set Temboo account credentials
 StatusesUpdateChoreo.setAccountName(TEMBOO_ACCOUNT);
 StatusesUpdateChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
 StatusesUpdateChoreo.setAppKey(TEMBOO_APP_KEY);

 // Set Choreo inputs
 String AccessTokenValue = "xxxxxxxx";
 StatusesUpdateChoreo.addInput("AccessToken", AccessTokenValue);
 String AccessTokenSecretValue = "xxxxxxxx";
 StatusesUpdateChoreo.addInput("AccessTokenSecret", AccessTokenSecretValue);
 String ConsumerSecretValue = "xxxxxxxx";
 StatusesUpdateChoreo.addInput("ConsumerSecret", ConsumerSecretValue);
 String StatusUpdateValue = "Tweet! Tweet! from Markel's TI CC3200 Launchpad!";
 StatusesUpdateChoreo.addInput("StatusUpdate", StatusUpdateValue);
 String ConsumerKeyValue = "xxxxxxxx";
 StatusesUpdateChoreo.addInput("ConsumerKey", ConsumerKeyValue);

 // Identify the Choreo to run
 StatusesUpdateChoreo.setChoreo("/Library/Twitter/Tweets/StatusesUpdate");

 // Run the Choreo; when results are available, print them to serial
 StatusesUpdateChoreo.run();

 while(StatusesUpdateChoreo.available()) {
 char c = StatusesUpdateChoreo.read();
 Serial.print(c);
 }
 StatusesUpdateChoreo.close();
 }

 Serial.println("\nWaiting...\n");
 delay(30000); // wait 30 seconds between StatusesUpdate calls
}

TembooAccount.h Energia Sketch code:

/*
IMPORTANT NOTE about TembooAccount.h

TembooAccount.h contains your Temboo account information and must be included
alongside your sketch. To do so, make a new tab in Energia, call it TembooAccount.h,
and copy this content into it. 
*/

#define TEMBOO_ACCOUNT "xxxxxxxx" // Your Temboo account name 
#define TEMBOO_APP_KEY_NAME "myFirstApp" // Your Temboo app name
#define TEMBOO_APP_KEY "xxxxxxxx" // Your Temboo app key

#define WIFI_SSID "xxxxxxxx"
#define WPA_PASSWORD "xxxxxxxx"

/* 
The same TembooAccount.h file settings can be used for all Temboo sketches.

Keeping your account information in a separate file means you can share the 
main .ino file without worrying that you forgot to delete your credentials.
*/