Reading a temperature value from a TMP36 sensor
Re: Reading a temperature value from a TMP36 sensor
Using the ADCs on the pyboard there will always be a 3.3/4096 factor because the ADCs use 3.3V as the reference voltage.
- JonHylands
- Posts: 69
- Joined: Sun Dec 29, 2013 1:33 am
Re: Reading a temperature value from a TMP36 sensor
More specifically, the voltage that the sensor outputs is not relative to the input, so Vin is irrelevant.
Re: Reading a temperature value from a TMP36 sensor
Great, that is helpful to know, but can I still obviously don't quite have a handle on it because I still have this stupid question: why on the arduino do I have to calculate with 5 volts. Is it just a matter of the the adc converting the stir ee voltage range based on a different reference voltage? Maybe I need to get busy with a multimeter to understand what's really going on?
Re: Reading a temperature value from a TMP36 sensor
The 5v on the Arduino is because you're using a 5v Arduino device.UltraBob wrote:Great, that is helpful to know, but can I still obviously don't quite have a handle on it because I still have this stupid question: why on the arduino do I have to calculate with 5 volts. Is it just a matter of the the adc converting the stir ee voltage range based on a different reference voltage? Maybe I need to get busy with a multimeter to understand what's really going on?
With a 5v Arduino device you get a value of 0 when 0 volts are present, and you get a value of 1023 when 5v is present.
With a 3.3v Arduino device you get a value of 0 when 0 volts are present, and you get a value of 1023 when 3.3v is present.
With the pyboard you get a value of 0 when 0 volts is present, and you get a value of 4095 when 3.3v is present.
Any voltage between 0 and max should be a linear interpolation between those end points.
A voltage of 0.5v will be read as 102 on a 5v Arduino.
A voltage of 0.5v will be read as 155 on a 3.3v Arduino.
A voltage of 0.5v will be read as 620 on a 3.3v pyboard.
Re: Reading a temperature value from a TMP36 sensor
OK, I just tried to sit down with the datasheet and figure out how all this stuff reconciles, and it seems like what I suspected is true, must be true. Please correct me if this is incorrect:
25 degrees Celsius on this particular sensor is equal to 750mV and it has a scale factor of 10mV / degree Celsius.
The operating range is between -40 and 125 degC
there is a 100 degree difference between 25 and 125 so 100 * 10 = a maximum voltage output of 1.75V
the low voltage 750 - (65 * 10) = 100mV
Is it then true, that most sensors like this that report analog values via voltage range, will have a range of 100-1750mV? If not, how does the board know what the range is?
thanks!
25 degrees Celsius on this particular sensor is equal to 750mV and it has a scale factor of 10mV / degree Celsius.
The operating range is between -40 and 125 degC
there is a 100 degree difference between 25 and 125 so 100 * 10 = a maximum voltage output of 1.75V
the low voltage 750 - (65 * 10) = 100mV
Is it then true, that most sensors like this that report analog values via voltage range, will have a range of 100-1750mV? If not, how does the board know what the range is?
thanks!
Re: Reading a temperature value from a TMP36 sensor
Every sensor is different. The board doesn't know the range.UltraBob wrote:OK, I just tried to sit down with the datasheet and figure out how all this stuff reconciles, and it seems like what I suspected is true, must be true. Please correct me if this is incorrect:
25 degrees Celsius on this particular sensor is equal to 750mV and it has a scale factor of 10mV / degree Celsius.
The operating range is between -40 and 125 degC
there is a 100 degree difference between 25 and 125 so 100 * 10 = a maximum voltage output of 1.75V
the low voltage 750 - (65 * 10) = 100mV
Is it then true, that most sensors like this that report analog values via voltage range, will have a range of 100-1750mV? If not, how does the board know what the range is?
thanks!
It's up to the person wiring things up to ensure that the voltage range from the sensor fits in a suitable range for the device.
In your example, you have a range of 100mV to 1750mV, which would correspond to values of 124 thru 2171, or 2047 values over 165 degreess. This looks pretty decent (about 0.08 degree resolution).
If you want higher resolution, then you need to offset/scale the voltage so that it covers more of the 3.3v range. Something like an op-amp would be useful for this.
Re: Reading a temperature value from a TMP36 sensor
OK, I think I get it now. Thanks for humoring me on the long path there.