I am displaying a reading from an analog temperature sensor on a 16 x 2 LCD for a thermostat. What I'm having trouble with is when the temperature is changing, the reading on the screen may bounce between two values for a couple of seconds before stabilizing at the new temperature. I have suitable averaging in the code and a large capacitor on the analog input, so it isn't that kind of fluctuation. I figure it is due to the sensor case taking a little time to change temperature.
Mostly I don't like it for aesthetic reasons, but it also causes the relay controlling the load to bounce a few times. How can I introduce some delay into the reading to allow for it to stabilize at the new value before updating the screen?
It actually sounds like you don't have enough hysteresis.
Hysteresis is the dependence of a system not only on its current environment but also on its past environment. This dependence arises because the system can be in more than one internal state. To predict its future development, either its internal state or its history must be known.[1] If a given input alternately increases and decreases, the output tends to form a loop as in the figure. However, loops may also occur because of a dynamic lag between input and output. Often, this effect is also referred to as hysteresis, or rate-dependent hysteresis. However, this effect disappears as the input changes more slowly.
I have suitable averaging in the code and a large capacitor on the analog input, so it isn't that kind of fluctuation. I figure it is due to the sensor case taking a little time to change temperature.
So what is "that kind" of fluctuation ?
Schematic ?
Code ?
Without sounding untactful , may I say that it would seem that whatever you are doing is not working so perhaps it would
help if we knew everything about your setup.
If you really expect any help from this forum you need to be more forthcoming with information about your system.
We generally expect nothing short of full disclosure to expedite the process so we don't wind up beating around the bush.
Usually this means a schematic and code with the code posted using the "#" code button (above) to create a
scroll window so people can scroll through the code. Occasionally people come to the forum seeking help with
a project which they consider "proprietary" so they withhold as much information as possible. That usually means we
never get to the bottom of it. I would suggest following the guidelines here: http://forum.arduino.cc/index.php/topic,148850.0.html
Long story short, I'm not sure software Hysteresis is as reliable as hardware hysteresis, but that's probably because I
am a HW person with little programming experience. My first question is do you have a hysteresis comparator circuit
for your thermostat ?
(see attached file)
What I'm having trouble with is when the temperature is changing, the reading on the screen may bounce between two values for a couple of seconds before stabilizing at the new temperature.
Couldn't you simply avoid changing the temperature that is displayed until you have gotten the same temperature reading several times in a row?
Thanks for the replies. I am going to put the sensor inside of a stainless tube, so maybe that will add the right amount of hysteresis to it. If not, I will surely be back.