Go Down

Topic: Project 3: Can't understand voltage to temperature formula (Read 2840 times) previous topic - next topic


Hello All and thanks for the help in advance

As mentioned in the book (page 48), every 10 millivolt represents 1 Celsius, which's mean to get the temperature, I write the following formula:
Code: [Select]
float temperature = voltage * 0.01;

Instead, it's written in the book as following:
Code: [Select]
float temperature = (voltage - 0.5) * 100;

Could someone please explain why?


Hello Furkidd

You need to multiply by 100, not divide by 100, to convert 10mV (0.010V) to 1 degree.

Subtracting 0.5 from the voltage is to correct for a 500mV offset voltage on the sensor output.


Hackscribble.  Writing about making things.
arduino@hackscribble.com | www.hackscribble.com


Hello Ray

Thanks for the explanation but I can't seem to figure out what you mean and where to figure out the 500mV offset voltage.

The book explains this -.5 is needed in the formula because it needs to offset the values below freezing.

I can't seem to understand either your or the book's explanation.

Thanks guys


I found the temperature conversion stated in the book was incorrect, or maybe just gave F values when it claimed to give C values. Tbh, there are a few errors or typos in the book and I am just up to Chapter 3..not sure if this is due to my starter kit being the Arduino SRL version.

I ended up changing the code to:

Code: [Select]
// convert the voltage to temperature, then from degrees F to C
float temperature = ((((voltage - 0.5) * 100) - 32) * 5) /9;

which gave the correct Celcius values.

Go Up