Newbie here. In the book that comes with the official arduino starter kit it states that [u]in order to get the correct temperature from the sensor first we have to subtract .5 from the voltage[/u] then multiply by 100: (V-.5)*100. It also states the reason for subtracting the .5 is to offset since the sensor reads values below 0C. This makes no sense to me. [u]Why .5?[/u] I understand the multiplication by 100 part. Any help would be appreciated. Thanks. :)
Why 0.5 because that is the way the chip is designed, that is all.
So I just have to memorize that for the TMP36 I must subtract 0.5 from the voltage to get the correct temperature? It doesn't make sense mathematically for me. So no mathematical explanation as to why 0.5?
You don't have to memorize it, you can look up "TMP36 output voltage" in the datasheet at http://www.analog.com/static/imported-files/data_sheets/TMP35_36_37.pdf.
So no mathematical explanation as to why 0.5?
I am not sure what you are expecting.
The chip has a temperature range where the voltage output is proportional to temperature however in order to show negative temperatures there has to be an offset built in to cope with this. As the negative temperature range people are normally interested in is less that the positive range then this offset is less than half the voltage. Somewhere along the line the designer for this chip came up with the design decision that the chip would be built with an offset of 0.5V. He could have chosen any other value but he came up with this. If you want a mathematical derivation then you will have to look at the design of the chip in detail and typically manufacturers don't publish that much detail.
If all this worries or disturbs or disappoints you then electronics is not the hobby for you.
the sensor has a range that maps upon a voltage 0..5V. The arduino maps 0.5V upon 0..1023
The temperature is linear with voltage that means the general formula is y = a.x + b or specific T = a * voltage + b question what is a and what is b?
your formula: T = (V-.5)*100 equals T = 100 * Voltage - 50
with a range of voltage from 0..5V this gives a temp range from -50 .. 450
Thank you very much everyone. I understand it now. I just wanted to make sure I understood what I was doing before moving on. I don't like just taking the books word for it without understanding what it is that I'm doing. Thanks.