Tag Archives: project

Testing TI’s LaunchPad

TI LaunchPadEver since I read Hack a Day’s post on TI’s $4.30 LaunchPad development board, I’ve been itching to get my hands on one. So two weeks ago, while putting together a small DigiKey order, I checked to see if the LaunchPad was in stock. Lo and behold, it was. So of course I immediately added it to my order. This past week, my LaunchPad arrived.

I must say, what you get here for your four bucks and change is pretty impressive. The development board is USB powered and contains all the necessary hardware to program and debug MSP430 microcontrollers (MCUs) in up to 20-pin DIP packages. The kit includes two MCUs, the MSP430G2211 and the MSP430G2231. Both chips have 2kB of flash memory, 128B of RAM, and 10 GPIO pins, but the 2231 also provides a universal serial interface (I²C and SPI only), an 8-channel 10-bit ADC, as well as an internal temperature sensor. The board ships with the 2231 in place and programmed with a nifty temperature sensor program that’s ready to run.

The kit also includes two optional headers you can solder into the 0.1″ pitch breakout connectors on the left and right sides of the board. There’s even a 0.5m USB cable included! The only thing lacking is software, but who wants CDs anyway? Instead, TI offers two free (but limited) IDEs for download on their LaunchPad Wiki.

Now before I delve into my experiences with the LaunchPad, I should let you know that I’m very much a fan of Atmel’s AVR line of MCUs. I’ve been programming 8-bit ATTinys and ATMegas for about five years now and am quite satisfied with their performance. I’ve never touched another Texas Instruments MCU and have only had limited experience with PICs. So, just understand that this is where I’m coming from. I’ll also include a short comparison between the MSP430G2231 and the similar ATTiny24 at the end of this post.

The Project: Does Your Fridge’s Light Really Turn Off?

Ok, call my crazy, but the first thing I thought of when I found out the 2231 had a built-in temperature sensor was, “I wonder how cold my fridge is?” My second thought (having been running tests with a phototransistor last week) was, “I wonder if that light in the fridge actually turns off?” It’s a question I’m certain everyone has asked themselves at one point or another. Of course normal people might just test this by pressing the door switch, but not me (and yes, I know what that means). So here’s what I had in mind:Launchpad Fridge Test SetupI started by modifying the demo program provided with the launchpad to read two analog inputs: the temperature sensor and input A7. I then connected A7 to a phototransistor (which you can think of as a light-dependent resistor) wired in series with an adjustable resistance (a 500kΩ potentiometer) as shown here:

Phototransistor CircuitThe potentiometer is used the adjust the sensitivity of this circuit for varying lighting conditions. That extra 2.2uF capacitor isn’t strictly necessary, it just removes noise caused by EMI and flickering lights. So, I connected the UART TX pin from the LaunchPad to my SparkFun BlueSMiRF module (a nifty Bluetooth serial modem I picked up a couple of years back for a different project). Power for the entire setup is provided by a 9V battery run through a 3.3V DC-DC converter (see my previous post on regulator efficiency).

LaunchPad in FridgeWell there it is – the entire setup powered and running inside my refrigerator. The green light on the BlueSMiRF tells you it’s connected. But as you might imagine, with the fridge being a large metal box, Bluetooth reception was quite poor with the door closed. I had to put my laptop right up against the side of the fridge to get a good connection. But other than that difficulty, the system worked great. And of course, I built a small LabVIEW VI to plot and display temperature and light data on my laptop:

LabVIEW Data Graph (Arrow Indicates Door Closing)The graph on the top indicates temperature in Fahrenheit while the bottom graph plots phototransistor voltage versus time. The red arrow indicates the point at which I closed the fridge door. Now, voltage and light intensity are inversely related in this case. In other words, a low phototransistor voltage means high ambient light. A voltage of 1.5V indicates a total absence of light. So, since the voltage at the arrow jumps from almost zero to 1.5V, we can be confident that yes, the light inside the refrigerator did in fact turn off. Yay!

My Impressions of the LaunchPad

As I was working with the LaunchPad, I kept a few notes about my experience which I’d like to share here. The first thing I’ll mention is that TI is doing a great job keeping lots of useful information on their LaunchPad Wiki. I had no trouble finding the software and information I needed. Plus, they’re maintaining a Learning Community with links to many interesting LaunchPad projects. So good marks for TI there.

In looking through the available IDE options on the LaunchPad site, I decided to go with Code Composer Studio (CCS) because of its higher compiled code size limit (16kB vs 4kB for IAR) and because it’s produced by TI. I must say though, the download and installation of CCS took quite some time, even on my fairly modern T61p laptop, even with just the MSP430 components selected. However, the default layout of CCS suited me fine:

Code Composer StudioAs I mentioned, to develop the code for my fridge project, I started with TI’s demo application, then added and removed bits as needed. Before even touching the code however, I went through it line by line with the datasheet open next to me so that I could start to understand the MSP430 line a little better. I was slightly disappointed in the amount of commenting provided, given that this was a demo application. My feeling is that in demo code, just about every line should get a comment. Also, I noticed one or two comments that appeared to be incorrect (specifically, near the clock divider settings).

I was further impressed by the LaunchPad’s ability to perform debugging with hardware connected. This is something I’ve not done with the AVRs because I’ve never had the proper equipment, only a programmer. But with the LaunchPad, you can actually step through your code line by line and watch the results on your MCU. Very cool.

One thing that struck me as strange was the need to stop the watchdog timer at the start of every program (unless your program makes use of its default settings). It looks like the WDT defaults to a reset every 32768 cycles unless stopped or handled properly. This seems like something that could trip up even seasoned users every now and then.

Comparison Table

Finally, I’d like to show you a feature-by-feature comparison between the MSP430G2231 and the ATTiny24. I’ve selected the ATTiny24 because it provides exactly the same amount of RAM and flash memory as you get with the 2231:

Feature ATTiny24 MSP430G2231
Price $2.52 $2.17
Program Memory 2kB 2kB
RAM 128B 128B
EEPROM Size 128B 256B**
Max. Clock Rate 20Mhz (10Mhz*) 16Mhz
Max. I/O Available 12 pins (inc. reset) 10 pins
Voltage Range 2.7 – 5.5V (1.8 – 5.5V*) 1.8 – 3.6V
ADC 10-bit, 8ch 10-bit, 8ch
Internal Temperature Sensor? Yes Yes
ADC Sampling Rate 15ksps (at max res.) 200ksps
Timers 1x 8-bit, 1x 16-bit 1x 16-bit
Serial Interfaces I2C, SPI I2C, SPI
Architecture 8-bit 16-bit
Active Power @ 1Mhz 540µW* 484µW
Lowest Power Draw 0.18µW* 0.22µW

*Data for the slower, low-power ATTiny24V.
** This chip does not have EEPROM but instead uses flash “Information Memory” for permanent storage, 64B of which is for calibration data by default (this can be changed).

In the above table, I’ve used green to highlight better features, where it seems a clear distinction can be made. Now although the ATTiny24 truly can provide 12 I/O pins, I should note that this requires you to disable the reset pin (via fuse settings). So unless you have a high-voltage programmer available, the code on your chip will be permanent.

Well as best I can figure, these two chips are about equal in terms of hardware. It really comes down to your specific application. Do you need high ADC sampling rates? Then go with the MSP430. Do you need an extra timer? Then get the ATTiny24. Of course, there are other chips within each family that may provide a better match for you. Ultimately, I suspect most people will pick the chip they’re most familiar with. For me, it’s the AVR.

There’s one last cool feature I should mention about the LaunchPad before closing. It can be used program some of TI’s other MSP430 products like the Chronos watch module.

LaunchPad with Attached eZ430-RF2500 Target BoardIn closing, I’d say TI has done a great job with this board. I’ve certainly enjoyed toying with it. Plus, at $4.30 it will certainly help to grow the MSP430 user base. I’m looking forward to using it more in the future. Thanks for reading!

Project Files

A Shiny Box of Fuel Cells

This week I completed the last of what RPI requires for a Master of Science degree in Electrical Engineering. Since I’d finished my thesis in the spring, I only needed three more credits to graduate. So I opted for a summer independent study. And what did I independently study? Fuel cells! (From an educator’s perspective.) It just so happened that my supervisor had previously purchased a commercial 300W PEM fuel cell stack. He wanted to use it in some sort of educational demonstration, but wasn’t sure exactly how to make that happen. So my project for the summer was to design and build just such a system. Our goals were to make the system:

  • Instructional for students of all ages
  • Portable and self-contained (no need to ever plug into AC power)
  • Visible (both the components and their connections)
  • Interactive (something you’d like to play with)

With this in mind I put together what I felt was a solid design, then went to work constructing it. With the help of some of my lab mates, we built the following:

Fuel Cell Demo System FrontWhat you see here is a large 80/20 box measuring about 30″ x 20″ x 11″ and covered with acrylic panels. As you probably guessed, the large red tank is the hydrogen supply, pressurized to 2000psi when full. That pressure is regulated down to about 6psi for the fuel cell stack. The gas passes through a ball flow meter and solenoid valve before reaching the fuel cell stack – located just to the left of and behind the red LED panel voltmeter.

Our fuel cell stack is produced by Horizon Fuel Cell Technologies, model H-300 (more details here). It’s an air-breathing PEM-type stack, composed of 72 individual fuel cells strung together in series. The voltage produced by the stack varies from 40-60VDC depending on the amount of current drawn. Now this variation is unsuitable for most electronics, so it’s first passed through a DC-DC converter (the largest black box just to the left of center). The converter takes the varying input voltage and steps it down to about 13VDC for use in the rest of the system.

You may also notice a 12V lead-acid battery strapped into the middle of the demo box. This serves two purposes. First, and most importantly, it provides power to the stack’s control module during startup. This is necessary to open the solenoid valve and engage the three fans mounted to the side of the stack. Second, it provides a bit of buffering during transients (e.g. when all the light bulbs are flipped on). One problem with fuel cells is that they cannot respond quickly to changing loads. Batteries, however, can rapidly supply more or less current without significant changes in voltage (large capacitors also have the same effect).

The rest of the system consists of an array of ten 12V, 13W light bulbs, a 120VAC inverter, and equipment to monitor voltages and current at several points within the system. This equipment is mounted to the rear of the system, shown here:

Fuel Cell Demo System Rear DAQ HardwareThe data acquisition (DAQ) module shown above is produced by National Instruments, model USB-6009, and is capable of monitoring eight analog inputs at 14-bit resolution. These analog inputs are fed from a custom PCB I designed, mounted directly below the DAQ module. This PCB is responsible for measuring currents using ACS712 hall-effect sensor ICs. It also performs voltage division so that the system’s voltages are within the measurement range of the DAQ. Last but not least, the PCB allows for computer control of the ten light bulbs using MOSFETs controlled by the DAQ’s digital outputs.

From the start, I knew I wanted to use LabVIEW to monitor and control the system – it’s built for data acquisition and handles simple controls quite well. The only question was, what sort of hardware should I run it with? Since I didn’t need much horesepower and in fact was looking to minimize electrical power consumption, I went with the Asus Eee PC, model 1001PX:

Asus Eee PC 1001PXWith its dual-core Atom processor, the 1001PX actually performs quite well running Windows XP. Its 20-30W power consumption (when charging) is equally impressive. Running LabVIEW 2009 presented no performance problems whatsoever. My only qualm is the lack of screen resolution – 1024 x 600 is just a bit tight most of the time. However, space was no issue since all of my LabVIEW VIs were compiled into executables without scrollbars, menubars, etc. Here’s how the main panel turned out:

LabVIEW Front Panel

From this panel the user can monitor voltage, current, and power at different points throughout the system. The light bulbs can be turned on and off with a single mouse click. I’ve also created VIs for taking polarization curves (voltage vs. current density) and for monitoring the stack’s voltage at high speed (48kHz) during transients. To top it all off, the Eee is loaded with a sample presentation containing the principles of operation for fuel cells as well as diagrams for the demo system itself.

The system has yet to be tested in a real classroom environment. Sadly, I may not be around to see that happen. But I’m pretty confident that it’ll be put to good use. The grand total for all parts in the system? About $4000. Thanks for reading!