Go Down

### Topic: Project 03: Love-o-Meter -- temperature formulas seem wrong? (Read 4007 times)previous topic - next topic

#### tbarbe

##### Sep 07, 2014, 09:25 pmLast Edit: Sep 07, 2014, 09:27 pm by tbarbe Reason: 1
Hi

Im looking at the code in the Arduino Starter Kit Projects Book...

in Project 03: Love-o-Meter

I was able to get very good accurate voltage output on the center post of the TMP36 -- reading in my analog in converts to Volts reading very close to what my Brymen 869s is saying for center pin to ground.

So I feel like I got the voltage reading right... but what bothers me - is I have two temperature sensors that disagree with the TMP36... by about 2-4 degrees off.. they read hotter... and Im pretty sure it IS hotter because of my discomfort level and because of their agreement with the weather temperature reading as well.... so 3 temperature readings not agreeing with one TMP36 using Arduino....

Im trying to discover the potential source of inaccuracy... because the sensors spec sheet says it should be quite accurate around this rage... +-1-2  which is not anywhere near the 2-4 degrees off Im seeing.. sometimes 5.

does anyone have any thoughts or ideas why the Arduino starter kit project would show this much offset?

I tried getting actual Vcc voltage reading for the ADC - and using that... using internal 1.1 reference and all... this made it slightly better but still 3-4 off... still not what I was hoping for... 1-2 off I probably could accept.. but I feel like the math is off somewhere in someones formulas...

Anyone?

#### tbarbe

#1
##### Sep 07, 2014, 10:32 pm

seems like when I use my own technique - I get a better reading of the temperature that matches my other temperature sensors in the house....

I just threw away everyone else's formulas ( which seem wrong ) - and instead I look at the chart provided by ADC.

The MIDDLE line... shows a range from:

.1V to 1.7V = 1.6V total run range for the TMP36

with .1V = -40C
and 1.7  = 125C

-40 to 125C = 126 + 40 = 166C range.... including 0 as one - right?

now IF taking the voltage reading on the sensor - gives me:
.70 volts... then I know this is .70 / 1.6 = 0.4375  or 43.75% of the run up to max....

if I then extrapolate 166 point scale and 43.75% of that scale = 72.625
to get the actual temperature - I would need to remove the negative part of the scale so

72.625 - 40 = 32.625C

which gives me a MUCH closer reading to reality compared to the other sensors I have here...

thats within a 2 point difference....so it seems this math is close....

if I use the Arduino Book math - it comes out much lower for the TMP36....and doesn't match to what I see....

Anyone have issues with accuracy of this one project?

#### TheNoob

#2
##### Sep 08, 2014, 10:27 amLast Edit: Sep 08, 2014, 10:35 am by TheNoob Reason: 1

Hi

Im looking at the code in the Arduino Starter Kit Projects Book...

in Project 03: Love-o-Meter

I was able to get very good accurate voltage output on the center post of the TMP36 -- reading in my analog in converts to Volts reading very close to what my Brymen 869s is saying for center pin to ground.

So I feel like I got the voltage reading right... but what bothers me - is I have two temperature sensors that disagree with the TMP36... by about 2-4 degrees off.. they read hotter... and Im pretty sure it IS hotter because of my discomfort level and because of their agreement with the weather temperature reading as well.... so 3 temperature readings not agreeing with one TMP36 using Arduino....

Im trying to discover the potential source of inaccuracy... because the sensors spec sheet says it should be quite accurate around this rage... +-1-2  which is not anywhere near the 2-4 degrees off Im seeing.. sometimes 5.

does anyone have any thoughts or ideas why the Arduino starter kit project would show this much offset?

I tried getting actual Vcc voltage reading for the ADC - and using that... using internal 1.1 reference and all... this made it slightly better but still 3-4 off... still not what I was hoping for... 1-2 off I probably could accept.. but I feel like the math is off somewhere in someones formulas...

Anyone?

yeah, the temperatures certainly looked a bit odd to me as well. At first I've read something about a self-heating effect of the temperature sensor - not sure if that is the case or not or how to mitigate it.

#### tbarbe

#3
##### Sep 08, 2014, 11:28 am
Hey

yea - i ended up using hacker-math instead and then it worked just fine...

take the range of the sensor = .1V to 1.7V - according to the one chart that exists for it...

AdaFruit people  marked it in RED on this chart

then I simply took the 'actual' voltage from the center pin - and matched it to the 'range' thru a percentage of change...

making 1.7V the 100%( 125C)  and 0.1V the 0 point (-40C)
and -40 to 125 = 166 point scale
giving me this:

(( centerPinVoltage/1.7V ) * 166 ) - 40 = finalTemp

this method gave me a more closely related reading to my other sensors around....

once again this is my 'hacker math' - not some official way...and I may have done something completely wrong or taken the wrong ideas and hobbled them together..... but - the reading was much closer to agreeing to my other sensors...and I used some kind of logic to get there... so I'm really not sure...

I think the only people who can answer this properly are more expert than me...  I bet the ADC Sensor manufacturer would have the best answer for how they 'expect' others to calculate the temperature....

I saw mention of a few things like this that are of note:

1. we should probably use something like a Vcc to get the actual reference voltage going into the Arduino so our calculations are more accurate based on the actual voltage going in.
2. There was one mention of the 500mV offset.... I have no idea what this is - I assume it may be the final range from -40 to -50 on the lower end of the scale just dropping off... so they drop that value off? not sure...

So hopefully someone smarter than me shows up to help us here! Id like to be able to explain it ALL to my son rather than just leave him with an unexplained difference.... thats not good engineering!

someone? anyone?

cheers

#### tbarbe

#4
##### Sep 14, 2014, 11:47 pm

seems like this is the issue here:

http://www.skillbank.co.uk/arduino/measure.htm

for one - the project in the book uses the 5V reference...

this means ( correct me if Im wrong here! )

that we are using the TMP36's ready range of .1 to 1.7V and dropping that into a full 5V range... meaning our ADCs are barely using half their range for 1024 steps!!  this would make the temperature reading very inaccurate... no?

it would be better to make the reference voltage something like 2V ?? then you are better mapping the potential values to the available bit depth of the 10bit converters?

now I want to make a more accurate voltage reference... and this guys article shows how  - I will be trying this next...

Go Up