LM35DZ analogue temp sensor issues

I’ve tried to deploy an LM35 temperature sensor in an Arduino project, but the readings I get puzzles me.

I’m not entirely familiar with these sensors, so I apologise in advance for any silly questions.

The readings seems way off, ranging from 0 to ~500 °C(C=Centigrades/Celsius).

What’s up with these sensors? And where am I going wrong?

I’ve attached Arduono Sketch for reference.

Thanks in advance.

How is the sensor wied? Which Arduino do you have?

Posting pictures of code is not the optimal way to get help. Read the how to use this forum-please read stickies to see how to post code and some advice o how to ask a good question.

Thanks for pointing that out.

I'm using an Arduino Uno Rev 3 board. I've wired 5v--》5--》, GND--》GND, Vout--》A1 (Analog 1) through a breadboard.

I can provide more details when I get home (sitting in the park, as per now).

Maybe when you get home you can make a clear photo of the project wiring. Sometime we can spot faults in wiring from a photo.

Poorly written code.
Has a temp resolution (steps) of 0.5 degree C at best, and uses the potentially unstable default Aref.
This example sketch should do a bit better. Stable, and a resolution of 0.1C (all you're going to get from an LM35 and an Arduin0 10-bit A/D).

const byte tempPin = A1;
float tempC; // Celcius

void setup() {
  analogReference(INTERNAL); // use internal 1.1volt Aref

void loop() {
  tempC = analogRead(tempPin) * 0.1039;  // calibrate temp by changing the last digit(s) of "0.1039"
  Serial.print("Temperature is  ");
  Serial.print(tempC, 1); // one decimal place
  Serial.println(" Celcius");

  delay(1000); // use a non-blocking delay when combined with other code