The purpose of this guide is to get user's up and running with the SimpleLink CC3220SF LaunchPad and Educational BoosterPack MKII. The user will also be exposed to the basics of adding internet connectivity to a design using Temboo.
The IDE in this tutorial will be CCS Cloud, but we will be using the Energia framework, which utilizes the Wiring/Arduino APIs, available inside of CCS Cloud. CCS Cloud features faster compilation and enhanced debug capabilities on the CC3220SF over the Energia IDE. You can still run these labs in Energia IDE if you prefer.
Before we begin, please ensure you:
1. Sign up for a myTI account to access CCS Cloud. If you already have one (access to online resources, samples, store), you can login at http://dev.ti.com. Chrome browser is the recommended web browser for this experience.
a. When you first log in to CCS Cloud, the helper text will walk you through installing the drivers, cloud agent, and browser extensions. CCS Cloud is compatible with Mac OS, Windows, and Linux. When installing the extensions, you may need to refresh your page a few times.
2. Create an account on Temboo.com.
3. (Optional) Create a twitter handle on Twitter.com. This is not necessary as we have a dummy handle that you can use in this exercise, but if you wish to use your own twitter it is very easy to switch over.
Lab 1: Blink a LEDThe goal of this lab is to verify the hardware and software is setup correctly and to give the student a first taste of rapid prototyping in Energia. Blinking an LED is the "Hello World" of electronics and is often the first thing done on new hardware.
1. Plug in your LaunchPad with the supplied USB cable.
2. Open up CCS Cloud in your browser (http://dev.ti.com)
a. If this is your first time running CCS Cloud you will need to install the browser extension (firefox or chrome) and the TI Cloud Agent.
3. Go to File > New Energia Project
4. Under device, select CC3220 ARM -> CC3220SF-LAUNCHXL (80MHz).
5. Under Basic Examples, Select Blink.ino and click Finish.
6. Examine the code to see the basic structure of the program.
a. All Energia programs have two required functions: setup() and loop(). Setup is run one at startup and then loop runs continuously.
b. pinMode() is used to set the direction of a GPIO.
c. digitalWrite() is used to set the state of a GPIO.
d. delay pauses execution for a given number of milliseconds.
7. To upload the code, click the Run or Flash button at the top right. This will compile and upload your program to the board. If you would like to do a compile only of your code without flashing you can click the hammer icon to build your project.
a. You may be prompted to update your firmware. Click update and continue.
8. After programming completes verify that the redLED is blinking on your LaunchPad.
9. To take this a step further try:
a. Fading the LEDs by changing the calls from digitalWrite() to analogWrite().
b. Try using the other LEDs on the board
i. RED_LED
ii. GREEN_LED
Lab 2: Educational BoosterPackThe goal of this lab is to familiarize the student with the concept of a BoosterPack and how software libraries can speed development of advanced applications. You can find the example code inside of Energia and on www.energia.nu/edumkii.
1. Plug the Educational BoosterPack MKII into the LaunchPad’s BoosterPack headers.
2. From the File menu at the top of the window ,select New Energia Project. Under device, select CC3220 ARM -> CC3220SF-LAUNCHXL (80MHz). Under Examples -> 09.EducationalBP_MKII -> AccelerometerLED. Click Finish.
3. Read through the code. There is a line you will need to uncomment in order to change the ADC resolution so the example works correctly. Uncomment this line before proceeding to the next step.
4. Click the the Run or Flash button. This will compile and upload your program to the board.
5. Verify the color of the RGB LED changes when you tilt the board.
6. Dance around with your LaunchPad like you were at a rave.
a. If you want to read the serial data: From the Target menu at the top of the window, select Connect COM Port, and then pick the serial port associated with your CC3220SF Launchpad and the correct baud rate (115200 is common). You can view the serial data in the debug window under the Serial tab. If it looks unreadable you can try hitting the reset button on your LaunchPad.
7. Experiment with other examples for the Educational BoosterPack. Try combining multiple examples to build a full application. You can find more information about the examples at www.energia.nu/edumkii.
a. This time is meant to be free form so you can experiment and learn on your own.
b. If you wish to try once of the LCD examples you'll need to do a special workaround to fix a bug on the CC3220SF. The error will say "Platform not supported"
1. Delete the EduBPMKII_Screen folder
2. upload the the files in this zip folder to the main LCD example folder
3. Change the .ino to include the local files. Replace #include <LCD_Screen.h> etc. with #include "LCD_Screen.h"
4. Now you should be able to build the project.
When you feel you have a good grasp of the EDUMKII you can move on to the next section.
Lab 3: IoTThe goal of this lab is to introduce the student to the basics of adding internet connectivity to an application.
The stack should now be Educational BoosterPack MKII + CC3220SF-LAUNCHXL
NOTE: If you are at a location that requires your MAC address to be registered before you can connect, download the getMAC program from the bottom of this page, compile, and run it on your LaunchPad. Open the serial monitor and reset the board by pressing the reset push button. The MAC address should now be displayed in the serial terminal. Make note of the address and register your device on the network.
Part 1: WeatherFor the lab, we are going to use the Temboo cloud service to get the weather report whenever we push a button. Go to www.temboo.com/hardware/ti and sign up for an account. Once logged in find the GetTemperature API under Yahoo > Weather > GetTemperature.
Make sure Texas Instruments is selected from the top menu and IoT mode is on. You can add a new connection which will let you type in your WiFi router information.
Enter the address you want to get the temperature from and Temboo will generate the Energia code for you. You can click the send to CCS Cloud button and it should import the project into your workspace.
Make sure to include the TembooAccount.h. It should be included in the import but can also be done manually. To add this right click the project folder and select new file. Call the new file TembooAccount.h and press enter. You should have a blank area where you can paste the TembooAccount.h information.
When you upload the code, go to Target > Connect COM port and check the Serial output and you should see the LaunchPad connecting to Wi-Fi and getting the temperature data.
The Temboo site does a great job of explaining how to use their APIs so refer there for additional help.
Part 2: Twitter1. Create a new program in CCS Cloud (File -> New Energia Sketch). Call it Twitter and select Empty Sketch.
2. Go to your Temboo account and navigate to the Twitter Choreos. Once there, go to Tweets, Statuses Update
3. Make sure Texas Instruments is selected and IoT mode is on. You can add a new connection which will let you type in your WiFi router information. If you did this in part 1 it should be saved.
4. Start typing in the fields for the connection box. Scroll down this page and copy the contents of the header file box.
5. Make sure to include the TembooAccount.h. To add this right click the project folder and select new file. Call the new file TembooAccount.h and press enter. You should have a blank area where you can past the TembooAccount.h information.
6. Paste the contents of the header file box into TembooAccount.h
7. Update the WIFI_SSID #define to reflect your wireless network.
a. If your network has a password create a new#define called WPA_PASSWORD and type your password in quotes
8. On Temboo, copy the contents of the Code box and paste them into the main Temboo.ino file. Be sure to select everything in that sketch before replacing it with the code from Temboo.
9. You can copy the code from the provided LCD_Joystick+Twitter.ino file at the bottom of this Hackster page. If you are making changes manually, Add the following lines to your program:
// Set Choreo inputs
StringAccessTokenValue ="3361531038-PfYFeP3r9ykZ9hZzWCcsaQp4AHSHAX0BcBbVQ2K";
StatusesUpdateChoreo.addInput("AccessToken",AccessTokenValue);
StringAccessTokenSecretValue = "RzlVqDmPHKaD1L315bvJ2MqhKfJW7Zsr76YfkomuKrL2a";
StatusesUpdateChoreo.addInput("AccessTokenSecret",AccessTokenSecretValue);
StringConsumerSecretValue ="f1S7cqL2aJi3HVyFOnQ9wCihao0080OIQxm0rpp41AB1yc91xJ";
StatusesUpdateChoreo.addInput("ConsumerSecret",ConsumerSecretValue);
StringConsumerKeyValue = "oa1pgd6ibazJFOa8X9Gp5BrmF";
StatusesUpdateChoreo.addInput("ConsumerKey",ConsumerKeyValue);
StringStatusUpdateValue = "Look ma, I'm on twitter!";
StatusesUpdateChoreo.addInput("StatusUpdate",StatusUpdateValue);
These lines should be placed right before the call to StatusesUpdateChoreo.run(). For the tweet to be successful it needs to be unique so please change the text. Twitter will prevent duplicate messages from being sent within a certain time frame.
No Shenanigans Please!
10. Click the Run button to compile and upload the code to your board. Open the serial console to view the debug output.
11. If everything looks ok in the serial monitor, goto twitter.com/iotdump and see if your tweet was successful.
12. Experiment by combining this twitter functionality with some of the example for the Educational BoosterPack. For example you could use the LCD_Joystick example to send out the coordinates of the cursor on screen whenever Button 2 is pressed.
a. A completed example of this is provided in the code section below.
ConclusionThat is a good sample of basic IoT prototyping with TI LaunchPad. There is obviously a lot more to do with Temboo or other cloud services that are accessible through Energia libraries. There are also many hardware combination to try when connecting things wirelessly. You can learn more about the TI LaunchPad ecosystem at www.ti.com/launchpad and explore the Energia website for more ideas and help.
Comments