lm35 with arduino zero help please

Hello all,

This is my first post so please excuse me for I am at a loss and am new.

float A0Pin;
float A0Vout;
float tempC, tempF;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
analogReadResolution(12);
A0Vout = analogRead(A0Pin);
// 5V / 4096 = 0.0012207
// Vout = 0.01 * T
// T = Vout * 100
tempC = A0Vout * 0.12207;

and this is what I get on the serial monitor:

A0Pin (from sensor) = 0.00
A0Vout (After analog read) = 705.00
Temprature (C) = 86.06
Temprature (F) = 186.91

I have attempted various things and searched fairly hard on the net. I took a voltmeter and measured 5V coming from the board into pin1, also 540mV going out of pin3 and into A0. It is roughly 25C in my house and I got these sensors from fry's electronics.

May I ask for help in eliminating the equation as the cause please?

Hi, and welcome to the forum.

  1. An LM35 temp sensor should ouput 250mV@25C.

  2. 5V / 4096 = 0.0012207 and tempC = A0Vout * 0.12207; assumes a 5volt Arduino. The Zero runs on 3.3volt..

tempC = A0Vout * 0.080564; // should be close... if the sensor is ok

Leo..

Thank you Leo for greeting me and responding!

I get:

A0Pin (from sensor) = 0.00
A0Vout (After analog read) = 711.00
Temprature (C) = 57.28
Temprature (F) = 135.11

From:

float A0Pin;
float A0Vout;
float tempC, tempF;

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

void loop() {
analogReadResolution(12);
A0Vout = analogRead(A0Pin);
tempC = A0Vout * 0.080564;
tempF = tempC * 1.8 + 32;
}

The sensors came in a pack of 6 or so and I have tried all of them.

I thought about putting a large resistor between the output pin and ground as suggested on the TI datasheet but that same datasheet stated that it would still be close without it and that the "full range" can be read with the resistor configuration.

I called it A0Pin but how does the arduino know where to pull the info from on the board? I've tried
A0Pin = A0 and it returns 14.00

float A0Pin = A0;

A0Pin (from sensor) = 14.00
A0Vout (After analog read) = 708.00
Temprature (C) = 57.04
Temprature (F) = 134.67

The sensor must output 250mV@25C.
Measure that without connecting sensor output to the Arduino.
Maybe best to post a picture of your setup before going any further.
Leo..

Here is a picture of the setup.

I was thinking maybe the sensor is doubling something, half of 540 is 270. For example, perhaps instead of 10mV/C it is 20mV/C for some reason. This would give Vout * 50 = T.

I have no clue.

lm35pic.pdf (189 KB)

There have been reports of fake LM35 sensors.
If your sensor is not outputting 250mV@25C, then contact your seller.

Next time buy DS18B20 digital temp sensors.
Leo..

Ok, thank you for taking a shot at it. Take it easy Leo.