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);
}
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.
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.
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.
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!