Product Road Test: MSP430 Launchpad Value Line Development Kit

Product Road Test: MSP430 Launchpad Value Line Development Kit

A couple of years back I had ordered a few of the MSP430 Launchpad development kits with many ideas in my head about some of the great things I could make on a low cost micro-controller development board at only $4.30 who can complain. I took the first one out of the box and started to bang away. I was a PIC processor guy so I had to learn new stuff and there really was not much out there for demos and code examples other than blink LED code and lots of stuff I was not interested in trying out. I spent about a week at it and developed a temperature monitor that read back values from the internal temp sensor that you could read from a serial port. Using the Code Composer Studio was also a learning experience, it took a long time to figure out how the IDE worked. The memory space was limited to 2K with the MSP430G2231 and MSP430G2211 that were included in the kit. All and all the kits were a great value but I did not want to waste my time, so I shelved the other kits that I bought.

The other day Newark Element 14 asked the Mad Scientist Hut to run a product road test for a  Development Kit , I agreed  to try out the MSP430 Launchpad since I wanted to see if there are any improvements to the value line Launchpad. I received the new kit and opened it up, I was really excited to see that they had put a M430G2253 and M430G22452 in the kit, 16K and 8K of memory respectively and several more IO pins, they still included the 32KHz crystal for real time clock applications and they still include the USB cable.

In my opinion there has been a major development in making the Launchpad one of the best values for a micro-controller development kit than it has ever been, and that is because now there is an Arduino like IDE for the Launchpad that is mostly code interchangeable with Arduino called Energia.  Energia is a fitting name since it was the name of the Russian rocket designed to carry the Russian version of its space shuttle to orbit. I downloaded the software for Energia and started to dable with it, I was really impressed. Wow! I developed the code that took me a week in just two hours using Energia, but with the addition of an LCD display and I also added a elapsed time counter. To get started with Energia click this: Getting started with Energia This link has a nice quick start guide that will have you blinking and LED on the launchpad in just a few minutes.

To get started with the Launchpad kit, you can get them from Element 14 for just $4.35 each click here: MSP430 Launchpad

Update: I added an SHT15 temperature and Humidity sensor, see this post https://madscientisthut.com/wordpress/?p=1430

To see a larger image, click image then click image on the next page (some wordpress thing I have yet to figure out)

MSP430 Launchpad displaying internal temperature and elapsed time

.

Here is the code (consumes 6804 Bytes), it uses the internal temperature sensor to measure temperature in degrees F, and calculates the elapsed time (HHHHHH:MM) since power up then displays it to the LCD:

Download the code by clicking here, then click on link on the next page (once again wordpress issue):Demo_code_3

The below code will not paste into the IDE you get carriage returns and other stuff that keeps it from compiling, it is here for you to examine. Thanks to the wonderful posts at www.hobbielektronika.hu website which I had to translate to find the errors.

/*

The circuit:
=================================
LCD pin              Connect to
———————————
01 – GND             GND, 10K pot
02 – VCC             +5V from next to the USB port, 10K pot
03 – Contrast       10K  Pot wiper
04 – RS              Pin8 (P1.4)
05 – R/W             GND
06 – EN              Pin9 (P1.3)
07 – DB0             GND
08 – DB1             GND
09 – DB2             GND
10 – DB3             GND
11 – DB4             Pin10 (P1.1)
12 – DB5             Pin11 (P1.2)
13 – DB6             Pin12 (P1.6)
14 – DB7             Pin13 (P1.7)
15 – BL+             +5V
16 – BL-             GND
=================================

*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(P1_4, P1_3, P1_1, P1_2, P1_6, P1_7);

/// Vars used in code
long  sensorValue = 0;
int   Temp_Gain = 1000; /// gain error (x10*-1.0)+1000 I.E.>  if error = -0.5% Temp_Gain = 1005
int   Temp_Offset = 0;  /// offset error /10 I.E.> if error = 2.1 degrees Temp_Offset = 21
long  FValue = 0;
float FValue1000 = 0;   // using float here uses a lot of flash mem, this can be converted to long and then some tricks can be done on the display output, but I have lots of flash for this demo…..

// used in elapsed_time
unsigned long lastSecond = 0;
int secs = 0;
int mins = 0;
int hours = 0;
//end elapsed_time vars

/// end vars

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
lcd.print(”  Temp F:”);
lcd.setCursor(1, 1);  // set cursor location on LCD
lcd.print(“Elapsed:”);

}

void loop() {

////////////////////////////////////////////////////////////////////////
//// measure internal temperature and display

FValue1000 = 0;
for (int count = 0; count < Temp_Gain; count++)
{

ADC10CTL1 = INCH_10 + ADC10DIV_3;         // Temp Sensor ADC10CLK/4
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE;
TACCR0 = 30;                              // Delay to allow Ref to settle
TACCTL0 |= CCIE;                          // Compare-mode interrupt.
TACTL = TASSEL_2 | MC_1;                  // TACLK = SMCLK, Up mode.
LPM0;                                     // Wait for delay.
TACCTL0 &= ~CCIE;                         // Disable timer Interrupt
ADC10CTL0 |= ENC + ADC10SC;               // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE);          // LPM0 with interrupts enabled

sensorValue = ADC10MEM;                   // store the ADC10 value

FValue=(((sensorValue) – 630) * 761) / 1024;   // do math on ADC10 value to convert to degrees F
FValue1000 = FValue1000 + FValue;              // store value (this is how we can apply gain to the measurement)
}

FValue1000 = (FValue1000/Temp_Gain);    // do gain error

FValue1000 = FValue1000 + Temp_Offset;  // do offset error

// location formating

lcd.setCursor(11, 0);  // set cursor location on LCD
lcd.print(”    “);      // clear area to write the temperature
lcd.setCursor(11, 0);  // set cursor location on LCD

if (FValue<=10.0)
{
lcd.print(”  “);
}
else if (FValue<=100.0)
{
lcd.print(” “);
}

lcd.print(FValue1000);
//delay(100);

///////    end temperature display
/////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// elapsed time to display

if(millis() – lastSecond >= 2000) ///just in-case something took more than two seconds,  should not happen??
{
lastSecond += 2000;
secs++;
secs++;
}
if(millis() – lastSecond >= 1000)
{
lastSecond += 1000;
secs++;
}
if(secs > 59)
{
secs = 0;
mins++;
}
if(mins > 59)
{
mins = 0;
hours++;
}

//place hours in correct position
if( hours <= 9 )
{
lcd.setCursor( 12, 1 );
lcd.print( hours, DEC );
}
else if( hours <= 99 )
{
lcd.setCursor( 11, 1 );
lcd.print( hours, DEC );
}
else if( hours <= 999 )
{
lcd.setCursor( 10, 1 );
lcd.print( hours, DEC );
}
else if( hours <= 9999 )
{
lcd.setCursor( 9, 1 );
lcd.print( hours, DEC );
}
else if( hours <= 99999 )
{
lcd.setCursor( 8, 1 );
lcd.print( hours, DEC );
}

// do minutes
lcd.setCursor( 13, 1 );
lcd.print( “:” );

if( mins <= 9 )
{
lcd.print( “0” );
}
lcd.print( mins, DEC );

///// end of elapsed time

}

Leave a Reply

Your email address will not be published. Required fields are marked *