Hi! Being a noob to the hardware level of electronics, I've been working thru the tutorials and trying a few projects outside.

My current (hah!) problem is that I've got an LM34DZ temp. http://www.national.com/ds/LM/LM34.pdf sensor hooked up. I've got the VS 5+V with the Vout going straight into the analog 1 pin. The ground also goes straight into the ground connect as well.

After looking at the spec sheet, the variation is 10mV/F degree. however, reading into the analog pin, I'm getting 1020 mV, making it a scorching 102F degrees! I've let the thing have plenty of time to adjust, so i'm wondering what I am doing wrong! Thanks in advance and the tutorials rock!
Seakip18

Posts: 9
Joined: Wed Feb 06, 2008 10:21 am

Can you measure the actual voltage at the output of the sensor with a meter?

I wonder how accurate the AtoD converter in the ATmega168 is, or if it needs any sort of calibration.
"He's just this guy. You know?"
darus67

Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

darus67 wrote:Can you measure the actual voltage at the output of the sensor with a meter?

I wonder how accurate the AtoD converter in the ATmega168 is, or if it needs any sort of calibration.

The accuracy of the ADC depends very heavily on the knowledge of the actual voltage Aref.

All but the most precise power supplies usually vary by 0.2-0.3 volts from their nominal value. If the supply voltage is being used as Aref, and is a bit low (such as 4.85 volts instead of 5), a given input voltage will give a high reading.
Entropy

Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Shoulda posted this first!

So the recorded reading is a full 5V.

Is there some way am I wiring this thing wrong?

Thanks for the quick responses. I'm coming from the coding side of all of this and it's very interesting to see how the code works at such a low level with actual results.
Seakip18

Posts: 9
Joined: Wed Feb 06, 2008 10:21 am

Look on page 2, you're suppose to add a resistor so that at 75* you have 750 mV. Mathematically I forget how to do that, but I know there would be a way.
bussy77

Posts: 14
Joined: Thu Jan 17, 2008 7:49 am

Your description of how it's wired is correct according to the data sheet for
the sensor.

Double check your wiring to make sure it is actually wired the way you
think it is.

If you're using a solderless breadboard make sure your power and ground
buses are connected correctly. Those breadboards seem to trip up a lot of
people at first.
"He's just this guy. You know?"
darus67

Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

bussy77 wrote:Look on page 2, you're suppose to add a resistor so that at 75* you have 750 mV. Mathematically I forget how to do that, but I know there would be a way.

The resistor is only necessary if you want to extend the lower range of the
sensor to -50F.

Without it you will still get 10mV/Deg but you can only measure down to +5 F.
"He's just this guy. You know?"
darus67

Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

Seakip18 wrote:Shoulda posted this first!

So the recorded reading is a full 5V.

Is there some way am I wiring this thing wrong?

Thanks for the quick responses. I'm coming from the coding side of all of this and it's very interesting to see how the code works at such a low level with actual results.

Do you mean you are getting a reading of 1020 (which translates to +5v), or a reading that translates to 1020 mV?

Keep in mind that that link is not the full truth. Full scale is not 5v - Full scale is Aref, which is frequently wired to Vcc (=5v), but in reality Vcc will usually vary by +/- 100-200 mV from 5v. So full scale could in fact be 4.85v or something like that, making a 75F reading appear much higher.
Entropy

Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Thank y'all so much for the responses so far.

I've confirmed the wiring is correct. I used a spare one just to confirm the measurements.

In my code, I've got Serial.print(analogRead(tempPin));
where tempPin is the analog pint middle probe is plugged into. (TO-92 pack.)

The read out via Serial Monitor is 1020-ish, with little fluctuation.
Seakip18

Posts: 9
Joined: Wed Feb 06, 2008 10:21 am