Energia Announcements

View News Updates

Night Light

This example is to make a simple night light using an RBG LED and a photoresistor.

What you will need

  • TI LaunchPad
  • Breadboard
  • Photoresistor
  • 8x Jumper Wires
  • 1K or 10K ohm resistor


Wiring and Definitions

A breadboard is laid out in rows and columns that are electrically connected. Simply put a component or wire into one of the holes and it will be electrically connected with anything on the same row.

Wiring: LaunchPad jumpers should be connected to VCC and GND.

RGB LED stands for Red, Green, and Blue. You can make many different colors with combinations of red, green, and blue.

Wiring: The first three legs are connected to Red, Green, Blue, and the larger leg to VCC. View your schematic to make sure Red, Green, and Blue are connected to PWM pins.

MSP432 LaunchPad: the schematic shows PWM pins available: p2.5,p2.7,p2.6,p2.4,and p5.6.

A photoresistor is another variable resistor that changes resistance based on light exposure.

Wiring:Leg (1) connect to VCC, leg (2) connect to 10k ohm resistor and pin 2. The resistor should be connected to GND.






**Explanation: The setup() function initializes the LEDs and photoresistor. The loop() functions reads photoresistor value every second, checks to see if there is no light and turns on Red, Green and Blue colors of the LED in a sequence with a delay of 400ms.


*Note: AnalogWrite() function is used for PWM. It requires two arguments: One telling the function which pin to write to, and one indicating what PWM value to write.


*Note: Make sure your baud rate is set for 9600 and you have selected the correct serial port for UART.


#define RED 19 // pin 19 is always PWM capable according to LaunchPad standard
#define GREEN 40 // may need to change this for your LaunchPad PWM pin
#define BLUE 39 // may need to change this for your LaunchPad PWM pin
//Variables light sensor—constant
int value;         // Store value from photoresistor (0-1023)
int resistor = 2; //pin 2

void setup() {

// initialize serial communication over UART at 9600 baud

pinMode (BLUE, OUTPUT); //Blue LED symbolising Cold and Not Fit for Consumption
pinMode (GREEN, OUTPUT); //Green LED symbolising Lukewarm and Read for Consumption
pinMode (RED, OUTPUT); //Red LED symbolising Hot and Not Fit for Consumption

//light sensor set up
pinMode(2, INPUT); // set resistor 2 pin as input 

void loop() {

//reading the light sensor
int value = analogRead(2);//reads from pin 2
delay(1000); // delay
Serial.println(value); // Print the analog value to Serial

if (value > 800){
digitalWrite(RED, HIGH);//Turn leds off.
digitalWrite(GREEN, HIGH);
digitalWrite(BLUE, HIGH);



digitalWrite(RED, LOW); //Turn led on
digitalWrite(BLUE, HIGH);
digitalWrite(GREEN, HIGH);

digitalWrite(RED, HIGH); //Turn led on
digitalWrite(BLUE, LOW);
digitalWrite(GREEN, HIGH);

digitalWrite(RED, HIGH); //Turn led on
digitalWrite(BLUE, HIGH);
digitalWrite(GREEN, LOW);






CC13xx + CC3100 WiFi IoT gateway

This post is how to get your low power CC13xx based LaunchPad/SensorTag published to the cloud; utilizing a CC13xx LaunchPad + CC3100 BoosterPack using PubNub as the publishing agent and Freeboard as the visualization service.

What you will need

  • Free PubNub account. You can create one here.
  • Free Freeboard.io account. You can create one here.
  • CC3100 BoosterPack. You can get one here.
  • 2 x CC1310 LaunchPad. You can get them here.
  • IoT gateway and sensor node Sketch. You can get them here.


Setting up PubNub

After you have created an account at PubNub go to the account homepage, and click the “NEW APP +” button. The button is located on the right corner of the screen.

In the dialog that pops up type your desired APP name (e.g. CC13xx IOT Gatway) and click create.

Click the app you just created on your account homepage:

Once in the app click the key info button on the top left of the screen, if you are not already on the key info screen.

On the tab navigation locate “All Keys,” scroll down and select Demo Keyset.


The loT gateway and sensor node sketch should be saved in the Energia Library(Documents->Energia-> libraries). Open Energia and locate EasyLinkRx, it should be in your “Examples” library.

Navigate to the Wifi tab and replace the pubkey and subkey with your keys displayed in the PubNub “Demo Keyset” detail window. Just copy and paste the keys into your Sketch. Still in the WiFi tab replace ssid and password with your WiFi network name and password.


On one of the LaunchPad’s place the CC3100 BoosterPack as per the instructions that came with the BoosterPack (CC31xx Quick Start Guinde pg. 18).

Your Gateway is now setup and ready to go.

Plugin the LaunchPad with the WiFi BoosterPack and upload the EasyLinkRx Sketch.

*Note: Install EasyLink library by following these steps: Sketch->Include Library->Manage Libraries->EasyLink->Install

*Note: Change the baud rate in the UART to match your sketch

Unplug the LaunchPad with the WiFi BoosterPack. Open the EasyLinkTx Sketch, plugin the other CC1310 LaunchPad and press Upload. Now plug the LaunchPad with the WiFi BoosterPack back in. Both LaunchPads should be connected, see below for reference.


The LaunchPad will now connect to WiFi and start receiving data from the sensor node, publishing it to PubNub.

Setting up Freeboard.io

Setup your freeboard.io account here. On your account homepage enter a name for your board (e.g. CC1310 IOT) and click the “Create New” button.

On the dashboard that appears, click “ADD” under DATASOURCES.

In the Datasource pop-up select PubNub as the type from the “Select Type” drop down menu.

In the “DATASOURCE” details dialog, fill in the following details:

Name: Any name you want to give it. e.g. “CC1310 Sensors”

Subscribe Key: This is the key you earlier got from PubNub and pasted into the WiFi Sketch.

Channel: hello_world

Once the details are filled in click the “SAVE” button.

Back on the board home screen click the “Add Pane” Button.

In the newly created pane click the “+” sign.

In the Widget dialog select Sparkline.

In the Widget details fill in:

Title: The tile for the sparkline. e.g. Analog

Value: If your CC1310 gateway is already running then by clicking the + Datasource will show you the data sources available. Keep clicking the value that pops up until the value field shows: “datasources[“CC1310 Sensors”][“analog”][0]”

Keep the rest of the fields as they are and click Save.

If your IoT gateway and sensor node are running you should see a nice spark line showing the analog value from the sensor node that is send to the IoT gateway.


WiFithing – Open source Energia IoT platform with rapid deployment option

WiFithing, a UK based start-up, has launched on Kickstarter a new complete IoT platform based on TI MSP430 MCU’s and radios. I have read through their details and I love what they have done, so here are some of the details. Make up your own mind! If you like it, head over to the WiFiThing Kickstarter page.

WiFithing is based on a master and slave system, with the master having a Wi-Fi (CC3100) transceiver and an ISM (868/915 MHz) transceiver (CC1101), powered by an MSPFR5969. Each master can control up to 8 slaves, each of which is based on the CC430F5137 combined processor and transceiver. There is no limit on the number of masters that can be deployed. The slaves are based on the PanStamp NRG2. Masters and slaves are shipped in neat enclosures, ready for use.

You can wire both masters and slaves directly to sensors, relay boards, switches and other devices. At CES, WiFithing showed a home-made, hand held breathalyser which reported alcohol levels to a smartphone. Out of the box, without any wiring, you can read the inbuilt temperature sensors and control up to 10 Orvibo S20 Smart Sockets and up to four groups of FHT8v wireless radiator valves for lighting and heating control.

The benefits of using slaves, are that they:

  • are physically small enough to fit in quite small sensors/controllers,
  • can achieve 12 months plus battery lives whilst still, for example reporting back temperatures every 5 minutes.
  • have great range, like up to 100 metres out of doors
  • are low cost

The masters and slaves are shipped fully tested and flashed with the WiFithing open source firmware. This firmware is essentially an operating system which comprises some 60 in built functions. This allows the devices to be programmed over the air from the WiFithing web app.

The web app allows users to select from a range of 50 or so “Simple set-up” options such as “Control smart socket using daily timer and thermostat on slave”. A couple of clicks to select which slave and what locations and resource (such as Kitchen Heating) and then click “Publish”. This will then send the program in the form of a number of tables in a very compact byte stream to the master and onto the slave.

If users wish to build a more specialised application, the web app provides an advanced set-up page which gives users the power to create much more complex apps, by choosing functions and setting parameters, but still using drop-downs rather than writing code. By way of demonstrations, WiFithing also showed at Showstoppers/CES, how the system could implement a weather station which reported rainfall, wind speed and direction, temperature, humidity and pressure to the web site.

Once users have published their settings, they can then navigate to their main menu on their PC/smartphone and they will see that their personalised web site has been built for them automatically, giving them full control.

WiFithing do propose to charge a hosting fee for the use of their web app of $18 per annum (unlimited masters and slaves for each house/site). If users would prefer to use their own web site (and not pay the hosting fee), then WiFithing provides the code and protocol information necessary to set up their own. Alternatively, if users wish to build their own desktop or web app, but still use the WiFithing security and data infrastructure, then they can use the WiFithing secure API.

In addition to allowing set-up over the air, WiFithing allows automatic firmware updates over the air to both masters and slaves. And by setting a flag, users can send their own firmware to their devices.

WiFithing boasts a range of other features, which makes this a very complete platform:

  • Full SSL and AES encryption (masters and slaves are registered securely by using a QR scanner on their smartphone)
  • A range of low power modes, and automatic signal strength adjustment to preserve battery life
  • Full web site data logging and alerts, all set up by dropdowns
  • Multiple houses/sites. For example, a sensor in London could trigger an alarm in San Francisco
  • Comprehensive diagnostics (signal strength, battery life, time of last communication and logging)
  • An open source device and API emulator for debugging master/web communications (c#)
  • Comms are initiated by a configurable UDP tick from the master (with TCP back-up), so secure and no need to make holes in your firewall
  • Using the FR5969/CC3100 combination gives the users the benefit of TI’s FRAM technology (and the device will hold its settings and firmware even if power is lost)
  • Coin cell battery to maintain clock in event of power failure
  • Access to web server on device, for control in the event of internet connection failure (to be implemented)

Edward Forwood, Co-founder of WiFithing, said to us “We developed something that we want to use ourselves. Our goal was to allow non-technical users to set up a range of useful applications in minutes, whilst allowing experts to save a huge amount of time in setting up the comms and security infrastructure, allowing them to spend that time on developing really interesting applications”.

WiFithing tell me that they are keen for their platform to be adopted by, and improved by the Energia community. They have set up a forum with a number of example projects, and hope that others will add to them. The code will be on Github when they have finished documentation.

What I learned at Open Hardware Summit

On Sept. 19 I had the privilege of attending the 2015 Open Hardware Summit in Philadelphia. This conference is dedicated to the progress of the open source hardware movement and is put on by OSHWA and many companies that believe in the proliferation of the open source world. The main idea of the open source philosophy is to encourage a spirit of collaboration. The underlying belief is that ideas can freely flow and be improved upon by the community of users in a much more rapid way than by individuals who guard their ideas behind high walls. This has proven very successful in the software world, and has been gaining momentum in the electronics world over the past few years. In the electronics context, designers release their design files for others to use. This will let the community take a design that they are interested in producing but customize for size, function or cost to help improve the application they wish to target. The challenge behind implementing successful open source hardware is the logistics and time associated with creating physical designs. It’s much easier to pull in code enhancements than it is to make hardware changes. However, it is still possible, especially in the prototyping phase of hardware design, to make rapid changes to your manufacturing process.


The Open Hardware Summit is an all-day event that invites speakers and attendees from all around the world to talk about their open source hardware experience and advancements. The talks included case studies of success and failure of Kickstarter campaigns, the patent claims of the Wright brothers, open source Internet of Things (IoT), open source projects on crowdfunding, enabling academia with open source tools that offer significant cost savings, and STEM-related initiatives that can train the next generation of great minds.


Open hardware is very important at Texas Instruments to give our customers reduced time to market and improved product support. TI Designs is a repository of open reference designs that can be used by customers as a starting point for innovative products. Popular development kits such as the TI LaunchPad™, TI SensorTag, and Beaglebone Black utilize open hardware to get customers quickly from evaluation to prototyping a customized design.


Here is a look at the program of the day and speakers.


AnnMarie Thomas, Associate Professor in the School of Engineering, the Schulze School of Entrepreneurship, and the Opus College of Business at University of St. Thomas

Ben Leduc-Mills. Open Hardware, Open Minds: The Rise of Open Hardware in Academia and K-12 Education
Nancy Ouyang. The Rise and Fall of an Open Source Hardware Company
Jason Kessler and Jon Ruston. ULTRASCOPE: Automated Robotic Observatory (ARO)
Ryan Fobel, Christian Fobel, Michael Dryden and Aaron Wheeler. DropBot: an Open-Source Platform for Lab Automation
Joshua Pearce. Making Open Hardware the New Standard in Science
Hugo Boyer. Open Source Robotics Foundation and the Robotics Fast Track

Eric Wilhelm. Autodesk’s Open Source 3D Printer
Sanket Gupta and Sam Wurzel. Common Parts Library
Andreas Olofsson. Open Source Chip Design: The Final Frontier
Mike Linksvayer. Open Source Hardware and Developments in Creative Commons Licenses, Compatibility, and Policy
J. Simmons. Demonstration of Open Source Engineering Analysis and Parametric CAD Modeling for OSHW
Michael Weinberg. Future of OSHWA
Kipp Bradford. Successfully Manufacturing your Open Source Hardware
Joshua Lifton. A Tale of Two Laptops: Case Studies in Open Consumer Electronics
J. Eric Townsend (aka jet). Foundation for a Common Object Description Language
Grace Ahn, Elizabeth Doyle, Myles Cooper and Michael Searing. Investigating Normal – Hacking Prosthetics
Bevan Weissman and Dan Beyer, New American Public Art. Dynamic Infrastructure for Social Innovation

Benedetta PiantellaHumanitarian Open Source Tech Projects
Bruce Boyes. What the Wright brothers Can Teach us about Open Source vs Closed Source
Tega Brain and Surya Mattu. Unfit Bits: Free your Fitness Data from Yourself
Pedro Oliveira and Xuedi Chen. Open Source Riots – Appropriating Technologies for Protests of the Future
Tom Igoe
Speaking In Tongues and Catching Flies: OSH and Connected Devices
Dusytn Roberts and Addie Wagenknecht. Closing Remarks


Mark Easley is an applications engineer at Texas Instruments and a contributor to the Energia project.

Inside Rekam1 (dyslexic(1maker))

Rekam1 is a rapid prototyping virtual machine written in Energia which enables rapid prototyping with your smartphone. This platform is designed to accelerate the development of three types of applications:

Sensor Controlled Actuators (temperature/light/etc. controlled doors/lights/motors/gadgets)
Smartphone Controlled Actuators (speech/accelerometer/UI controlled doors/lights/motors/gadgets)
Sensor Controlled Smartphones (temperature/light/etc. alerts/logging on your phone)

In this blog we’re going to talk about a smartphone controlled actuator application recently demoed an World Maker Faire: the “Rekam1 Clay Thrower” and how Energia rekam1 code was used to enable this.

The Clay Thrower uses a speech or UI push button trigger to sling clays hundreds of feet into space. It does this through a solenoid. Because the solenoid draws 2.5 Amps of current, a power FET is connected to the MSP430 to energize the launch.

Power FETs have a drain, gate, and source. The source pin in this example is connected to ground(GND) while the gate pin is connected to pin 19 of the micro-controller. The drain pin is connected to one terminal of the solenoid and the other pin is connected to the positive terminal of a LIPO battery I’m using. In this example, rekam1 is used as a “command interpreter”. This means it immediately executes whatever command it receives over the UART. If you are using an MSP430G2553 Launchpad, you can see in the picture below how you would connect your board.


You can find the rekam1 sketch in Energia under File->Examples->Communications->rekam1. In order to build rekam1 for this platform, simply comment out the #define for G2553 and comment the Wi-Fi include lines and CCX #define as shown below. Ensure you’re building for the MSP430G2553 and hit the build button.

When you connect a battery, Power FET, and solenoid to your Launchpad, your setup should look like below. You can now activate and deactivate your solenoid through a serial port window inside energia by simply typing: put 19 100 and put 19 0 a second or so later. Make sure that you have setup your terminal window to 9600bps with a new line sent when you hit the “send” button.

In the video below, you can see how fun this little gadget can be. In this case, we used google speech recognition and a simple “pull” button in Android to send these two commands. If you’re interested in learning more about how to use rekam1, you can visit my blog at rekam1.blogspot.com<http://rekam1.blogspot.com/>

We’ll be at IoT World!

We’ll be at IoT World! Helping developers rapidly prototype their cloud-connected application!

logo-300[1]The Launchpad team will be at IoT World May 11th-12th to support developers and makers in a 30 hour Internet of Things hackathon.  TI will provide  MSP430F5529 LaunchPad development kits, SimpleLink CC3100 WiFi Boosterpacks, and SEEED Studio’s Grove Starter Kit for Launchpad to participants.  These kits combine to create an ideal solution for rapid prototyping internet connected projects.

To further enable rapid prototyping, the Launchpad family is supported by Energia – an open source port of the Wiring/Arduino framework to TI’s launchpads. The CC3100 BoosterPack paired with Energia WiFi examples lets you quickly and easily incorporate WiFi into any LaunchPad project. The SEEED Studio Grove Starter Kit provides a simple interface to connect various sensors and inputs to LaunchPad boards and are fully supported by Energia.

On the cloud side, Launchpads are supported by Temboo – a cloud-based code generation platform that allows you to connect to 100s of web-based resources and services. Temboo provides an easy way to use various web services(everything from Twitter to SMS to FedEx to Yahoo! Weather) to connect to and control your launchpad by unifying how you interact with their APIs.  A great example shows how to get started by using your launchpad to retrieve weather information from Yahoo! Weather.

Additionally, Energia has support for MQTT to allow the LaunchPad to act as both an MQTT Publisher and Subscriber. This, combined with a free broker (like such as m2m.eclipse.org or another public broker), makes it easy to get a simple IoT application communicating with the cloud.  Once your LaunchPad is publishing to the cloud, IBM’s BlueMix combined with node.js frontend NodeRed lets you view data and control your launchpad from anywhere. A full start to finish Energia based MQTT tutorial can be found here: http://energia.nu/guide/tutorial_mqtt/.

A list of LaunchPad IoT resources is listed below:


Introducing Energia MT for MSP432

What is Energia MT?

Aside from bug fixes, the release of Energia 15 with Multitasking (MT) adds support for the new ARM Cortex M4F-based MSP432 LaunchPad. This time it’s a bit different though. The framework is powered by TI-RTOS, letting you run your Sketches in parallel. Yes, in parallel! How awesome is that?! This release supports MT for the MSP432 LaunchPad with support for other boards coming in future releases.  Download Energia 15 with MT now!


How it Works

Each tab in Energia MT is its own task, which will have a setup() and a loop() component.  The setup() and loop() pair need to have matching names, but the specific names don’t matter.  For example, to blink 3 LEDs at different rates, we would set up the Energia project like this: setupBlink1()/loopBlink1(), setupBlink2()/loopBlink2() and setupBlink3()/loopBlink3().




As long as the setup/loop pairs match, the naming in the tabs doesn’t matter.  Energia MT will automatically find the setup/loop pairs and turn them into individual tasks.  Setting up a multitask application is as simple as that!

Energia MT also allows for global variable for inter-task communication.  All global variables are truly global and must be declared in the first tab. Once they are declared in the first tab, they can be called from any other tab/task, but you cannot reuse the variable name in another task.


Examples in Energia MT

MultiBlink: Multiple Sketches each blinking one of the RGB LEDs at a different rate.
ButtonEvent: An example for the Button event library. One Sketch is reading the button and another sketch waiting for the button to be pressed. This library uses the TI-RTOS events module.
EventLibrary: An example for using the Event library. This library enables you to send an event from one task to the other. One Sketch sends events while the other Sketch waits for an event to happen and sleeps otherwise.
Monitor: This is an awesome utility Sketch that displays CPU utilization, task memory usage, etc. There are a couple of VT100 features in this sketch so best would be to use a VT100 terminal rather than the build in Serial monitor. For example, to continuously display the CPU load, type stats <space> <enter> and the CPU load will be updated in the terminal continuously.
MultiTaskSerial: Shows 2 threads sending a string to the Serial monitor at different rates.

You can find these examples in Energia MT under File->Examples->MultiTasking

Additional Benefits

Even when you are writing a single-threaded sketch for the MSP432, Energia will still compile it into the TI-RTOS.  While this will result in a larger code-size, it also brings the power and computational benefits of an RTOS.  For example, if you use a delay(500) at the end of your loop instead of ticking for 500 milliseconds, TI-RTOS will set an interrupt and go into deep sleep until the 500 milliseconds is up.


See Also

Examples and tutorials

Multitasking Tutorial

AT&T M2X Library available in Energia 15

There is another cloud service to add to your tool box and it is called M2X by AT&T.  M2X is a data store service targeted for the Internet of Things, which means you don’t need to go through the trouble of setting up your own custom server in order to post usable data to the cloud. Simply use the APIs available in the Client Library and you can quickly start posting things like temperature data, GPS coordinates, and system states. This makes it very easy to use for data logging and data monitoring where you want to keep a record of values and thresholds and perhaps trigger actions based on how the data changes.

Check out the tutorial page here to get started. www.energia.nu/m2x


Another exciting part of M2X is called Flow Designer, which is a Node-RED style graphical interface to help you organize your cloud application.  It provides seamless integration with M2X and other AT&T services and will help you link those to other web services and embedded devices. Look for more updates on this tool as it improves.


Deconstructing IoT with Temboo // Creating a CC3200-based water usage monitor

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.

Be sure to check out the video & instructable to create our own internet-connected water monitoring system!
Check out the instructable here!

Instructable Temboo IoT Cloud water monitoring system with TI LaunchPad