Saturday, January 29, 2011

Duothermo: sensor back but changed to LM335

Mystically found my DS18B20 sensor in TI LaunchPad box :) But I already started to work with LM335 analog sensor. Connected it to LaunchPad VCC and A1 channel of ADC10.
While ADC10 clock source is set to ADC10OSC read value is not constant, it's jumping around +/-3. While clock source is MCLK (with 8 divider, 16MHz/8) read value is pretty constant if temperature does not change. And with ADC10OSC value is 3 points higher. I don't really understant why it is so, but if I will need a low power mode I definitly will use ADC10OSC.
Now LM335 needs some calibration. I will use this sensor as external ranged (2-3 meters max) sensor so I want no more than 2 wires. I don't like hardware calibration, because I don't have small variable resistor pots :) I'll try to do it in firmware. I don't know if recalibration needed if I change Vref for ADC10. Now VCC as Vref used and it's 3.55V(or 3.56V) on LaunchPad. The actual project will use 3.3V. This will limit sensor temperature range to no more than 55C or so. It's ok for me. I can use 5V reference for MSP430G2231 which I use, but lose another pin, which is no go for now.

A1 read function:

Thursday, January 13, 2011

Duothermo: sensor lost

I somehow accidental lost my DS18B20 sensor, maybe threw away in garbage bin with some garbage from my table.
So I have to found some new sensor or fall back to single sensor mode, but I need to measure temperature externally.

Wednesday, January 12, 2011

TI LaunchPad project code name Duothermo

I selected some parts for this project. MCU is MSP430G2231 which have internal temperature sensor (MSP430G2211 does not have ADC). DS18B20 1-wire digital temperature sensor as secondary sensor. 74HC595 8-bit shift register to show digits on 7-segment leds with multiplexing. I desided to use 3 7-segment leds with decimal point. Actually I don't have 7-segment but I do have 14-segment leds, I'll just use them as 7-segment leds. 3 transistors to power and multiplex leds.

So I have to use 4 pins for shift register, 3 pins for led multiplexing, 1 for decimal point (but it can be instant on), 1 for negative temperature minus (this is would be a dot actually). 1 pin for 1-wire interface for DS18B20 sensor. So 9 pins at all. Full port 1 and 1 pin from port 2, so no external crystal. 1 spare pin, 2kb of flash.

I already wrote a driver for 74HC595 shift register and a function to read internal temperature in celcius, but without calibration. Temperature read is not that steady as I thought. It jumps a lot hi and low (from +39 to +28 just with one read) if ADC clock is set to ADC10OSC, but if clock selected as MCLK temperature read is pretty steady.

Here is a temperature read function:

It reads ADC10 value then converts it to 3 digit celcius value with decimal point. Temperature struct is for this 3 digit format.

Main problem now is to write 1-wire interface driver for DS18B20 sensor. My code already eat almost 1kb and I need 1-wire driver, segment multiplexing driver, temperature conversion for DS18B20. Another problem is that 1-wire interface needs correct timing and it's not as easy as 74HC595 spi interface. If I going to fail with Duo part of the project, I'll fallback to single termometer and maybe without DS18B20.

Full code is available as always:

Wednesday, January 5, 2011

TI LaunchPad project

A week or so ago I've recieved TI LaunchPad kits for experiments. It's pretty cheap kit, just $4.30. Contains 2 MSP430 line mcus both with 2kb flash, just like my favorite tiny Atmel AVR mcus.
It's time to think what project to do with this kit.

I need a double digital thermometer and MSP430 mcus have integrated temperature sensor.

For external parts I need external temperature sensor and 2 segment leds to show current temperature.

Time to think which sensor to use and how to show 2 digits on 2 segments leds with only 8 gpio pins. And how to calibrate internal sensor. Maybe buttons to calibrate or switch between two sensors.