Measuring temperatures from -250C to +1600C with AVR-T32U4 Arduino Leonardo and MOD-TC-MK2-31885 + thermocouple

Image

MOD-TC-MK2-31885 is UEXT module which uses MAX31885 and allow temperatures in range -250C to +1600C to be measured with proper thermocouple.

For this demo we use TC-K-TYPE which is low cost K-type thermocouple.

When the thermocouple is connected pay attention that it have polarity i.e. if your measurements start to decrease when you increase the thermocouple end temperature you have to swap the thermocouple wires to the connector.

Another issue we got with Arduino 1.0.4 is that Serial print from time to time stop working on Leonardo and several uploads usually solve the problem, we guess this is some USB port problem and Leonardo is not properly enumerated as CDC serial port every time.

Also I2C library on Leonardo sometimes beahve weird and in this case you have to decrease I2C speed a bit. So if the sketch do not work correctly just edit TWI_FREQ to 80000L in:

C:\arduino-1.0.4\libraries\Wire\utility\twi.h

#ifndef TWI_FREQ
 #define TWI_FREQ 100000L
 #endif

You can watch the demo at this video: http://www.youtube.com/watch?v=ltS5ZEJiCEM

As you can see there are two temperatures which are measured: the temperature on the thermocouple TC and the internal MAX31855 temperature INT (i.e. cold end thermocouple temperature).

Also MAX31885 recognize if the thermocouple is disconnected, shorted or connected to VCC.

The demo code is at GitHub: https://github.com/OLIMEX/DUINO/tree/master/AVR/MOD-TC-MK2-31885

STELLARIS-UEXT adapter for Stellaris launch pad in stock

Image

STELLARIS-UEXT is Texas Instruments Stellaris Launchpad to UEXT adapter.

We have prepared demo code for MOD-GSM, MOD-MP3, MOD-GPS, MOD-TC, MOD-SMB380, MOD-IRDA, MOD-LCD3310 so you can interface these modules from your Stellaris Launchpad.

As Stellaris MCU have two SPI, I2C and UARTs we made the adapter with two separate UEXT connectors so you can connect two independant UEXT modules to it. Each UEXT have power up/down control with MOSFET so you can power up and down UEXT modules connected.

iMX233-OLinuXino-MAXI measure temperatures -200C to +700C with 0.25 resolution

Image

MOD-TC-MK2-31855 allow tempearture measurement with high precission in range -200+700C.

As this board interface UEXT connector via I2C many such modules and thermocouples can be attached to one UEXT.

This GitHub project https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/iMX233/MOD-TC-MK2 allow iMX233-OLinuXino-MAXI to measure temperature with MOD-TC-MK2 and K-type thermocouple.

OLIMEXINO-STM32 NEW DEMO EXAMPLES UPLOADED

Image

OLIMEXINO-STM32 is Arduino like board based, which works with MAPLE IDE.

Three new demo examples are uploaded on OLIMEXINO-STM32 web page: https://www.olimex.com/dev/olimexino-stm32.html

1. Measuring temperature with K-type thermocouple and MOD-TC

2. Lot-Of-Leds (LOL) shield demo example – looke at this video what LOL is: http://www.youtube.com/watch?v=FVRrOtP1Dvk&feature=youtu.be, we have 3mm 5mm 10mm and SMT LED LOL shields and the PTH come in DIY kit form or completely assembled.

have fun :)

DuinoMite Project: Interfacing Real Time Clock DS1307 and Interfacing BMP85 temperature / pressure

Image

Mathias Johansson just posted two new projects made with DuinoMite on KSD forum:

DS1307 RTC interfacing and BMP085 temperature and pressure sensor interfacing

DUINOMITE – MEASURING TEMPERATURE II (LM335Z)

Today I decided to try another schematic for measurement of the temperature this time with LM335Z low cost sensor.

LM335Z have 0V at absolute zero temperature i.e. -273.2C and it’s output increase with 10mV/C so at room temperature the sensor will output about 2.73V

to measure this temperature with Duinomite is piece of cake:

10 SETPIN 1,1  ‘setup PIN(1) as analog input

20 PRINT “ROOM TEMPERATURE IS”;PIN(1)*100-273

the problem is that PIC32 Analog input can’t take more than 3.3V on it’s ADC, so maximal temperature measured will be 57C well this still is enough for some application, but why not measure the complete temperature range -40C+100C ? (if you use LM135 the range will be -55+150C)

to do this we have to add resistor ladder which to divide the output voltage, TassyJim uses 18K/27K in his project posted at TheBackShed forum, and I found his 0.6 round divider as nice so decided to use same values.

the schematic if used for industrial applications should have some protection diodes and resistors like on this picture:

Image

but for the experiment I just used R1, R2, R3 and wired them to DuinoMite-Mini with jumper cables:

Image

then  I wrote this simple code:

10 SETPIN 1,1

20 PRINT “ROOM TEMPERATURE IS: “; PIN(1)*166.7-273

RUN

ROOM TEMPERATURE IS: 24.5645

it’s really not so hot in my office so I start thining what is wrong and I found it – I used 5% resistors as I had no preciese resistors so the voltage divider was not exactly 0.6 but something else and was mixing my result, no problem I took preciese ohm meter and measured R2 and R3 the values are:

R2 = 17 860 ohm

R3 = 26 600 ohm

aha so the voltage divider is 0.59829! and the coefficient I have to use in the formula is 100/0.59829 = 167.1

I corrected the formula:

20 PRINT “ROOM TEMPERATURE IS: “; PIN(1)*167.1-273

RUN

ROOM TEMPERATURE IS: 23.6145

so with not preciese resistors I got preciese result because DM-BASIC have no problems to work multiply real numbers

so the complete code to measure temperature in -40C+100C with LM335Z fits in one line

PRINT “ROOM TEMPERATURE IS: “; PIN(1)*167.1-273

Measuring temperature in range -55C +150C with Duinomite and KTY81,110

ImageKTY81,110 is low cost PTC thermistor from NXP. it changes the resistance dependant on the temperature positively i.e. increase with the temperature increase. It’s very nice solution for not so precisely temperature measurement and it’s very cheap.

I evaluate it as potential candidate for Solar Water Heating controller temperature sensor as it works in nice teperature range -55C to +150C.

The NXP datasheet for KTY181,110 is at NXP site as you can see there is table with approximate values at different temperature, the resistance / temperature is not linear but can be easily calculated with DuinoMite.

To measure the temperatuere we connect KTY181.110 in series with 3300 ohm resistor to +3.3V and will measure the temperature with PIN(1) analog input.

Here is the table with the temperature, KTY81.110 resistance and measured voltage

t R V
———————–
-55 490 0.42665
-50 515 0.44548
-40 567 0.48386
-30 624 0.52477
-20 684 0.56657
-10 747 0.60912
0 815 0.65358
+10 886 0.69847
+20 961 0.74426
+25 1000 0.76744
+30 1040 0.79078
+40 1122 0.83731
+50 1209 0.88483
+60 1299 0.93209
+70 1392 0.97903
+80 1490 1.02651
+90 1591 1.07346
+100 1696 1.12026
+110 1805 1.16680
+120 1915 1.21179
+125 1970 1.23359
+130 2023 1.25416
+140 2124 1.29226
+150 2211 1.32395

the code is pretty simple, we store the table in DATA and read it to T() and V() arrays which hold the temperature and voltage at the reference points

5 OPTION BASE 0
10 DATA -55,0.42665,-50,0.44548,-40,0.48386,-30,0.52477,-20,0.56657,-10,0.60912,0,0.65358,+10,0.69847
20 DATA +20,0.74426,+25,0.76744,+30,0.79078,+40,0.83731,+50,0.88483,+60,0.93209,+70,0.97903,+80,1.02651
30 DATA +90,1.07346,+100,1.12026,+110,1.16680,+120,1.21179,+125,1.23359,+130,1.25416,+140,1.29226,+150,1.32395
40 DIM T(23),V(23)
50 FOR I = 0 TO 23: READ T(I): READ V(I): NEXT I

then we setup PIN(1) as analog input:

60 SETPIN 1,1

as the temperature is read pretty fast and we don’t need so fast measurement we read the temperature 1000 times then average it for better precision ;)

70 NRD = 1000 ‘number of times to read
100 ‘read temperature
110 VOL = 0
120 FOR I = 1 TO NRD: VOL = VOL + PIN(1): NEXT I: VOL = VOL / NRD

then check if the voltage is in the range we expect i.e. -55 +150C and if not generate error

130 IF VOL < V(0) OR VOL > V(23) THEN 180

then we search in the table for near higher temperature reference point

140 I = 0
150 DO
160 IF VOL > V(I) THEN I = I + 1 ELSE GOTO 200
170 UNTIL (I=23)
180 PRINT “ALARM – TEMPERATURE OUTSIDE -55+150C”

then calculate exact temperature

200 TEMP = T(I)-(V(I)-VOL)*(T(I)-T(I-1))/(V(I)-V(I-1))
210 PRINT “TEMPERATURE IS:”; TEMP
220 GOTO 100

here you can see screenshot of the program running in my office

Image

Follow

Get every new post delivered to your Inbox.

Join 547 other followers