Arudino Article with mistake ??

in your article (Screenshot with light reading and temperature) you write that the "TEMP reading" sensor has values between 151 - 153 ...

so, lets say tempReading is 151 as a value stored in "tempReading" variable...
now we do the math's

float voltage = tempReading * aref_voltage / 1024;

151 * aref_voltage (which is 3.3 acording to the sourcecode) / 1024 gives us : 0.48662
so now voltage has the value 0.48662 ==> I cannot understand how you received 0.74 volts!!

second math operation is:

float temperatureC = (voltage - 0.5) * 100 ;
so this is (0.48662 - 0.5) * 100; which gives us -1.338 (and not 23.73 degrees....)

could you tell me if i am wrong, my maths skills are not good enough or... i simply did a mistake somewhere in my thinking ??

Best greets

phil
philippp

Posts: 1
Joined: Mon Jan 07, 2013 5:05 pm

Re: Arudino Article with mistake ??

The math does work for a AREF of 5v. The screen shot is apparently from a system running with a 5v AREF.