Go Down

Topic: Temperature Change in Wrong Direction[solved] (Read 871 times) previous topic - next topic


Jul 06, 2011, 03:12 am Last Edit: Jul 08, 2011, 07:26 pm by PerunaPete Reason: 1
Hello all,

I'm currently trying to create a thermostat using an Arduino Mega and an LM335A sensor. Whenever I breathe warm air on the sensor, the temperature goes down, not up. Currently I have the "Calibrated Sensor" setup shown in the datasheet, with a 2.2k resistor (too big I know, but 1.5 didn't work either), 10k trimpot, and a .1uF cap from output to ground. Any help is much appreciated!

Code: [Select]
//Truncated Irrelevant code ////////////

float getTemp() {
 float temp= analogRead(tempPin);
 temp= ((((temp/1023)*5)*100)-273.15)*(9/5)+32;
 return temp;


The capacitor is just for decoupling (reading fluctuates like crazy otherwise). Guess I'll try the bare zener soon, I just can't imagine why this is going on!


Well, when I say "like crazy" I mean to say that I'm not showing any steady values beyond .1 degrees. Unfortunately I don't have a scope so I can't accurately target the noise, but I'll play with some different capacitor sizes later today.


I removed the adjustment pot as suggested, and the weirdness continues.
Right now, I've got the below code to *just* give me degrees kelvin to see if it matches my multimeter.
Code: [Select]
float getTemp(){
  float in=0;
  float temp= 0;

  in= analogRead(55);
  return temp;

Even though my multimeter is showing ~2.99v (or about 78 F) right between A0 and GND, the code above is outputting 255.13..

What is going on here? At the moment, "AREF" is floating, is that the problem?


Feel like an idiot here, but the problem was that I assumed the analog pins rolled over on the mega (eg, pin A0= pin 55) instead of just accepting "A0". When I was getting close to blow on the breadboard, it was altering the noise in the circuit. Here I was trying smoothing and RC filters, and it was a stupid number... thanks for the help anyway guys!

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131