Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - I need the equation for calculating the temperature...

(you are viewing a thread; or go back to list of threads)

I need the equation for calculating the temperature... (by marzook)
I use LM35 for temperature measurement ....
I need the equation for calculating the temperature ... Someone Can help or give an example in ladder logic?

Welcome
marzook
Sat Mar 5 2011, 14:29:42
no subject (by simon)
try this

# Temperature ( oC) = Vout * 100 oC/V

http://www.facstaff.bucknell.e...sonshtml/Sensors/TempLM35.html
Sat Mar 5 2011, 17:31:18
no subject (by simon)
or this

temperature = (5.0 * val * 100.0)/1024.0
Sat Mar 5 2011, 17:44:46
(no subject) (by Jonathan Westhues)
We note that the LM35 puts out a voltage proportional (with no offset) to the temperature T in degrees Celsius. Since your micro's A/D can't convert negative values, this means your circuit will work only for temperatures above freezing.

As mentioned, the scale is 10 mV/degree. So

Vout = 0.010*T

Then for a 10-bit A/D converter with a 5 V reference,

code = 1023*V/5 = 1023*0.010*T/5 = 2.046*T

so

T = code/2.046

If we want to evaluate this using only integer math, then we might write T = (code*22)/45. That doesn't overflow with 16-bit math, since 22*1023 = 22507 < 32768. I chose that approximation by truncating the continued fraction, so there's a sense in which it's optimal. This doesn't really matter, as long as it's much better than other sources of error (for example, the tolerance on the voltage reference, often around 1%) in the system.
Sat Mar 5 2011, 19:41:46
(no subject) (by bai ying)
can anyone please explain the calculation in more detail. thank you.
Thu Mar 8 2012, 02:52:52
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):