LM35 temperature sensor

In my first project I was able to output the temperature in my room and upload it in the web. But the graph seems fluctuating and there are some very high and low spikes. Can you suggest me other temperature sensors that is cheap but more reliable other that LM35?.

Thanks In Advance.

BTW, here is the graph of my room temperature.

DS18B20 is a digital sensor that has a lot is discussion and programming in the forum.

Do you have a small capacitor (0.1uF) across to input to smooth out fluctuations in the LM35?

Weedpharma

weedpharma:
DS18B20 is a digital sensor that has a lot is discussion and programming in the forum.

Do you have a small capacitor (0.1uF) across to input to smooth out fluctuations in the LM35?

Weedpharma

Hi, I have never imagined to put a 0.1uF cap. Thanks for the advice.

The LM35 is very reliable. Your code might be not.
Read the LM35 with 1.1volt Aref.
Try this sketch.
Leo…

// LM35 temp sensor connected to A1
// ~2 to ~102 degrees C
//
float Aref = 1.063; // calibration, change this to the actual Aref voltage of ---YOUR--- Arduino
unsigned long total; // A/D output
float tempC; // Celcius
float tempF; // Fahrenheit
//
void setup() {
  analogReference(INTERNAL); // use the internal ~1.1volt reference, change (INTERNAL) to (INTERNAL1V1) for a Mega
  Serial.begin(115200); // ---set serial monitor to this value---
}
//
void loop() {
  analogRead(A1); // one unused reading to clear old sh#t
  for (int x = 0; x < 100; x++) { // 100 readings for averaging
    total = total + analogRead(A1); // add each value
  }
  // convert value to temp
  tempC = total * Aref / 1024; // value to temp conversion
  tempF = tempC * 1.8 + 32; // Celcius to Fahrenheit conversion
  total = 0; // reset value
  // print to serial monitor
  Serial.print("The temperature is  ");
  Serial.print(tempC, 1); // one decimal place
  Serial.print(" Celcius  ");
  Serial.print(tempF, 0); // no decimal places
  Serial.println(" Fahrenheit");
  delay(1000); // slows readings
}