LM19 is an analog temperature sensor that operates over a while temperature range (-55 to 130 Celsius). It is very easy to interface it with a microcontroller due to is fairly linear voltage output.

The following code listing illustrates how to obtain temperature readings from LM19 with an Arduino. The code assumed that the sensor output is connected to Analog 0 pin.

void setup()
{
Serial.begin(9600);
}

void loop()
{
float vin = 5.0 * analogRead(0) / 1024.0;
Serial.print(vin);
Serial.print("  ");
float tempC = (1.8663 - vin) / 0.01169;
float tempF = 1.8 * tempC + 32.0;
Serial.print(tempC);
Serial.print("  ");
Serial.println(tempF);
delay(100);
}


In the code above, I used the approximated linear transfer function shown below. It is fairly accurate when the temperature range is around room temperature.
$T_{Celcius} = \frac{1.8663-V_o}{0.01169}$

For more accurate temperature measurement over the full operating range, the following equation can be used:
$T_{Celcius} = \sqrt{2.1962 \times 10^6 + \frac {1.8639 – V_o}{3.88 \times 10^{-6}}} – 1481.96$

## 7 Thoughts on “Working With LM19 Temperature Sensor”

• Arduino Fan says:

why have you multiplied analog(0) by 5 then divided by 1024?

• kwong says:

analog pins return 0-1024. Since Vcc is 5V the actual measured voltage is analog(0)*5/1024. Let me know if you have any questions. Thanks.

• emoken says:

Hellow！
Thank you for release　ＬＭ19’s operates.
Because,I was worried about how to cope with.

But,I have a question.
Where come from “0.01169”?

• kwong says:

According to the datasheet, the linear approximation of the transfer function is V0 = 11.69mV/degreeC * T + 1.8663. Solving for T, T = (V0-1.8663)/11.69mV/degreeC = (V0-1.8663)/0.01169V/degreeC. Hence 0.01169.

• emoken says:

Thank you!
I understand!

• Cieran says:

Hi I am using this sensor with a voltage regualor (12vDC). the output is then connected to the Mishibushi AL2-24mr-d plc. This displays a value on teh software program. I have been searching for a way to convert this value to degrees centigrade.

With your formula will I be able to just measure the Vo on the LM19 using a voltmeter and place the reading into the formula to get the correct temperature measurement?

Many Thanks Cieran

• kwong says:

Correct. LM19 is an analog sensor. Depending on the temperature range you are measuring, you could also use the more accurate formula in the datasheet (the one mentioned here is also in the datasheet but is approximated.)