Hello, my name is David Pello and I'm from Asturias, North Spain.

I work at LABoral arts and industrial creation centre as the manager of the production centre and labs, and will be the one in charge of the Asturias FabLAB (opening soon).

My idea for my final project is the design, construction and programming of an open source platform for high altitude balloon tracking, including structure (support, thermal isolation, etc), and electronics (MCU, radio transmission, gps, sensors, etc).

Classes > Input Devices

For this assignment I wanted to start using some of the electronics I'm designing for my final project, so I'm not using AVR microcontrollers but MSP430 ones.

MSP430 is a family of microcontrollers by texas instruments, they are 16 bit, ultra-low power, and have a wide range of processors from really small to very powerful ones with lots of preripherals. But most important, they are supported by opensource tools like GCC compiler and GNU binutils, mspdebug for programming and debugging, and if you want a full-featured IDE, Eclipse supports MSP430 with all bells and whistles.

Texas Instruments are really into supporting hobbysts, so some months ago they started to sell the MSP430 Launchpad, a board with integrated programmer and debugger, power supply, usb-serial converter, and some LEDs and switches, something like a MSP430 "arduino", The board comes with two MSP430 microcontrollers, an extra crystal, male and female headers, and some documentation, all for 4.30$ including shipping. So, really nice and cheap microcontrollers, really nice and cheap prototyping platform, and open-source tools. Who can say no?

MSP430 Launchpad

So, for my project, I'll be using the MSP430g2553 microcontroller, 16K Flash and 512bytes RAM, with uart/spi/i2c/irda, two 16bit timers, lots of analog and pwm channels, and so on. You can see the full datasheet at Ti's website. At the software side you need to install msp430-gcc and msp430 binutils and mspdebug.

My final project will be reading data from the environment in it's flight. One data I want to read is external temperature. I need a temperature sensor with a big range as at 30km up you can be at -40ºC. So first I tried using the LM35, an analog temperature sensor, with a nice range from -55 to 150ºC and a linear output of 10mV per 1ºC.
Datasheet: LM35.
LM35

So reading the temperature from the LM35 is easy, I just need to read the value from one ADC channel and use a simple calculation to get the temperature, as the sensor outputs 10mV per ºC, you just need to multiply the ADC output value for the VCC (3.6V on the launchpad) and for 100, and then divide it for 1024 (10-bit ADC resolution).

Then I wrote a simple program to read the ADC, and if the temperature is bigger than 30º I turn on the LED1 on the launchpad. I can warm the LM35 with my fingers to test the program. It worked.
Code:
  • Makefile
  • main.c
  • utils.h
  • utils.c
  • adc.h
  • adc.c


    LM35 Launchpad OFF

    LM35 Launchpad ON

    I also wanted to use a digital sensor, so I don't need to compesate an analog reading based on environmental parameters like temperature, battery voltage and so on. So I choosed the DS1624+, a temperature sensor by Maxim with a i2c interface, and with a range from -55°C to +125°C, in 0.03125°C increments (-67°F to +257°F in 0.05625°F increments).

    DS1624

    So first I needed to talk i2c. The MSP430g2553 has hardware support for i2c communication, but as I want to use the USCI (the hardware that controls the UART/SPI/I2C...) for UART to talk to the GPS and GPRS modules of my final project, I needed to write a software i2c routine. The i2c protocol is really simple, and for controlling most of the i2c devices you don't have to implement all of the i2c protocol. So after looking at some code for software i2c for avr or pic microcontrollers, I wrote routines for my MSP430.

    Then using this routines, I wrote some code for the DS1624 sensor, to read the temperature data and convert it to celsius degrees.

    And finally I wrote a really simple program to test everything, that reads the temperature from the sensor and if it is higher than 25ºC, it turns on the LED1 on the launchpad board. After some fixes and some debugging using my logic analyzer, everything works as expected.

    Code:

  • Makefile
  • main.c
  • utils.h
  • utils.c
  • i2c_sw.h
  • i2c_sw.c
  • ds1624.h
  • ds1624.c

    After finishing this I discovered that the USCI of the MSP430g2553 has two channels, USCIA and USCIB, so I can talk hardware UART and I2C at the same time using different pins. So I'll rewrite the i2c routines to make use of the hardware support in the microcontroller.

    Back