Analog Input Reading

For makers who have purchased an Adafruit Starter Pack, get help with the tutorials here!

Moderators: adafruit_support_bill, adafruit

Analog Input Reading

Postby Seakip18 » Wed Feb 06, 2008 9:32 am

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 9:21 am

Postby darus67 » Wed Feb 06, 2008 10:22 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?"
User avatar
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 9:25 pm
Location: Minnesota, USA

Postby Entropy » Wed Feb 06, 2008 9:50 pm

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: Mon Jan 07, 2008 11:43 pm
Location: Owego, NY USA

Postby Seakip18 » Fri Feb 08, 2008 4:10 am

Shoulda posted this first!

http://www.arduino.cc/en/Reference/AnalogRead

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 9:21 am

Postby bussy77 » Fri Feb 08, 2008 10:06 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 6:49 am

Postby darus67 » Fri Feb 08, 2008 10:21 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?"
User avatar
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 9:25 pm
Location: Minnesota, USA

Postby darus67 » Fri Feb 08, 2008 10:26 am

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?"
User avatar
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 9:25 pm
Location: Minnesota, USA

Postby Entropy » Fri Feb 08, 2008 11:31 am

Seakip18 wrote:Shoulda posted this first!

http://www.arduino.cc/en/Reference/AnalogRead

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: Mon Jan 07, 2008 11:43 pm
Location: Owego, NY USA

Postby Seakip18 » Mon Feb 11, 2008 1:18 pm

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 9:21 am


Return to Arduino Starter Pack

Who is online

Users browsing this forum: No registered users and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
Android[6]
 
BeagleBone[23]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]