I have problem with lm35 interface with atmega8. the temperature result is displayed on lcd and oscillates and it is n't constant i think it needs capacitor of Rc circuit. what is the best design.
Even for a body of mass as small as this sensor, the temperature variation should not be so substantial, although you did not specify how much. Depending on the distance where the sensor is to the A/D converter, or if no shielding were provided with the wiring, it is likelly getting noise, and for this reason a small vapacitor on its output would help to diminish the floating at its measured value.
Such oscillation does not seem as significant depending on what is being measured and how, as well as the time interval between samples. Is the sensor inside a probe, or is it exposed to the environment being monitored? Is this probe submerged in a liquid, or simply exposed to air? Is the sensor mounted onboard, or is it wired? Is this wire shielded? What is the distance between the sensor and the board input?
You have not said what is the time interval between measurements, what if performing a moving average of the last values read? This has the same effect of an external capacitor, but now implemented via firmware, namely, as a low-pass digital filter, something like that (not tested):
Code:
int16 GetAverage ( int16 NewSample )
{
NewValue = NewSample;
Average = ( NewValue + Average - LastValue )/8;
LastValue = NewValue;
return ( Average );
}
Anyway, without knowing the time interval of these samples, it is difficult to know if this solution is appropriate.