Shop OBEX P1 Docs P2 Docs Learn Events
AD592 Temp reading — Parallax Forums

AD592 Temp reading

smkbaynsmkbayn Posts: 25
edited 2007-10-27 22:42 in BASIC Stamp
Hello,
Can anybody help me, I am trying to get a reading with the AD592 temp probe but I am having problems, it is jumping around by about 4 degrees f.· I was able to calibrate it but can not keep it stable in·a running program.· Please help.
«1

Comments

  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-01 01:05
    Are you using an analog to digital converter, or the RCTIME method? You have to be careful with the wiring to Vss, that the wires are not too long and they do not share currents with other loads like motors or LEDs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-01 20:45
    i am using the rctime method.· the line length is up there but there are no motors or leds.· i can easily test if the line length is the problem, but what if its not.· i am basically doing the temp sensor probe with the ds1620 exp.·in the applied sensors book and trying to create a circuit with an lcd display to control water temp in a hot tub.
  • pwillardpwillard Posts: 321
    edited 2007-10-01 21:04
    RC time is rather crude when compared to an A/D Converter IC and it·is likely very dependent on the quality of your components.· I realize that it's probably not in your plans to do so, but you might want to compare the readings of RC TIME against a dedicated hardware A/D.· The AD592 is known for being very accurate and tolerant of harsher than normal conditions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    There's nothing like a new idea and a warm soldering iron.
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-02 16:46
    Try it also with the AD592 in close, not on the cable. Do you have the circuit mounted on a BOE as in Applied Sensors? Experiment with where you have the RCTIME capacitor and the (-) side of the AD592 connected. For best results with RCTIME, you want to have those connected as close as possible to the Vss terminal of the Stamp. It is possible to do better than 4 degrees, but not much better than 2 degrees over the long term with RCTIME.

    It is a current source device, so the cable length does not matter at DC, but if there is RF or even strong low frequency disturbance, it can pick up noise. In those cases, a twisted and shielded cable is recommended even for the AD592. There are some good application notes on this from Analog Devices.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-07 21:13
    i removed the extra cable and put the sensor directly to an interface board i have created to go between the basic 2 oem and a relay, the ad592, and the ds1620.· the ds1620 is very stable its still just the ad592 that jumps around about 4 degrees.· im not sure if i was clear or not but this is jumping around 4 degrees from one second to the next.
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-08 02:43
    Look at the BS2OEM, and see that the Vss connection pin is on the opposite end of the circuit board from the Vss pin (pin 4) on the PIC chip. Where is the RCTIME capacitor on the interface board? The best results from RCTIME are to be had when the grounded side of the RCTIME capacitor is tied as close as possible to the Vss pin on the Stamp chip.

    One thing that sometimes works is this. Suppose your AD595 is connected to pin p5. If pin p6 is not being used, move the ground side of the RCTIME capacitor to p6, and in the program, make P6 a LOW 6 output. That effectively grounds that side of the capacitor through a path that does not carry any of the power supply currents of the Stamp and reduces the fluctuations.

    One big problem with the AD592 in the RCTIME circuit is that it puts out only one microamp per degree Kelvin and its current at room temperature is already 300 microamps. The 4 degree fluctuation you are seeing is only 1% of that. Measurements with RCTIME cannot be expected at much better than 1/4% (9 bit resolution) over time, one or two degrees at best. The temperatures below 273 amount to wasted range. You can get more stability by using an ADC, in particular one that has an offset to subtract out 273 Kelvin. There are circuits that can subtract out an offset current of 273 microamps, but those are more trouble than an ADC.

    Another option with your existing circuit is to use an LM35 as the sensor instead of the AD592. The output of the LM35 is normally a voltage of 10mV per degC, but by connecting a 1 kohm resistor from Vout to V-, you can turn it current output probe like the AD592, but with an output of 10 microamps per degC:

    Iout  = degC * 10 + 70   microamps
    



    So the output at 25 degC is about 320 microamps, but each degC change is 10 microamps instead of 1 microamp. The result would be much more stable than the AD592 because it is referenced to zero Celsius instead of absolute zero. You can make it into a two-wire probe like the AD592, by including the resistor in the wrap. See the LM35 or LM34 data sheets for details.

    The DS1620 is so stable because it is direct to digital, and its reference points are all contained inside the DS1620 chip.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-08 13:20
    thanks Tracy you are a lot of help.· i will try·the ground on·p6 and see if that helps.· another thing is that if i understand you correctly (and maybe if i read the spec sheets)·is that·the higher the temp the·less stable it will be?????· And i am going to be reading a hot tub temp so that isnt going to work so well.· i did notice that when i put the probe in ice water it stabilized.· i would like to stick with what i have so i will check out the lm35 next.· once again thanks for all the help.

    steve

    village idiot

    ·
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-08 18:43
    I don't see why is should be much more stable in the ice bath than at room temperature, unless there is a real temperature fluctuation or some kind of shielding effect. 300 Kelvin of room temperature or 310 Kelvin body temperature of a hot tub is not that different from 273 Kelvin of an ice bath. Therein lies the rub. The whole range you are looking at is such small proportion of the Kelvin scale and the RCTIME method has only a limited capability to resolve differences. A temperature change from 309 to 313 Kelvin where you might want accurate control of a hot tub is only about 1% of full scale.

    With the LM35 or LM34 you would be operating over a much larger proportion of the range, say 36 to 40 degC, 10% of full scale, much easier for RCTIME to resolve.

    Here is a design diagram for using the LM35 or LM34 in two wire current mode. The quiescent current has to be factored in, because it contributes to the current. But it too is linear and well controlled in the manufacture of those chips. A calibration at a couple of temperatures can give you great accuracy.

    attachment.php?attachmentid=49801

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
    265 x 214 - 6K
  • PADTPADT Posts: 8
    edited 2007-10-09 23:26
    I also am working on callibrating the AD592 as outlined in the Applied Sensors doc. What ADC would you recommend instead of RCTIME and how would my circuit layout change?

    Thanks!

    cool.gif
    Tracy Allen said...
    Look at the BS2OEM, and see that the Vss connection pin is on the opposite end of the circuit board from the Vss pin (pin 4) on the PIC chip. Where is the RCTIME capacitor on the interface board? The best results from RCTIME are to be had when the grounded side of the RCTIME capacitor is tied as close as possible to the Vss pin on the Stamp chip.

    One thing that sometimes works is this. Suppose your AD595 is connected to pin p5. If pin p6 is not being used, move the ground side of the RCTIME capacitor to p6, and in the program, make P6 a LOW 6 output. That effectively grounds that side of the capacitor through a path that does not carry any of the power supply currents of the Stamp and reduces the fluctuations.

    One big problem with the AD592 in the RCTIME circuit is that it puts out only one microamp per degree Kelvin and its current at room temperature is already 300 microamps. The 4 degree fluctuation you are seeing is only 1% of that. Measurements with RCTIME cannot be expected at much better than 1/4% (9 bit resolution) over time, one or two degrees at best. The temperatures below 273 amount to wasted range. You can get more stability by using an ADC, in particular one that has an offset to subtract out 273 Kelvin. There are circuits that can subtract out an offset current of 273 microamps, but those are more trouble than an ADC.

    Another option with your existing circuit is to use an LM35 as the sensor instead of the AD592. The output of the LM35 is normally a voltage of 10mV per degC, but by connecting a 1 kohm resistor from Vout to V-, you can turn it current output probe like the AD592, but with an output of 10 microamps per degC:

    Iout  = degC * 10 + 70   microamps
    



    So the output at 25 degC is about 320 microamps, but each degC change is 10 microamps instead of 1 microamp. The result would be much more stable than the AD592 because it is referenced to zero Celsius instead of absolute zero. You can make it into a two-wire probe like the AD592, by including the resistor in the wrap. See the LM35 or LM34 data sheets for details.

    The DS1620 is so stable because it is direct to digital, and its reference points are all contained inside the DS1620 chip.

  • smkbaynsmkbayn Posts: 25
    edited 2007-10-10 23:48
    ok,·putting the common side of the cap on p6 didnt help.· how much is this lm35 and how do i get it?· will this be a stable reading within atleast a 2 degree range???????
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-11 05:26
    The V+ side of your AD592 is supplied from +9 volts, right, not +5 volts?

    I hesitate to assure with !!!!!! level of confidence that the LM35 would be more stable, because there might be some other issue with the power supply or another noise source or wiring issue that is causing the instability. But all things being equal, the LM35 puts out a larger signal (per degree) and is therefore less affected by noise. The LM35 and its Fahrenheit cousin are available from many sources. Send me a PM and I might have one I could mail to you.

    PADT, as to ADCs, the LT1298 is a 12 bit converter that is available from Parllax. The V+ side of the AD592 connects to +9 volts, the V- side to an ADC input pin and to the top of a 10kohm resistor, and the bottom of the resistor to ground. The ADC measures the voltage across the resistor, which will vary at 10 millivolts per degC. 2.73 volts at 0 degC (273 Kelvin). The resolution is around 0.1 degC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-11 16:39
    +9 volts....i am using the +5 volts from VDD.· Is it supposed to be +9?· I have a +9 volt supply going into my oem board that i could use if that is the case.
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-11 20:58
    and uhhh, what is a PM?
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-12 16:09
    Yes, 9 volts for best performance. The AD590 is specified for operation on power supplies down to 4 volts across it, but it works better with at least 5 volts. In the RCTIME circuit, the voltage across the AD590 changes as the capacitor charges and discharges, and with the Stamp threshold of 1.4 volts, and with the AD590 powered from 5 volts, the minimum is 5-1.4=3.6 volts. Despite the specification, that will often work pretty well, but for best results try connection to the 9 volt Vdd. Then the minimum will be 9-1.4=7.6 volts, well within spec.

    PM is private message, an option at the top of the forum screen.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • PADTPADT Posts: 8
    edited 2007-10-13 09:36
    Thanks for your reply!· Yes, what I am wondering is how to increase the response time of my AD592 probe. I have it running through RCTIME and am hoping that the ADC will help the response time, or is that more a function of the AD592 sensor. It seems to heat up quicker than cool down and lags behind my thermocouple reference.
    Thanks in advance,
    PADT
    Tracy Allen said...
    The V+ side of your AD592 is supplied from +9 volts, right, not +5 volts?

    I hesitate to assure with !!!!!! level of confidence that the LM35 would be more stable, because there might be some other issue with the power supply or another noise source or wiring issue that is causing the instability. But all things being equal, the LM35 puts out a larger signal (per degree) and is therefore less affected by noise. The LM35 and its Fahrenheit cousin are available from many sources. Send me a PM and I might have one I could mail to you.

    PADT, as to ADCs, the LT1298 is a 12 bit converter that is available from Parllax. The V+ side of the AD592 connects to +9 volts, the V- side to an ADC input pin and to the top of a 10kohm resistor, and the bottom of the resistor to ground. The ADC measures the voltage across the resistor, which will vary at 10 millivolts per degC. 2.73 volts at 0 degC (273 Kelvin). The resolution is around 0.1 degC.

  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-14 00:55
    The AD592 has considerably more thermal mass than a thermocouple. There is no getting around that. The RCTIME method does take time, but we are talking a few milliseconds for that, much less than the thermal time constant. A thermocouple made from #30 gage or finer wire can respond on the order of 10s of milliseconds. A tiny thermistor bead can be pretty quick too, as can certain forms of RTD. IC sensors are bigger, although you can get some of them in tiny SC70 packages these days.

    Remember that a most integrated sensors are fastest in responding to heat conducted along the metal leads. That is, if you are fastening an AD592 to a surface, you should also bring the package leads in thermal contact with the surface. That would give much faster response and would come closer to the correct reading than just relying on the packaging.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • PADTPADT Posts: 8
    edited 2007-10-14 07:08
    If I were to attach a thermocouple to my BOE, would the BS2 be able to read it?
    The thermocouple kit sold on Parallax seems to require a BS2p instead/.
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-15 20:18
    I'm still puzzled by the 4 degree fluctuation, and wondering if part of the problem might be in the calculation.

    I hadn't revisited the RCTIME method for a while, so I set up a BOE with an AD592 from the applied sensors kit and the 0.22uF capacitor. The readings I got were quite stable on the level of +/- 1 degree Celsius and and even +/-1 degree Fahrenheit. However, when the initial reading is taken in Celsius and then converted to Fahrenheit, a one degree bobble turns into a two degree bobble. If you are going to use Fahrenheit, it is best to make the conversion directly from the raw RCTIME count. Could that be part of the problem?

    I took no particular care with the layout, and tried both 5 volts or 9 volts for power, and even wrapped the AD592 wire around the power cord for a lamp to increase 60 hz pickup. Still pretty steady with only one degree bobble.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-15 23:12
    ok, i tried it on my sumo bot with just the ad592 and the cap and resistor circuit and had the same stable results as you.· now im puzzled too.· using the same code on what i have set up to use on the hot tub it still comes out with a 4 degree fluxuation.· now with the sumo bot i have the cap right on vss and much less wire length.· could that be it...or perhaps noise from the ds1620 or the lcd i am using?· i dont really want to start unsoldering components from my project and i dont have spare lcd's lying around so i have no way to test this on the sumo bot, any ideas.
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-16 04:45
    These cases of fluctuation can be hard to track down, but worthwhile if you can have the satisfaction of figuring out where it comes from and how to get rid of it. The LCD might be drawing some current, or current that varies. I'd be surprised if the current varies much, but in troubleshooting one has to keep an open mind. The line to Vss is always the first one to check. Is it possible that there is a bad connection through a plug or through a solder joint? A bad connection can accentuate the offsets and noise.

    If you have a multimeter, connect its common lead to the Stamp Vss line as close to the Stamp chip as possible. Then touch the positive multimeter lead to the Vss connection of the capacitor. It should be no more than a couple of millivolts different from the Stamp Vss. Every 5 millivolts of difference is about 2 degrees Fahrenheit error in the temperature signal. Also turn the multimeter to AC. Same thing. Should not be any AC voltage there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-21 15:14
    ok tracy, on your advice for my own personal satisfaction, i decided to figure out what was causing the problems with the ad592.· i moved my cap and pull down resistor right on the oem board while simultaneously removing the quick connect to the led board and pulling out the ds1620 out of the socket.· viola....stable reading.· i plugged everything back in and fluctuation.· pull out lcd and fluxuatin gone.· something on the lcd display is causing it.··what can i do to prevent this?· otherwise, can you send me some sample code on how i can read the lm34, im confused on how to read that, is this an rc time also?· thanks again for all your help.·

    Post Edited (smkbayn) : 10/24/2007 11:42:39 AM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-22 15:57
    Does the fluctuation on the LCD have to do with anything displayed on the screen? The first thing I would look at is the power supply. The LCD might be causing spikes on the power supply as it scans. You can try a capacitor 100uF or more, added to the LCD power supply, even right on the LCB circuit board. And/or add one to the OEM board close to the Stamp chip, right across its power supply pins. Feel free to tinker with filter capacitors, the objective being to quiet whatever noise is affecting the RCTIME value. These kinds of problems are sometimes due to layout. You might find that attaching the ground or power supply lead for the LCD to a different point in the circuit will make a big difference, and usually that point will be as close as possible to the voltage regulator. The problem might go away if you have a separate regulator for the LCD.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-22 17:28
    the fluxuation happens whenever the lcd gets power to it, i am not sending anything serially to it at all.· i will try the cap on the power supply and see what happens.· hopefully that works, this is starting to frustrate me, it was supposed to be an easy project.· thanks again
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-23 01:30
    ok, putting the 100uf cap on the oem ps helps reduce the fluxuations quite considerably.· i have gone from 4 degree flux to 2 degree flux.· so instead of·70 to 74 i go from·70 to 72.· also the frequency of the flux has diminished.· i am really leaning toward the lm35 because it seems that i might just need that 10mv/degree.· or should i try another value cap?

    Post Edited (smkbayn) : 10/24/2007 11:41:52 AM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-24 17:35
    smkbayn,

    You had also asked about the LM34 circuit. The little assembly I mailed to you will be used in exactly the same circuit as the AD592, but it will have a larger output per degree. Connect the (+) side to +9 volts Vin, and connect the (-) side to your input pin and the top of the 0.22 uF capacitor. The other side of the capacitor goes to ground (Vss). The calculations will be similar to what you have used for the AD592, but you will probably have to do a two point calibration in order to get the best accuracy. Nonetheless, the first thing to do is to put it into circuit in place of the AD592, and see that the count value returned by RCTIME decreases as the temperature increases. At some point you will want to encapsulate the circuit in a thermowell to make it waterproof.

    The assembly consists of an LM34 and a 2kohm resistor, which is connected between the output and Vss. That turns the LM34 into a current source. Normally one would use the LM34 in its voltage output mode, but you can also read about the current output mode in the LM34 data sheet or application notes. The output current is,

    microamps = degF * 0.01E6 / 2000 + (degF-77) * 0.3 + 75E   ' the last two terms are due to quiescent current
              = 5.3 * degF +  52
    



    attachment.php?attachmentid=50071

    About 450 microamps at room temperature. I think the one I sent you had a lower quiescent current, around 60 microamps. If you have a multimeter handy that can measure microamps, you can put the sensor in series with the meter and a 9 volt battery and measure that DC current and test it against temperature. The factor 5.3 and 52 will need to be adjusted because of component tolerances. In the BS2 RCTIME circuit, that same current will charge the capacitor.

    You are getting closer with the AD592. I wonder where the noise is coming from.



    smkbayn said...
    ok, putting the 100uf cap on the oem ps helps reduce the fluxuations quite considerably. i have gone from 4 degree flux to 2 degree flux. so instead of 70 to 74 i go from 70 to 72. also the frequency of the flux has diminished. i am really leaning toward the lm35 because it seems that i might just need that 10mv/degree. or should i try another value cap?
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
    265 x 214 - 6K
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-24 22:14
    this sensor is much more stable.· it only moves between 2 degrees.· so 70 and 71 for instance, i can live with that.· im not 100% sure about the math of it all.· i dont know how to do decimals with bs2.··i really dont know what the E's are in your equation (i think it is a certain number of zeros but am not sure).· rctime goes down as the temp goes up but my math makes the temperature decrease so obviously i am doing something wrong.· i am totally lost on how to do the calibration.· i have an ir heat i am using and also the ds1620 to do it if that can be easier.· i am not good at math so can you just give me the equation from F = ???? that would make my life easier.

    Post Edited (smkbayn) : 10/25/2007 1:16:44 PM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-26 00:23
    Take the result from RCTIME 4,0,result and do this:
    result2 = 65535 / result
    



    You will find that this new result2 value increases as temperature increases. In fact it will be linear, {temperature = A * result2 + B}. Please, if you will, find the result2 at two different temperatures, wide apart if possible. Then I can help you find the parameters A and B and work them into Stamp code that will calculate the temperature over the whole range.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-26 11:12
    i will do that.· you are awesome tracy.· i really appreciate all of your help.· i will get those results and let you know.· hopefully i will have a digital control installed on my hot tub this weekend.· do you think i should do 2 layers of the heat shrink?
  • smkbaynsmkbayn Posts: 25
    edited 2007-10-27 19:02
    ok at·145 degrees f i read 376

    at·32 degrees f i read 97



    this is according to the ir heat sensor gun i have.


    Post Edited (smkbayn) : 10/27/2007 7:33:20 PM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-10-27 22:39
    Okay! These are the 1/result values, right? Assuming that the readings are right on target, you have two equations in two unknowns:

    A * 376 + B = 145
    A * 97 + B = 32

    Subtract the second equation from the first and rearrange to get,
    A = (145-32)/(376-97) = 0.405
    Then plug that value for A into the first equation and solve for B:
    B = 145 - (0.405 * 376) = -7.25

    So the algebraic equation is,
    degreesF = 0.405 * result2 - 7.25

    In the Stampese, 0.405 * result2 is done using 26542 ** result2. That number comes from 0.405 * 65536 = 26542.

    RCTIME 4,0,result
    result = 65535 / result ' inverse
    degF = 26542 ** result - 7

    When you get your hot tub going, you will want to repeat the calculation using a good thermometer in the hot tub. That will probably be more accurate than the heat gun.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.