PDA

View Full Version : Why isn't this working?



MarkS
01-30-2008, 05:13 AM
I'm using a LRC1298 ADC configured in single-ended mode, reading a LM34 temperature sensor from channel 0. I'm using the LTC1298 object to deal with the ADC. The problem is that its working, but not as I'd expect. I can read low end temperatures just fine. Placing the probe in a glass of ice water reads 32F. However, if I place it in my mouth, it will not go above 78F, a 20 difference.

I'm working on the schematic, but there really is not much to it. The output of the sensor is decoupled with a 10uf cap and connected to ADC pin 2 (channel 0) and the ADC is connected to pins 15, 16, and 17 on the Prop. The output of the ADC is connected to the Prop through a voltage divider (R1 = 510, R2 = 1K).

Rayman
01-30-2008, 08:39 AM
You're using +5V on both chips?

MarkS
01-30-2008, 08:42 AM
Rayman said...
You're using +5V on both chips?


No, 3.3 on the Prop and 5 on the ADC/LM34.

MarkS
01-30-2008, 08:43 AM
I'm thinking it has something to do with the conversion formula that I'm using, but I can't figure out what.

Rayman
01-30-2008, 08:44 AM
Did you measure the output of the LM34 with a multimeter? I think it's supposed to be 10 mV/F... So, should be .78 V at 78F, right?

(by "both chips", I meant the LM34 and the ADC...)

Rayman
01-30-2008, 08:48 AM
This might be trouble here:

temp := 5000 / 4096 * val / 10

Since it's 32-bitinteger math, I'd do something like

temp:= (val*5000*10)/4096

to be sure to minimize rounding errors

MarkS
01-30-2008, 08:48 AM
Rayman said...
Did you measure the output of the LM34 with a multimeter? I think it's supposed to be 10 mV/F... So, should be .78 V at 78F, right?


Yes, it works fine when attached to my meter, although my meter only has a resolution of .1mV. Still, it shows.9 when I try and take my temperature, which is correct.


Rayman said...

(by "both chips", I meant the LM34 and the ADC...)


I can't get past the fact that the LM34 looks like a transistor. http://forums.parallax.com/images/smilies/redface.gif

MarkS
01-30-2008, 08:53 AM
Rayman said...

temp:= (val*5000*10)/4096



Close, it looks like temp:= (val*5000/10)/4096 did the trick. *10 caused it to scale wildly. I figured it was in that line. Thanks! http://forums.parallax.com/images/smilies/yeah.gif