Wrong reading in temperature sensor

I am testing the temperature sensor LM35DT at room temperature with Arduino Mega but I am getting high readings (50 C)
I read that using internal 1.1V will provide more accurate results so I use it but there is no improvement, here is the code:

/* LM35 analog temperature sensor with Arduino example code. More info: https://www.makerguides.com */

// Define to which pin of the Arduino the output of the LM35 is connected:
#define sensorPin A0

void setup() {
  // Begin serial communication at a baud rate of 9600:

  // Set the reference voltage for analog input to the built-in 1.1 V reference:

void loop() {
  // Get a reading from the temperature sensor:
  int reading = analogRead(sensorPin);

  // Convert the reading into voltage:
  float voltage = reading * (1100 / 1024.0);

  // Convert the voltage into the temperature in degree Celsius:
  float temperature = voltage / 10;

  // Print the temperature in the Serial Monitor:
  Serial.print(" \xC2\xB0"); // shows degree symbol

  delay(1000); // wait a second between readings

Doesn't it go below zero C?

Actually in the next trial it read -11 C
What is that means?

That winter has finally come.

Or your sensor is faulty.

Or your wiring is broken.

Or gremlins are around.

Wiring diagram ? Common 0v?

Measure output voltage ~ 800mV ??

Just measure the A/D number and see what you get and whether it makes sense. With Vcc as reference..... about 160 ? Or 740 with 1.1v ref ?

If will try this sensor will work:


If you measure the LM35 output with a DMM, you should see around 220 ~ 280 millivolts at room temp. You may have a counterfeit, where did you buy it?

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