TI CC3200 Launchpad

Notes for getting started using the TI SimpleLink WiFi CC3200 Launchpad with Energia.

Out of the Box Demo

To validate the operation of the board it is a good idea to work through the out of the box demo. To test the operation only do steps 1 and 2. This lets you configure the SSID and password so that you can connect the CC3200 to your WiFi router. The demo code running on the CC3200 implements a simple server which you can access over the local network, by entering the IP address of the CC3200. The server provides and interface to toggle the on board LEDs and to get readings from the on board accelerometer and temperature sensor.

The configuration approach whereby the CC3200 initially boots as an ad hoc open access point so that you can connect to it and then configure the settings on the CC3200 in order that it can connect to a wireless gateway upon rebooting is an approach that is often used to configure WiFi based IoT things e.g. The Edimax Smart Plug, Belkin Wemo.

Getting started with Energia – Blink

First have a look at the Energia CC3200 overview

  1. Before plugging in the USB cable follow the instructions to install the CC3200 serial drivers for your operating system
  2. Follow the hardware setup guide to install the jumper cable as shown in the Energia CC3200 hardware guide. Typically you do not not need to update the firmware. However it is often a good idea to
  3. Plug in the USB cable
  4. Open File>Examples>Basics>Blink
  5. Select the correct board Tools>Board>LaunchPad w/cc3200 EMT (80MHz)
  6. Select the correct serial port. On the Mac / Linux  something like cu.usbserial-cc3101B. On Windows ComXX to see with port simply unplug the USB cable and see which port disappears.
  7. Click the upload button.
  8. The program should compile and upload. Upon successful upload the red LED will be blinking.

Note choosing the LaunchPad w/cc3200 EMT (80MHz) version allows you to use Energia’s multitasking (EMT) support which is based on the TI RTOS (Real time operating system).

Demo Energia Code

Demonstration code showing the functionality of the CC3200 is available from my github IoT repository. I suggest you download all the examples as a zip file. And then extract these into your Energia Sketchbook folder. The location of your Energia Sketchbook location can be found in Energia>Preferences. The example will then appear in File>Sketchbook>CC3200_IoT_Examples after you restart Energia

Reading Sensor Values

The CC3200 Launch has a temperature sensor and a three axis accelerometer included on the board. To test the operation of these we are going to use the CC3200_Sensors example that queries the Thermopile temperature sensor (TMP006) and Three axis accelerometer (BMA222)  outputs the readings to a serial console.

To open the sensor console click the magnifying glass icon in the top RHS of the Energia IDE. You will also need to set the baud rate to 115200.

We now want to enhance BMA222 code to use more of the available hardware functionality. As an example we are going to add a function to the BMA222 class to query the temperature of the BMA222.

  • Add the temperature register address to the BMA222.h header. The temperature register definitions are given on page 39 of the BMA222 Datasheet.

#define BMA222_TEMP           (0x8)

  • Add the function prototype to the public class definition in BMA222.h tab
double readTemp();
  • Then add the new function to the BMA222.cpp tab

double BMA222::readTemp()
{
return 0.5*readReg(BMA222_TEMP)+24.0;
}

  • Finally to use this function. Call the new function from within the main loop of the CC3200_Sensors tab.

Serial.print("Acc Temp: ");
Serial.println(accSensor.readTemp());

Realtime Operating Systems

The CC3200_Sensors_Event example shows how create multiple events using the EMT environment. In this example we show how to use an interrupt from the BMA222 to wake up the CC3200 and report back the action. To connect the interrupt it is necessary to install jumper J4(INT) on the launchpad.

CC3200 and ThinkSpeak IoT service

See here for getting started with this the ThinkSpeak service and the CC3200. ThingSpeak is an IoT service / playground provided by Mathworks (The Matlab people). It is good for experimenting with IoT things but not scalable. It is also limited to publishing once every 15 seconds or more.

Connecting the CC3200 to the IBM Bluemix IoT Service

Here we are going to upload a program that allows the CC3200 to connect to a WiFi access point using  a SSID and password and acts as an MQTT client publishing sensor data to the IBM IoT MQTT broker. For more information on MQTT read here.

The IBM IoT MQTT broker can either be used in QuickStart or Registered mode. The QuickStart mode does not require Authentication and allows anyone to access your published data. In registered mode you need to add the device to your IoT Foundation Service and use the authentication credentials provided. Here we will use the registered mode.

Download the Energia code for this example here

  1. Edit the SSID and password to match your router
  2. Upload the Energia code to the CC3200 and let it run
  3. You can observe the progress on the serial monitor. Note the baud rate is 115200.
  4. The CC320 should connect to your WiFi Router and obtain an IP address it will also print the MAC address.
  5. Copy the MAC address and follow the instructions here to add a new device to your IoT foundation service.
    • Device Type: iotsample-ti-cc3200
    • MAC: You device MAC (without the colons and in lower case)
  6. Once you have added the device to your IoT service you will be given an authentication token. YOU MUST SAVE THIS SOMEWHERE as it cannot be recovered at a later date.
  7. Edit the typeId and authToken variables to match those given when the device was registered with the IBM IoT Service.
  8. Upload the modified code.
  9. The published results should now be visible on your IoT Service.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s