Our friends at Temboo have put together an instructable that showcases how to create a water usage monitor based on the CC3200 Wi-Fi-enabled LaunchPad. Using various Temboo choreos & their nifty code-gen tools, developers can easily create cloud-connected applications that interact with the real world with the help of LaunchPad + Energia.
Cloud-connected LCD for displaying weather information
Here’s a quick project I put together over the weekend using Energia! Using the CC3200 WiFi LaunchPad + Sharp LCD BoosterPack (430BOOST-SHARP96), I am pulling weather information from the cloud with the help of Temboo & ultimately displaying it on the Sharp LCD display. In addition, we are able to change the desired location to pull weather information for by simply sending a text message with Twilio. From any phone, we can send a text message to my Twilio phone number with the following format: “Weather-LOCATION”, where LOCATION can be a city.state/zip code/etc.
Every 30 minutes, the CC3200 WiFi LaunchPad leverages Temboo-generated code to interact with the cloud. First, the LaunchPad queries Twilio to see what location it should display weather information for. Once the desired location is identified, the CC3200 then checks the weather information by making a few REST API calls to Yahoo weather & other sources. We then leverage Temboo to filter the XML/JSON that is returned from the REST API calls & ultimately use an Energia library to display the desired information on the Sharp LCD BoosterPack.
Our friends at SeeedStudio just released the Grove Base BoosterPack & the Grove Starter Kit for the TI LaunchPad development kits! These tools make it easy to add new sensors, actuators, displays & more to your LaunchPad & Energia-based projects. SeeedStudio offers a massive ecosystem of Grove modules – over 130 on my last count! Each of the Grove modules from SeeedStudio are open source hardware & include Wiring-based code that makes it very easy to import & compile using Energia.
Grove Base BoosterPack from SeeedStudio. This BoosterPack is available standalone & enables your LaunchPad to interface with SeeedStudio’s growing offering of Grove modules, which include sensors, displays, relays, motor drivers & more. MSRP: $7.50USD
Grove Starter kit from SeeedStudio This Starter Kit comes complete with the Grove Base BoosterPack as well as 10 different Grove sensors & actuators. It also comes with a tutorial guide & Grove cables for connecting the Grove modules to the BoosterPack. MSRP: $59.00USD
Start prototyping with over 100 different Grove modules from SeeedStudio with LaunchPad & Energia SeeedStudio offers over 100 different Grove sensors and actuators that can interact with the Grove Base BoosterPack for the TI LaunchPad Development Ecosystem. Energia example software & libraries are available for many of the Grove modules as well.
The BoosterPack features full compatibility with the 40-pin BoosterPack pin out standard Plugging in a Grove Module into the Grove Base BoosterPack will enable your Grove sensor or actuator to route the appropriate pins to an underlying LaunchPad. Since this BoosterPack adheres to the BoosterPack standard, each Grove connector will route the analog pins, digital pins & serial communication pins to the underlying LaunchPad.
Have multiple Grove modules connected to your LaunchPad kit Create a complete system of inputs & outputs by simply plugging in multiple Grove sensors and actuators to your LaunchPad.The Grove Starter Kit makes it easy to create a complete system when paired with a cloud-connected LaunchPad development kit. With the Grove Base BoosterPack, developers can plug up to 13 different Grove sensors & actuators quickly. INCLUDES:
Trigger a voice call when your LaunchPad detects water.
In this demo, we are using the MSP430F5529 LaunchPad + CC3100 WiFi BoosterPack + Grove Moisture Sensor. This was programmed using Energia & leveraging code generated by Temboo.
Creating a SubGHz RF sensor network with a WiFi gateway.
In this demo, we created several wireless sensor nodes. Each wireless node features a unique sensor from Seeed Studio, which interfaces to a TI LaunchPad + CC110L Sub-GHz RF BoosterPack + Battery BoosterPack. The SubGHz-to-RF Gateway was created using the CC3200 WiFi LaunchPad paired with the CC110L SubGHz RF BoosterPack. This was all programmed using Energia.
Through the Firmata APIs, you can fully exercise the I/O pins of many LaunchPad development kits. You can toggle I/O, generate PWM signals, read analog inputs & more. The other benefit of Firmata is its ease of porting to new platforms. Firmata support can be added to a new LaunchPad by simply modifying a boards.h file, which acts as a descriptor file that describes all of the functionality available on each pin on the LaunchPad. The application firmware remains the same.
Here’s a video of Firmata in action!
There are several PC-side GUIs that are available that allow you to interact with your LaunchPad’s I/O pins. However, these GUIs are simply example applications that are leveraging the firmata APIs. What’s cool about these PC side GUIs is that they are able to do a quick “handshake” with a connected LaunchPad. Through the serial interface, the GUI is able to identify which board is connected & dynamically populate the GUI with the appropriate pin list. It also intelligently exposes the appropriate functionality that is available within each pin. With additional code, developers can go a step further and add logic & intelligence to the server side application. This way, the application you are creating is completely hosted on the PC/server side, while the LaunchPad simply acts as a serial interpreter waiting for commands.
Firmata is available as a library/example application in Energia v13 and newer.
Energia was at Maker Faire Rome this past week. It was a great opportunity to meet with makers in the beautiful Italian city!
The Energia team was at the Texas Instruments booth showcasing demos based on the LaunchPad platform. Below are some videos that showcase a few of the demos that we had at the Texas Instruments booth!
DEMO 1: Wireless (SubGHz RF ) flower pot moisture sensor
In this demo, we created a simple wireless flower pot moisture sensor. We used an 8×8 LED matrix to visualize a happy face or sad face depending on the presence of water. We are able to remotely monitor a flower pot thanks the SubGHz RF BoosterPack, which allows us to send sensor data wirelessly.
Hardware (Energia libraries available for each component)
Olimex 8×8 LED Matrix BoosterPack
2x CC110L SubGHz RF BoosterPack (430BOOST-CC110L)
2x MSP430F5529 LaunchPad (MSP-EXP430F5529LP)
1x Grove Moisture Sensor from SeeedStudio
DEMO 2: Twitter-enabled scrolling marquee
In this demo, we have several 8×8 LED matrices daisy-chained together to create a simple digital sign. The LED matrices are hooked up to the MSP430F5529 LaunchPad & CC3100 WiFi BoosterPack. The LaunchPad is connected to a cloud-side application over WiFi. The cloud-side application is listening to all public tweets for the hashtag #LaunchPad. If a tweet with #LaunchPad is found, the twitter message is published to the LaunchPad over MQTT. The LaunchPad receives the string and ultimately scrolls it through the 8×8 LED matrices.
CC3100 WiFi LaunchPad
Several 8×8 LED matrices
DEMO 3: Publishing sensor data to the cloud with MQTT to visualize data on freeboard.io
In this demo, we are publishing potentiometer sensor data to a cool cloud-side visualization tool called freeboard.io. In this demo, we are publishing our sensor data to the cloud using MQTT.
CC3100 WiFi BoosterPack
Hope you enjoyed the demos! If you were able to stop by the booth, thanks for coming! It was great to meet everyone! Looking forward to seeing everyone at the next Maker Faire!!
Be sure to check out the latest version of Energia v13, which includes WiFi support for the CC3200 LaunchPad & CC3100 WiFi BoosterPack! Also, follow us on twitter @energiaproject to find out when we’ll be at our next tradeshow!
We’re super excited to announce that the latest version of the Energia IDE now has full support for Temboo!
We’ve been hard at work collaborating with the kind folks at Temboo, which is a cool cloud service provider that can generate Energia sketches that enable cloud-connected LaunchPad kits to interact with 1000+ REST APIs. Temboo currently has support for various web services such as FedEx.com, Twitter.com, Yahoo Weather & more.
From within the Temboo website, you can use their code generation tool for creating your own IoT-enabled Energia sketches. Simply choose the web service you want to interact with & the APIs you want to enable. Then by populating a few fields, a complete Energia sketch is generated from within the browser. At that point, simply copy & paste them into the Energia IDE and compile!
The possibilities are plentiful!
Generate code to enable the LaunchPad to turn on an LED when your package arrives from FedEx.
Generate code to enable the LaunchPad to append a new row on a Google Drive spreadsheet for datalogging sensor values.
Have your LaunchPad send you a SMS or Email when a sensor exceeds a threshold.
Here’s a quick video I put together using code that I generated from the Temboo website.
In this demo, I have a moisture sensor connected to the MSP430F5529 LaunchPad + CC3100 WiFi BoosterPack. When moisture is detected, my LaunchPad triggers a voice call to my cellphone using the Nexmo web service. In the Temboo website, we can specify what the phone call will say when I pick up the phone. In this case, “Hello Adrian, we detected a change in your sensor readings. Press 1 to take an action on your LaunchPad, or press 0 to ignore.”
At that point, my cell phone rings & I am able to respond remotely back to my LaunchPad by simply pressing 1 or 0. This response/command is sent back to the LaunchPad & we are able to handle that command appropriately with the code flashed into the LaunchPad kit. In my example, I simply turn on the red LED on the LaunchPad if the user presses 1.
In short, Nexmo can enable our LaunchPads to remotely call a user when needed & get input from that user when a decision needs to be made.
Special thanks to the awesome folks @ Temboo & to all of the contributors to the Energia project!
In this tutorial, I will show you how to create your very own IoT-connected sensor. We will use MQTT to publish our sensor readings. For this demo, I will be using a potentiometer as my sensor, but this demo could easily be accomplished with a sensor of your choice (i.e. temperature, moisture, humidity, motion, etc).
This tutorial will be broken up into multiple parts/blog posts. With each new blog post, we will learn a bit more & incrementally add more features to our project. Here’s a sneak peak of what we will have by the time that we’re done!
MQTT is a good fit for embedded WiFi solutions because it is a lightweight protocol. With MQTT, there are 3 main components:
PUBLISHER: In our demo, the LaunchPad will be the publisher, as it will be publishing sensor data under a specific “Topic”.
BROKER: This is the “middle man” who holds on to the data that is being published. In this example, we are using a publicly available MQTT broker that is suitable for prototyping/demo purposes. You can find a complete list of public MQTT brokers here: https://github.com/mqtt/mqtt.github.io/wiki/public_brokers
SUBSCRIBER: In order to subscribe to any data that is being sent by a PUBLISHER, the SUBSCRIBER must be connected to the same BROKER & subscribed to the same topic as the PUBLISHER. As long as these 2 conditions are met, the SUBSCRIBER will be able to receive messages from the PUBLISHER.
Note that with MQTT, multiple publishers & subscribers can be using the same Broker/Topic. In addition, a single publisher could be sending data to more than one subscriber.
For this first blog post, we will learn how to publish our sensor values to a cloud-based application using MQTT.
SETTING UP THE HARDWARE
In my demo, my WiFi-connected sensor is based on the MSP430F5529 LaunchPad + CC3100 WiFi BoosterPack. Note however that this demo will also work by pairing the CC3100 WiFi BoosterPack to some of the other Energia-supported LaunchPad kits as well (i.e. EK-TM4C123GXL LaunchPad). This demo will also work on the CC3200 WiFi LaunchPad, which doesn’t require the CC3100 BoosterPack because the CC3200 features a single chip ARM Microcontroller + WiFi Transceiver.
The sensor I used was a simple potentiometer knob. I connected the signal pin of the potentiometer to physical pin 24 of the LaunchPad.
Note that i also used the BOOSTXL-BATTPACK LiPo Battery BoosterPack to supply power to my setup, however powering your system with a USB cable will work as well.
SETTING UP THE SOFTWARE
We will be using Energia to program our LaunchPad. Energia is an open source, rapid prototyping tool for creating embedded firmware on various LaunchPad kits. It should be familiar to many developers as it is a fork of other Maker-friendly tools such as Wiring & Arduino, meaning that they are code-compatible & many of the same libraries & code examples will work here as well.
Energia is a community-developed open source rapid prototyping tool for creating embedded microcontroller firmware. www.energia.nu
You can download Energia for Windows, Mac or Linux @ www.energia.nu (v13 introduces support for both the CC3100 BoosterPack and CC3200 LaunchPad). Once you download it, unzip Energia. Energia is now ready to go!
READING YOUR SENSOR DATA // Intro to analogRead()
Now that Energia is installed & your hardware is setup, let’s first read that sensor to verify that part of the system is working. Go ahead and open up Energia.
Ensure you have the correct board selected in ENERGIA by selecting the board you are using in the drop down menu: TOOLS > BOARD > LaunchPad w/msp430f5529 (25MHz)
Energia also features a built-in serial monitor. Be sure the correct COM port is selected by going to: TOOLS > SERIAL PORT > SELECT YOUR COM PORT (Look for MSP430 UART in your computer’s device manager)
Now we can start programming!
Energia features many code examples. Go to FILE > EXAMPLES > BASIC > AnalogReadSerial
This will open a new Energia window that is pre-populated with a simple code example.
This code example introduces you to the analogRead() function in Energia. This one line of code allows you to easily read analog values coming from analog sensors, such as our potentiometer.
WE JUST NEED ONE MODIFICATION. We need to change it so that the analogRead() function is reading pin 24, which is where we connected our potentiometer knob. Modify the code so that it looks like this: int sensorValue = analogRead(24);
Now, we can program our LaunchPad! Click on the arrow at the top of the Energia window to compile & upload our code to the LaunchPad.
Once it’s programmed, click on the magnifying glass on the top-right corner to open up the Serial Monitor. Be sure that the baud rate of the Serial Monitor is set to 9600 baud.
If everything is working, we should start to see sensor values streaming into the terminal.
Now that are reading analog values successfully, we need to download & import the MQTT library. The library that we will use is based on the pubsubclient library that was developed by Nick O’Leary. You can learn more about Nick’s pubsubclient library & examples in his github: https://github.com/knolleary/pubsubclient/tags
A few small modifications were made to Nick’s library to make it work with the TI LaunchPad kits. The modified library can be downloaded here:
DOWNLOAD THIS MQTT PubSubClient LIBRARY FOR ENERGIA>> PubSubClient
Once downloaded, unzip the contents so that it follows this path:
My Documents > energia > libraries > PubSubClient > pubsubclient.h & pubsubclient.c & examples & LICENSE
If the My Documents > energia > libraries folder does not exist, create it & unzip the pubsubclient zip file accordingly.
Now restart Energia so that it can find the new library you have installed. The library should now be ready for you to use!
Using the MQTT library to publish your analog sensor readings!
Once you restart Energia, you should now have a new example available to you @ FILE > Examples > PubSubClient > “MQTT_CONTINUOUS_PUBLISH_POTENTIOMETER”.
There are just a few things we need to modify to get this example working for you!
Change WIFI_SSID & WIFI_PWD. If it’s an open network & no password is required, you will have to modify the WiFi.begin function like so: WiFi.begin(WIFI_SSID);
We can also change the TOPIC that our LaunchPad is publishing to. By default, we are publishing to the topic of “outTopic”. To change, simply replace outTopic with a string of your own in the client.publish() function call in the main loop().
Once you make the required changes, you can go ahead and press the “Verify & Upload” button in Energia to compile your code & flash it to your LaunchPad!
Here’s a quick summary of the code:
First, we need to tell our code which MQTT broker we want to use by populating the server byte array.
Next, we needed to #define our WiFi credentials (WIFI_SSID & WIFI_PWD)
In setup, we connect the LaunchPad to the WiFi network with the WiFi.begin() function
In loop, we first read our sensor value using the analogRead(24) API.
We then typecast our sensor reading, which is an integer to a character array
Once converted, we use client.connect() to connect the LaunchPad to the MQTT broker specified in the server byte array.
Once connected, we use the client.publish() API to publish our sensor data to the specified TOPIC.
We disconnect from the broker, then we loop back around!
To verify things are working, open up the Energia Serial Monitor, You should see sensor values flowing in as well as “Publishing successful!”.
Let’s create a MQTT Subscriber using a cloud-based application.
Now that our LaunchPad is successfully publishing data to the cloud, let’s create a cloud-side application that can subscribe to our LaunchPad! We will be using a tool called Node-RED.
Node-RED is an open source tool for “wiring together the Internet of Things” that is built on node.JS. The Node-RED tool can be deployed on any node.JS server, whether it’s running locally on your computer, or a server running on a BeagleBone Black, or even a node.JS server hosted & running in the cloud.
For this demo, let’s instantiate a node.JS runtime in the cloud for Node-RED to run in!
We will use a cloud Platform as a Service (PaaS) from IBM called “BlueMix”. You can sign up for an account @ www.bluemix.net for free.
Instantiating your own node.JS runtime in the cloud
Once you have created your BlueMix account, we can leverage one of the available “BoilerPlates” or examples that are provided by IBM. Login to your BlueMix account & navigate to the “Catalog” tab. Notice a huge selection of services & runtimes that are available.
In our demo, we are using Node-RED, so go ahead and click the Node-RED icon in the BOILERPLATES section of the catalog tab. With just a few clicks BlueMix will reserve a sliver of their server for your node.JS runtime & will build a basic Node-RED application for you. All we need to do is give a unique name to our application! You can leave everything else with their default settings & click “CREATE”.
It will take BlueMix about 60 to 90 seconds to create your Node-RED application. Once your app has started, click on your application’s URL, or navigate to [YourAppName].mybluemix.net // This will take you to your Node-RED application that is running on your cloud-hosted node.JS runtime!
Once you are in your app, click on “Go to your Node-RED flow editor” button. This will take you to the Node-RED flow editor environment where you can start creating your cloud-hosted app.
Creating an MQTT subscriber with Node-RED
We can do so by simply dragging in the MQTT input node into the sandbox area. Double-click on the MQTT node that you just dragged in to configure it. We need to do 2 things:
Add the MQTT broker information (this should be the same IP address as the broker our LaunchPad is connecting to. We can copy and paste this IP address from Energia. However, be sure to replace the commas with decimals 🙂
Next, we need to tell the MQTT node which topic to subscribe to. Again, we can go back to Energia & copy and paste the string that our LaunchPad is publishing to.
Now, our MQTT node is properly configured!
To start seeing data from our LaunchPad, drag in the DEBUG node in the Node-RED palette.
Now, wire up the MQTT node to the debug node
Once connected, press the “DEPLOY” button on the top-right corner of Node-RED.
Next, click on the “Debug” tab in the side-bar to the right.
At this point, you should start to see sensor values from your LaunchPad streaming in!
WE DID IT! We just bridged the hardware world with the cloud!
Now, our sensor data is able to participate in the API economy that the internet is able to benefit from!
From this point, we’re just a few nodes & wires away from triggering events based on the incoming MQTT data. Stay tuned for the next blog where we will show how to visualize this incoming data using a data visualization cloud service called EMONCMS.
Startup weekend is a 54 hour event where developers, designers, makers & more come together to collaborate, form teams, build products & launch startups. It’s a whirlwind of a weekend & we’re pumped to be a part of it!
Robert Wessels, founder & lead developer of Energia will be one of the Coaches at Startup Weekend to share his experience & expertise to the participants. He’ll also be there to provide on-site Energia support for the participants to rapidly prototype their next big thing!
In addition, TI has donated 100x TM4C123 ARM Cortex M4F LaunchPads to help developers start creating their applications. Paired with Energia, the participants at the event are well-positioned to create unique & differentiated solutions.
To help get the participants up & running, we created a TM4C123 LaunchPad + Energia Quick Start Guide. Special thanks to community member Rei Vilo for his nifty pin map diagrams! You can download it here:
Go beyond Serial.print() with new Energia sketch import feature in Code Composer Studio v6 In Code Composer Studio v6 or newer (CCSv6+), developers have the ability to import existing Energia sketches into the IDE. This opens up additional functionality and true hardware debug capability such as setting breakpoints, watching variables & stepping through code line-by-line. The CCS debugger also enables developers to “step-into” an Energia API to see the under-lying bare metal code that is ultimately programmed into the microcontroller device. This added functionality enables a non-intrusive debug environment that takes developers to the next level beyond Serial.println().