Issues with LM35DZ sensor on Arduino Uno

Hello, I'm trying to get the temperature from the LM35DZ sensor into the Serial Monitor. The problems are as follows:
If I connect it to the 5V pin the entire setup doesn't power on when I plug it into the USB port on my PC.

If I connect it to the 3.3V pin the Arduino does power on and execute my program, but it displays 8.30C as the temperature. The temperature doesn't change if I touch or hold the sensor, but the sensor itself appears to be heating up.

My code is as follows:

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

void loop() {
  // put your main code here, to run repeatedly:
    int value = (float)analogRead(A1);
    float millivolts = (value / 1024.0) * 5000; 
    float celsius = millivolts / 10;
    Serial.print(celsius);
    Serial.print("\n");
    delay(100);
}

5 volts should be fine, is there something on the module that labels Vs Vout and GND because at first glance the wires don't seem to line up right

I was only able to upload one picture in the OP. Here's a better view of the wires:

Can you post a link to the webpage of the lm35dz that you purchased?

I bought it from a physical store of this Bulgarian website: Кит K2184 Температурен сензор LM35DZ (elimex.bg)

They don't show a pinout on the website. How did you know which pin is Vcc, GND and output?

The pin out is probably right if the purple is on the center pin, left pin is positive and right pin is ground.

modify your code a little

int value = analogRead(A1);
  float volts =value * (5.0 / 1023.0);
  Serial.println(volts);

  delay(2000);

I uploaded a video to better show off the issue: Arduino issue - YouTube

When the Arduino is plugged into the USB 2.0 port of my PC nothing happens. If I remove the wire from the 5V pin it starts up. When I plug the wire back in it stops working once again.

I looked up many different projects that use the LM35 element and my pinout seems to be correct. Any help still?

I've seen other LM35 boards where the pinoit is GND, Vcc, signal.
I think your board is wired that way.
Put the yellow wire om the left, the purple on the right and the orange in the middle

I changed the wiring to GND, Vcc, output. The Arduino turns on now, but the temperature readings seem to randomly go between 0 and 500. Sometimes appearing to go up from 0 to 500, then back down again.
image

Unfortunately, you probably damaged the LM35 when you connected it wrong.
At 25 degs. C you should be reading 0.25V.

If your LM35 module was like this one it looks like you connected it reverse polarity. That would explain your symptoms initially. Your current symptoms point to a bad LM35 sensor likely as a result of connecting it reverse polarity.

Ron

I would not give up yet, the LM35DZ pin out is 1=5v 2=Signal 3=GND. It seems that the breakout board that the LM35 is soldered to crosses the pins at the breakout header, my guess is that the right header pin marked with the S is the signal out. Perhaps you can test from the IC pins to each header pin with a multimeter, my guess would be (at the header) orange=pin 1 yellow=pin 2 purple=pin 3 (the s pin), but to be sure use a multimeter and if you are lucky it could still work.

check out the video and make a note of the code : How to use LM35 temperature sensor with arduino - YouTube

lm35dz

I bought a digital temperature sensor DS18B28 and redid my whole project with it instead. I probably damaged the LM35DZ by connecting it wrong. With the new sensor my project is nearly complete now. Thanks everyone for the help anyways!

1 Like

Yay, happy ending. :slight_smile:
Ron

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.