Shop OBEX P1 Docs P2 Docs Learn Events
Problem reading temperature from AD592 probe using MAX1270 A/D converter — Parallax Forums

Problem reading temperature from AD592 probe using MAX1270 A/D converter

Chris23Chris23 Posts: 16
edited 2008-10-17 14:32 in BASIC Stamp
Hello everyone,

I am trying to built a temperature data logging system using 6-8 AD592 temperature probes for my final project at university. I have bought a BS2, the probes and a MAX1270 A/D converter. But i can't yet put them work together ! The first logic step for me is to read correctly the temperature from only one AD592 from channel 0 of MAX1270. For that reason, i used the operating circuit for MAX1270 from its datasheet at page 1.

As regards the adaptation circuit from AD592 TO MAX1270 I found something here...
www.emesystems.com/OL2heat.htm. I used the first circuit at paragraph 2) and the suggested equations for the conversion of MAX1270 readings to degrees Celcius....
ADch=5
gosub ADread0 ' get count, 1 count=1.25 millivolts=0.25 Kelvin
degC=result*25-27300
debug dec degC/100,".",dec2 degC," degrees Celsius"

So i came out first with this code...

' {$STAMP BS2}
' {$PBASIC 2.5}
AdcDOUT CON 10
SSTRB CON 2
>i am not exactly sure what this is and if it is of any use
AdcDIN CON 9
AdcCS CON 8
clockpin CON 7
controlbyte CON %10000000
result VAR Word
result = 0
degC VAR Word
DO
GOSUB Read_ADC
GOSUB Display
PAUSE 100
LOOP

Read_ADC :
LOW AdcCS
SHIFTOUT AdcDIN , clockpin, MSBFIRST, [noparse][[/noparse]controlbyte]
SHIFTIN AdcDOUT, clockpin, MSBPOST , [noparse][[/noparse]result\12]
HIGH AdcCS
RETURN

Display:

degC=(result*25)-27300

DEBUG DEC degC/100,".",DEC2 degC,"degrees Celcious"

DEBUG CR


RETURN

The results were something like this....

74.64degrees Celcious
79.64degrees Celcious
78.14degrees Celcious
79.64degrees Celcious
69.14degrees Celcious
86.14degrees Celcious
76.14degrees Celcious
65.14degrees Celcious
65.64degrees Celcious
81.64degrees Celcious
80.14degrees Celcious
75.14degrees Celcious
78.14degrees Celcious
77.14degrees Celcious
83.64degrees Celcious
83.14degrees Celcious
73.64degrees Celcious
78.64degrees Celcious


I thought first that there were calibration problems, but i don't think so. I tried to warm up the temperature sensor with my hand but there was no respone, the temperature was not rising.

Secondly, i used some alternative codes just for reading max1270 without bothering for temperature conversions....and i found ADC.bs2 from this link....
http://forums.parallax.com/showthread.php?p=601139

I used only channel0 and i got these results from the debug terminal for ADC.bs2 code..

Ain1.... 0.000
Ain2.... 0.000
Ain3.... 0.000
Ain4.... 0.000
Ain5.... 0.000
Ain6.... 0.000
Ain7.... 0.000
Ain8.... 4.998 (mV)

What am i doing wrong??? Please any suggestion could be very helpfull...

Thank you in advance,

Christofer

Comments

  • AmaralAmaral Posts: 176
    edited 2008-10-04 20:55
    ok .. let's try it Step by step !

    First - make your ADC talk to your BS2 ... you can simulate the voltage at each input and read it.
    once that this is done .. try every channel .. normally is not so ease to read separeted channels.
    After that you can plug your probes and then start thinking about convertions and tem[noparse][[/noparse]perature equivalences.

    Take it each small part at a time !

    Hope to help

    Amaral
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2008-10-04 21:22
    Hi Christofer,

    The MAX1270 is unusual in that it has a low input resistance, around 20 kohms to ground. That is part of the scheme that the '1270 uses to acheive bipolar inputs (+/- 5 or +/- 10 volts). If you are using a resistor to convert the AD592 current into a voltage for input to the ADC, it will have to account for the input resistance of the ADC, which will not be easy due to the inexact value of the input resistance. It will probably be necessary to use an op-amp between the AD592 and the MAX1270 input.

    There may be a problem with the wiring or code, too. Amaral's advice is good, to take it one step at a time, simulate the input voltage with a 1.5 volt battery.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris23Chris23 Posts: 16
    edited 2008-10-05 11:08
    Thank you for your suggestions,

    Amaral, you are right...i rushed...I will first try to communicate with MAX1270 via Basic Stamp 2 and be certain that this is working. I am a little bit confused and lost with this A/D converter because i can't find suffficient documentation for this product, whereas I did easily, for the TLC2543 Analog/digital converter. Also, I can't find any sample code for MAX1270 at www.parallax.com. What is more, I am not particularly familiar with reading datasheets, but i think i have to...in order to completely understand the function of this A/D.

    Tracy Allen, i would like to thank you for the "input resistance" information. I will take this into account. Could you provide me with more detailed information about the necessity of this op-amp..? The AD592 outpus a μΑ/Kelvin. So, if i use a 5KΩ resistor, it will be 5mV/kelvin. Isn't this enough for MAX1270 to understand? With a scale of 0-5V, the 12 bit resolution will give a 1,22 mV for this binary input....000000000001. Isn't that right?

    I am going back now to experiment... Wish me luck!

    I will keep you posted!

    Christofer
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-10-05 13:12
    Chris23 said...
    Thank you for your suggestions,

    Amaral, you are right...i rushed...I will first try to communicate with MAX1270 via Basic Stamp 2 and be certain that this is working. I am a little bit confused and lost with this A/D converter because i can't find suffficient documentation for this product, whereas I did easily, for the TLC2543 Analog/digital converter. Also, I can't find any sample code for MAX1270 at www.parallax.com. What is more, I am not particularly familiar with reading datasheets, but i think i have to...in order to completely understand the function of this A/D.

    Can we assume that you found this?

    www.maxim-ic.com/quick_view2.cfm/qv_pk/1911
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2008-10-05 19:53
    The MAX1270 has come up here a number of times. The documents for the Stamp PLC would have good information. Also take a look a the following threads:
    http://forums.parallax.com/showthread.php?p=601139
    http://forums.parallax.com/showthread.php?p=609283
    http://forums.parallax.com/showthread.php?p=570354
    http://forums.parallax.com/showthread.php?p=692205

    >> if i use a 5KΩ resistor, it will be 5mV/kelvin. Isn't this enough for MAX1270 to understand?

    The input resistance of the MAX1270 will be in parallel with the 5kΩ resistor. So if the input resistance of the MAX1270 is 21.67 kΩ, the actual resistance would be (21.67*5)/(21.67+5)= 3.97kΩ. So the final signal to the converter would be 3.97 mV per Kelvin, not 5 mV/K. Four approaches...
    -- You could use 6.5 kΩ instead of 5kΩ, , because 6.5kΩ in parallel with 21.67kΩ would be 5kΩ, so your would get close to your target of 5mV/K.
    -- One way to do the calibration would be to have a trimmer resistor at each input instead of the fixed 5kΩ, and you could adjust it in parallel with the MAX1270so as to give the correct reading. The AD592 needs only a one-point calibration.
    -- Or use a fixed resistor in parallel with the MAX1270 input as you are doing now and do the calibration in the software. This is simpler and more stable.
    -- Or use the 5kΩ resistor with the AD592 as you are doing now, and follow that with an op-amp configured as a unity gain buffer, to transfer the 5mV/Kelvin signal to the MAS1270 input. A unity gain buffer is an op-amp with its output connected directly to the inverting input. The op-amp has a low output resistance, so the 21.67kΩ input resistance of the MX1270 drops out of consideration. You can get 4 op-amps in a 14 pin package, the LM324.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 10/5/2008 7:59:39 PM GMT
  • Chris23Chris23 Posts: 16
    edited 2008-10-05 20:12
    Yes i have found this,

    I connected the capacitors and the power supply to MAX1270, as well as the pins to BS2. I need more study to understand better the timing issues from the datasheet, because it's the first time i am occupying with A/D conversion. As Tracy Allen said, Max1270 appears a low input resistance, which troubles me as regards the right communication of MAX1270 and the temperature sensor. I have seen more applications near my project at the web using, for example TLC2543. I am just worrying if i made the right decision to select the MAX1270. I think i need some more days to make MAX1270 send the right data to BS2, but then the communication with the AD592 worries me.

    Thank you Sylvie for your advice,

    Christofer
  • Chris23Chris23 Posts: 16
    edited 2008-10-05 20:23
    Tracy Alle,

    Thank you a lot ! I will take into account these usefull information. I will keep you posted for my progress !

    Best regards,

    Christofer
  • Chris23Chris23 Posts: 16
    edited 2008-10-17 14:32
    Hello everyone again,

    ·· I have been trying these days to make MAX1270 A/D Converter to read·correctly temperature from a AD592 temperature probe. I have succesfully managed to read just·one channel and dispay the reading at EXCEL using StampDAQ. I used the first attachment·code..."Read one AD592 temperature sensor using MAX1270's CH0 .bs2".

    ·· So i tested all 0-7 channels, one at a time, and it worked fine. The AD592's performance was quite stable, showing me about 25'C (room temperature). That was the first step... As i said above, my final goal is to read 8 AD592 temperature sensors, that is, to use all input channels of the max1270·and display the readings at the Excel worksheet. Here comes the problem! I first tried to·read·two·AD592 from channels 0,1·and the readings went crazy..·Instead of 25'C, i am getting 40'C. I used the second attachment·code..."Read two AD592 temperature sensors using MAX1270's CH0 and CH1.bs2". I can't work this out..What could·go wrong here? Is there a data transfer conflict, due to the continuous MAX1270·readings? If this problem is solved, i assume i will then·have no problem reading all 8 channels at once.

    I would really appreciate your remarks !

    Christofer
Sign In or Register to comment.