hai....
i am facing a problem that my temp reading is fluctuating.
Detail:
i am using mega 2560 operating on 9v from smps by Vin pin, and LM35 connected directly (5V using 7805 to input , ground , output to analoug pin of arduino).
hai....
i am facing a problem that my temp reading is fluctuating.
Detail:
i am using mega 2560 operating on 9v from smps by Vin pin, and LM35 connected directly (5V using 7805 to input , ground , output to analoug pin of arduino).
How much does it fluctuate?
Is the 7805 only for the LM35? Why don't you just use the Arduino's 5V regulator?
Maybe the 7805 is noisy? Are there capacitors on the 7805 input & output (as "required" by the datasheet)?
It's not clear from the description if the ground of the 7805/LM35 is also connected to Arduino ground?
An LM35 should be read with 1.1volt Aref for stability and higher resolution.
Averaging multiple readings might also be needed.
Show us your code (use code tags).
Leo..
Example code to try.
Leo..
// LM35 temp sensor connected to analogue input A0
unsigned int total; // A/D readings
float tempC; // Celcius
float tempF; // Fahrenheit
void setup() {
analogReference(INTERNAL1V1); // for a Mega | use (INTERNAL) for other Arduinos
Serial.begin(9600);
}
void loop() {
total = 0; // reset total
for (int x = 0; x < 64; x++) { // 64(max) analogue readings for averaging
total = total + analogRead(A0); // add each value
}
tempC = total * 0.001632; // Calibrate by changing the last digit(s)
tempF = tempC * 1.8 + 32; // Celcius to Fahrenheit
Serial.print("The temperature is ");
Serial.print(tempC, 1); // one decimal place
Serial.print(" Celcius ");
Serial.print(tempF, 1); // one decimal place
Serial.println(" Fahrenheit");
delay(1000); // use a non-blocking delay when combined with other code
}