Tmp36 Tutorial Analog In Voltage

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
ErikT
 
Posts: 3
Joined: Fri Dec 16, 2011 11:48 pm

Tmp36 Tutorial Analog In Voltage

Post by ErikT »

I tried the Tmp36 tutorial as my first arduino project. The instructions indicate that a different formula is used to read the input voltage based upon whether the source voltage is 3.3V or 5V. I don't think this is correct.
If you're using a 5V Arduino, and connecting the sensor directly into an Analog pin, you can use these formulas to turn the 10-bit analog reading into a temperature:

Voltage at pin in milliVolts = (reading from ADC) * (5000/1024)
This formula converts the number 0-1023 from the ADC into 0-5000mV (= 5V)

If you're using a 3.3V Arduino, you'll want to use this:

Voltage at pin in milliVolts = (reading from ADC) * (3300/1024)
This formula converts the number 0-1023 from the ADC into 0-3300mV (= 3.3V)
In my tests the first formula is correct regardless of whether 5V or 3.3V is used for the source voltage.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Tmp36 Tutorial Analog In Voltage

Post by Franklin97355 »

How are you testing the 3.3v model? Do you use an Arduino powered with 3.3v? (not just 3.3v for the sensor)

ErikT
 
Posts: 3
Joined: Fri Dec 16, 2011 11:48 pm

Re: Tmp36 Tutorial Analog In Voltage

Post by ErikT »

Maybe I'm confused. I have Arduino Uno that gets the power from USB (5V). I have a choice of 3.3V or 5V to feed the sensor and I chose 3.3V.

User avatar
baldengineer
 
Posts: 127
Joined: Sun Sep 26, 2010 11:49 pm

Re: Tmp36 Tutorial Analog In Voltage

Post by baldengineer »

ErikT wrote:Maybe I'm confused. I have Arduino Uno that gets the power from USB (5V). I have a choice of 3.3V or 5V to feed the sensor and I chose 3.3V.
True. But then the reference that the A/D uses is still 5V. If you want to give the sensor 3V3, then you should apply 3V3 to AREF on the Arduino and use analogReference(EXTERNAL).

User avatar
scott_42
 
Posts: 130
Joined: Mon May 30, 2011 10:46 am

Re: Tmp36 Tutorial Analog In Voltage

Post by scott_42 »

Also depending on the temperature range you are planning on measuring, you might be able to get more precision by using the built-in 1v1 voltage reference. When I was comparing several temperature sensors for normal room temp ranges, I used the 1v1 source and found it to be much more accurate (read that as a better ADC dynamic range for the temps I cared about).

Use analogReference(INTERNAL) or INTERNAL1V1 if using a Mega.

http://arduino.cc/en/Reference/AnalogReference

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”