Archive for the ‘Launchpad and Energia’ Category

Tiva C LaunchPad Base Plate, Easy Wiring

September 2, 2016 3 comments

A week ago went back to to Tiva C launchPad, this time I am interested in to refresh some concepts and try examples of RTOS (Real Time Operating System). The use of a RTOS usually means several hardware peripherals (sensors, keypads, displays .. etc). A breadboard and many jumpers was filling my imagination.



I need a Base Plate to organize the wiring, also a way of use top and bottom connectors in the launchPad. This is the story of last two days…

First thing, I need to finish the assembly of a tablesaw from Grizzly (it was resting semi-assembled in the garage).


Note:This project will be done in a couple of hours using acrylic plastic  if you have access to a laser cutter, in my case I am fan of woodworking… (the laser will come some day…).


A serie of images will explain the project…


While dried, we need a pin reference for the bottom:



Time to put all together…




Here is how looks the wiring of the TFT Display:


This is the wiring diagram of the ST7735 used:


… thanks for visiting.




Battery Life of an ESP8266 design

January 11, 2016 1 comment


The use of the relatively “new” and absolutely  “cheap” ESP8266 IC generates a rush in the apparition of new IoT  applications.

Lately I’m looking for devices that can run on batteries for months.

A device inside my mailbox twittering when the door was opened.

A moisture sensor reporting every hour from a spot in the garden, sending the data to ThingSpeak .

A tank level sensor reporting when low critical level is reached.


Working with Energía and the Texas Intrument’s Launchpads found the EnergyTrace tool.

How EnergyTrace measure power?
A software controlled DC-DC converter generates the target power supply (1.2 V-3.6 V).
The time density of the DC-DC converter charge pulses equals the energy consumption of the target microcontroller.
A built-in calibration circuit defines the energy equivalent for a single charge pulse.
The width of pulses remains constant. By counting  the charge pulses during a period of timed the average current is calculated.


By removing the jumper of 3.3V to the development section and connecting my ESP8266 based device the EnergyTrace can be used to estimate the battery life.



My  approach for the battery  power is to use a LDO regulator with very low quiescent current and 3 AA alkaline batteries.


To reduce power the power-on LED and the light sensor LDR were removed.

The RGB led and some other resistors were also removed.


This post is in construction….


LaunchPad Energia and Stepper Motor

July 10, 2013 15 comments

Using the MSP430 LaunchpPad and Energia to control a stepper motor.
For this project a former Arduino’s project was used.


First thing was to make the stepper and driving board as a single assembly, this make it easier to experiment with it in the future.


Some wiring to connect the Launchpad (3.6 Volts) was done.
The stepper motor can be powered from the USB Voltage (5 volts at TP1) or
an external power supply. In this case I used both for testing purposes, the USB power and a Power adapter.



The connections are shown as an image to make it easier for all.


And now the code:

StepperPot_11 13 APRIL 2013

A stepper motor follows a potentiometer on analog input 5.
A software low-pass filter is used to reduce the noise in the analog reading.
After 3 seconds of inactivity the motor coils are turned OFF to save energy.
The RED_LED is used to signal when the stepper is powered.

LaunchPad with MSP430G2553.
Driver: ULN2003A
Stepper Motor:  28BYJ48, 5VDC, step pangle 5.625 °
                Gear reduction 64:1
                No-load starting frequency:> = 500PPS (4 rpm)
                Coil resistance 60 Ohms.               

#include <Stepper.h>

// change this to the number of steps on your motor
#define  STEPSREV    4096    // 64(fullsteps) * 64 (reduction ratio)
#define  COIL1       14
#define  COIL2       12
#define  COIL3       13
#define  COIL4       11
#define  POT         A5
#define  ENER        RED_LED
#define  TIMEOUT     3000    //Turns off after 3 secs of inactivity.

// create an instance of the stepper class, specifying
// the number of steps per revolution and pins atached to motor coils.
Stepper myStepper(STEPSREV, COIL1, COIL2, COIL3, COIL4);
int PotVal;
int LastPotVal= 0 ;          // To implement a software Low-Pass-Filter
int pos = 0;              // stepper position(0-4096)->(0-360°)
unsigned long stamp = 0;  // last move time stamped.

void setup()
  myStepper.setSpeed(4);  // set the motor speed to 4 RPM
  pinMode(ENER, OUTPUT);  // status led (coils energized).
//  Serial.begin(9600);   //for debuging.

void loop(){

  PotVal = analogRead(POT);       // Potentiometer value range 0-1023

  PotVal= map(PotVal,0,1023,0,2047);      // Map pot range in the stepper range.
  PotVal= PotVal * 0.1 + LastPotVal * 0.9 ;  // Filtering to reduce noise.
  LastPotVal= PotVal;

//  Serial.print(Val);              // For debuging.
//  Serial.print("   ");            //    "
//  Serial.println(pos);            //    "
//  delay(500);                     //    "  

  if(abs(PotVal - pos)> 4){              //if diference is greater than 4 steps.
      if((PotVal - pos)> 0){
          digitalWrite(ENER, HIGH);   //Motor energized.     
          myStepper.step(1);           // move one step to the right.
      if((PotVal - pos)< 0){
          digitalWrite(ENER, HIGH);   //Motor energized.
          myStepper.step(-1);            // move one step to the left.
      stamp = millis();               // stamp actual time.
  else {      
      if((millis() - stamp) > TIMEOUT){   //Turn Off coils after TIMEOUT.
          digitalWrite(COIL1, LOW);
          digitalWrite(COIL2, LOW);
          digitalWrite(COIL3, LOW);
          digitalWrite(COIL4, LOW);
          digitalWrite(ENER, LOW);    //Motor de-energized.


See in YouTube this experiment:

Stellaris LaunchPad and Energia

Here is the Stellaris LM4F120 LaunchPad from Texas Instruments.

This is a test of the ARM based development board using  Energia (Arduino-Like development environment).
The Blink example of the Arduino IDE was adapted to blink the RGB LED in the Stellaris:

The code used (the sketch):

/* Blink3LEDS.ino / DIC 2012
  Sketch to turn on the LEDs of The Stellaris LaunchPad in sequence.
  Each led (RED, GREEN and BLUE) are turned on for one second and then off for
  another second repeatedly.

void setup() {                
  // initialize the pins as digital outputs.
  pinMode(RED_LED, OUTPUT); 
  pinMode(GREEN_LED, OUTPUT); 
  pinMode(BLUE_LED, OUTPUT);

void loop() {
  digitalWrite(RED_LED, HIGH);    // set the Red LED on
  delay(1000);                    // wait a second
  digitalWrite(RED_LED, LOW);     // set the Red LED off
  delay(1000);                    // wait a second
  digitalWrite(GREEN_LED, HIGH);  // set the Green LED on
  delay(1000);                    // wait a second
  digitalWrite(GREEN_LED, LOW);   // set the Green LED off
  delay(1000);                    // wait a second
  digitalWrite(BLUE_LED, HIGH);   // set the Blue LED on
  delay(1000);                    // wait a second
  digitalWrite(BLUE_LED, LOW);    // set the Blue LED off
  delay(1000);                    // wait a second

See the Video on YouTube:

LaunchPad and Energia ( StopWatch )

September 12, 2012 4 comments

This is a simple project using the LaunchPad from Texas Instruments and Energia (Arduino-like IDE).

The Launchpad version 1.5 comes with the MSP430G2553 microcontroller, it has a hardware UART (use the  jumpers as shown in the image).

This is a funny and very low cost project.
The LaunchPad measures time (in microseconds) .The car travels a fixed distance between contacts (10 Cms).

Time is measured using  START and STOP contact switches.
Contact switches are implemented using neodymium magnets.

You’ll need small nails, miniature neodymium magnets and colors headed pins to  assemble the switches.

Here is the code used:

/* Cronometer01.ino 25/AUG/12
  Used in the LaunchPad V-1.5 with the MSP430G2553
  Measuring time between the signals of START and STOP  in microseconds.
  The result is sent serial at 9600 bauds.
  RED LED blinking indicate MEASURE DONE.
  Push RESET in the LaunchPad to repeat the measurement. 
#define START  11     //Pin P2.3
#define STOP   12     //Pin P2.4

unsigned long time;

void setup() {
  pinMode(START,INPUT_PULLUP);  //internal pull-up
  pinMode(STOP,INPUT_PULLUP);   //internal pull-up
  pinMode(GREEN_LED, OUTPUT);     
  pinMode(RED_LED, OUTPUT);

void loop() {
  digitalWrite(GREEN_LED, HIGH);   // set the GREEN LED on
  digitalWrite(RED_LED, LOW);      // set the RED LED off

  time = micros();
  digitalWrite(GREEN_LED, LOW);    // set the GREEN LED off
  digitalWrite(RED_LED, HIGH);     // set the RED LED on

  time = micros()-time;
  digitalWrite(RED_LED, LOW);      // set the RED LED off
  Serial.println(" Microseconds");

  while(1){                        // Blink to indicate END.
    delay(900);                    // wait 0.9 second
    digitalWrite(RED_LED, HIGH);   // set the RED LED on
    delay(100);                    // wait 0.1 second
    digitalWrite(RED_LED, LOW);    // set the RED LED off


See it in YouTube: