In my tests the first formula is correct regardless of whether 5V or 3.3V is used for the source voltage.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)
Tmp36 Tutorial Analog In Voltage
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 3
- Joined: Fri Dec 16, 2011 11:48 pm
Tmp36 Tutorial Analog In Voltage
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.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Tmp36 Tutorial Analog In Voltage
How are you testing the 3.3v model? Do you use an Arduino powered with 3.3v? (not just 3.3v for the sensor)
-
- Posts: 3
- Joined: Fri Dec 16, 2011 11:48 pm
Re: Tmp36 Tutorial Analog In Voltage
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.
- baldengineer
- Posts: 127
- Joined: Sun Sep 26, 2010 11:49 pm
Re: Tmp36 Tutorial Analog In Voltage
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).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.
- scott_42
- Posts: 130
- Joined: Mon May 30, 2011 10:46 am
Re: Tmp36 Tutorial Analog In Voltage
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
Use analogReference(INTERNAL) or INTERNAL1V1 if using a Mega.
http://arduino.cc/en/Reference/AnalogReference
Please be positive and constructive with your questions and comments.