To do the workshop, you will need an MSP-EXP432P401R LaunchPad development kit. To find more about the specs of the MSP432 LaunchPad go to www.ti.com/tool/MSP-EXP432P401R. To find more information about LaunchPad go to www.ti.com/launchpad. You will also need a servo, the Educational BoosterPack MKII (BOOSTXL-EDUMKII), and the CC3100 SimpleLink Wi-Fi BoosterPack (CC3100BOOST).
The workshop should run about 2 hours. There is about 30 minutes of lecture material found in the slides below. The rest of the time is devoted to hands on learning. During the lecture make sure your programming environment is set up to save time for the exercises.
In order to program the example code, you will need to download the Energia IDE. You can find the latest version 17+ at www.energia.nu/download. Alternatively, You may use CCS Cloud IDE, which can be found at dev.ti.com. Login with your myTI account or create a new one. No large installation required and your workspace is saved in the cloud. For your reference, compilation time on the MSP432 is faster in CCS cloud and there are advanced debugging features not available in the simplified Energia IDE.
IntroductionThe purpose of this guide is to get user's up and running with the new MSP432 LaunchPad and Educational BoosterPack MKII. The user will also be exposed to the basics of adding internet connectivity to a design using Temboo.
We will be using the Energia framework, which utilizes the Wiring/Arduino APIs, available inside of Energia IDE or CCS Cloud. CCS Cloud features faster compilation and enhanced debug capabilities on the MSP432 over the Energia IDE. You can still run these labs in Energia IDE if you prefer.
Energia IDEBefore we begin, please ensure you:
1. Download the Energia IDE to your local machine at www.energia.nu/download
a. Energia IDE is compatible with Mac OS, Windows, and Linux. Depending on your OS you may need to download drivers so your LaunchPad can be recognized. Go to www.energia.nu/guide and select your OS instructions and select your board to find the drivers.
2. Create an account on Temboo.com. www.temboo.com/hardware/ti
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.
4. Open your LaunchPad box and connect it to your computer with the included USB cable.
5. Connect your CC3100 BoosterPack to your LaunchPad (top or bottom). Make sure it is oriented correctly the USB port should be sticking out on the right side. “CC3100BOOST Rev 4.0” should be readable
6. Connect your Educational BoosterPack MK II to the LaunchPad (top). Make sure it is oriented correctly, the joystick should be on the left
7. Connect your Servo Motor to the Educational BoosterPack MKII servo connector. Your servo will be connected to pin 19 with the BoosterPack.
Lab 1
First make sure your development environment is correctly set up. We will run the blink example by going to File > Examples > Basics > Blink. Upload the code using the right arrow button next to the check mark button. If the LaunchPad LED blinks at a 1 second interval without errors you are ready. If it does not, you may need to install the drivers for your LaunchPad under the Getting Started Guide installation instructions. Go to www.energia.nu/guide and select your operating system and then find the LaunchPad you have (MSP-EXP432P401) and you will find the link to download the drivers.
The 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.
1. Plug in your LaunchPad with the supplied USB cable.
2. Open Energia.
3. From the Tools menu at the top of the window, select Boards -> LaunchPad w/ MSP432 EMT (48MHz).
4. From the Tools menu at the top of the window, select Serial Port, and then pick the serial port associated with your MSP432 Launchpad.
5. From the File menu at the top of the window, select Examples -> 01. Basics -> Blink. This will open the blink example program.
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. Click the red arrow pointing to the right at the top left of the Energia window. This will compile and upload your program to the board.
8. After programming completes verify that the red LED 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 colored LEDs on the board
i. RED_LED
ii. GREEN_LED
iii. BLUE_LED
CCS Cloud IDEBefore 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.
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.
4. Open your LaunchPad box and connect it to your computer with the included USB cable.
5. Connect your CC3100 BoosterPack to your LaunchPad (top or bottom). Make sure it is oriented correctly the USB port should be sticking out on the right side. “CC3100BOOST Rev 4.0” should be readable
6. Connect your Educational BoosterPack MK II to the LaunchPad (top). Make sure it is oriented correctly, the joystick should be on the left
7. Connect your Servo Motor to the Educational BoosterPack MKII servo connector. Your servo will be connected to pin 19 with the BoosterPack.
Lab 1: Blink LED
The 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). 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 MSP432 -> LaunchPad w/ MSP432 EMT (48MHz).
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 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 red LED 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 colored LEDs on the board
i. RED_LED
ii. GREEN_LED
iii. BLUE_LED
Lab 2: Educational BoosterPack
The 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 MSP432 -> LaunchPad w/ MSP432 EMT (48MHz). Under Examples -> 09.EducationalBP_MKII -> EduBP_MKII_Production_Test. This will let you test the full analog functionality of the BoosterPack. Follow the prompts on the LCD screen. Nothing displaying on the LCD screen? Try resetting the board and make sure jumper J5 is in position 1.
Once you complete the sequence feel free to run through any of the examples you wish to run in the same example folder. Explore the Joystick, push buttons, RGB LED, LCD, and Accelerometer. Make sure your BOOSTXL-EDUMKII is properly connected to the LaunchPad.
Next, go to File > Examples > EducationBP_MKII > ServofromJoystick. This will let you control the joystick with your left and right joystick movement. Verify your servo is moving properly.
Lab 3: Wi-Fi
The goal of this lab is to introduce the student to the basics of adding internet connectivity to an application.
1. Plug the CC3100 BoosterPack into the bottom of the LaunchPad. The stack should now be:
a. Educational BoosterPack MKII
b. MSP432 LaunchPad
c. CC3100 BoosterPack
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.
2. Create a new program in CCS Cloud (File -> New Energia Sketch). Call it Weather or Twitter depending on the exercise and select Empty Sketch.
Part 1: Weather
For 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 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 copy and paste that into Energia and upload it to the board.
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.
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.
To modify the code, so that it is pushbutton activated. Simply take the part where it does the choreo call in the loop function and enclose that with an if(digitalRead(PUSH2) == 0) and it will only query the temperature when the button is pushed.
To view the Temboo Tutorial go to www.energia.nu/temboo
The Temboo site does a great job of explaining how to use their APIs so refer there for additional help.
Part 2: Twitter
3. Go to your Temboo account and navigate to the Twitter Choreos
a. Once there, go to Tweets, Statuses Update
4. Make sure 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.
5. Start typing in the fields for the top box. Scroll down this page and copy the contents of the header file box.
6. 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.
7. Paste the contents of the header file box into TembooAccount.h
8. Update the WIFI_SSID #define to reflect your wireless network.
a. If your network has a password create a new #define called WIFI_PWD and type your password in quotes
9. 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.
10. Add the following lines to your program:
// Set Choreo inputs
String AccessTokenValue = "3361531038-PfYFeP3r9ykZ9hZzWCcsaQp4AHSHAX0BcBbVQ2K";
StatusesUpdateChoreo.addInput("AccessToken", AccessTokenValue);
String AccessTokenSecretValue = "RzlVqDmPHKaD1L315bvJ2MqhKfJW7Zsr76YfkomuKrL2a";
StatusesUpdateChoreo.addInput("AccessTokenSecret", AccessTokenSecretValue);
String ConsumerSecretValue = "f1S7cqL2aJi3HVyFOnQ9wCihao0080OIQxm0rpp41AB1yc91xJ";
StatusesUpdateChoreo.addInput("ConsumerSecret", ConsumerSecretValue);
String ConsumerKeyValue = "oa1pgd6ibazJFOa8X9Gp5BrmF";
StatusesUpdateChoreo.addInput("ConsumerKey", ConsumerKeyValue);
String StatusUpdateValue = "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!
11. Compile and upload the code to your board. Open the serial console to view the debug output.
12. If everything looks ok in the serial monitor, go to twitter.com/iotdump and see if your tweet was successful.
13. 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 combinations 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