Pages: [1]   Go Down
Author Topic: Thermistor Problem - Readings are off  (Read 1334 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Everyone,

I love the show around here and can't preach the wrong thing about Arduinos smiley

I have a thermistor hooked up to my #5 analog input and cannot get it to stop reading and bouncing around from 73.5°F to 74.92°F.

I am trying to use it as a thermostat and don't want the darn stat clicking on and off when it gets close to set point.

Any suggestions on leveling off or averaging this sensor?

Are the sensors always like this? (Bouncing like mad).

Cheers,
CG
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have a thermistor hooked up to my #5 analog input and cannot get it to stop reading and bouncing around from 73.5°F to 74.92°F.

I am trying to use it as a thermostat and don't want the darn stat clicking on and off when it gets close to set point.

Any suggestions on leveling off or averaging this sensor?

Are the sensors always like this? (Bouncing like mad).

Actually that might be a normal reading for your setup. Not sure of how much of the total 0-5vdc range your sensor is using without knowing more about the sensor and how you have wired into your circuit. Also how you are scaling or mapping the value might give some light to the situation. Keep in mind that the 10 bit A/D conversions give around 5mv steps of resolution for each count. Figure out what a 5mv change represents for your scaling and see if you aren't just seeing the normal LSB switching on and off. Also the Atmel total accuracy spec is +/- 2 LSB, or +/- 20mv on a 0-5 volt scale.

 All that aside it sound like what you have can be made to work. What most thermostats have mechanically built in, and what you need to add to you code, is called hysteresis so you don't 'chatter' on and off right at the setpoint value.

What you need is a moving band of temperature, say maybe 2 degrees wide. Say you have a target setpoint, of desired temp of 70 degrees. Your decision to turn on the heat should be at 69 and lower and turn off at 71 and higher. This gap has to be adjusted to change with the setpoint such that if you demanded 80 degrees the the on and off decision points would be 79 and 81.

You may have to increase that gap wider depending on the amount of noise or variation of your sensor readings, the total heat load of what you are heating up and the heat capacity of you heat source.

Tighter control then that would require more sophisticated control algorithms such as PID control and a variable output control, either analog or PWM to drive the heating element.

Lefty
« Last Edit: January 10, 2011, 10:57:57 pm by retrolefty » Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 146
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a suggestion -- I am also building a thermostat. I found that the best temperature sensor is the Dallas Temperature Sensor 18B20.

The link is here: http://www.sparkfun.com/products/245

I bought a thermistor but have never tried it out. Will try it though as soon as possible to see if I find any problem with it.

However, I recommend the DS18B20 Temp Sensor for any temperature analysis or thermostat project. Very accurate and not too expensive.

I also had the standard Analog Temp Sensor which proved to be very inaccurate for my project.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Lefty and iRagDoll!

iRagDoll, I am going to stick with thermistors as they are the most commercially acceptable in the industry.  Thank you for your input though.

Lefty,  I am using a 10K thermistor from SparkFun (Datasheet: http://www.sparkfun.com/datasheets/Sensors/Thermistor23816403-1.pdf).  I understand the logic that is supposed to happen with the thermostat as far as deadbands and what not.  I am in the HVAC and control industry.

I do have a delay so it doesn't "chatter" on and off.  I was looking more to average the thermistor reading so it doesn't keep swinging (even 1 degree is a big swing if done quick enough).

Any thoughts?

It also shows 73.5 in the room when the mercury bulb shows 68 degrees.  I am using the program from the examples to read the thermistor.  Any thoughts on that?

Thanks guys!  I will be hooking up the stat to my furnace tonight! Test run smiley... Brrrrr!!!!

Logged

United States (Texas)
Offline Offline
God Member
*****
Karma: 3
Posts: 525
Arduino socks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you might do a calibration on the sensor then. ice water and boiling water give you a good 0 and 100 degrees Celsius reference.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 I was looking more to average the thermistor reading so it doesn't keep swinging (even 1 degree is a big swing if done quick enough).

Any thoughts?

I would try software filtering before external electrical filtering, cause it's free.  smiley-wink

 Take four readings in a row just adding it to the same variable and then divide by four to get your 'filtered reading'. Then zero out the variable and take another four readings, divide, lather, rinse, repeat. Try eight readings and divide if needed. You are trading speed for stability, but most temp applications are not too demanding for Arduino speed.



It also shows 73.5 in the room when the mercury bulb shows 68 degrees.  I am using the program from the examples to read the thermistor.  Any thoughts on that?

4 1/2 degrees high? I would want to know if at say 90 degrees is it's still a 4 1/2 high error. Such linear 'offset' errors can easily adjusted out in either software (simple add the offset in software), or if your using a simple resistor/thermistor circuit reduce the resistor by say 1000 ohms and add a 10 turn 1K ohm trim pot and then adjust the pot so the reading equals your reference bulb. If it's not a linear error and unacceptable performance for your application then you have to blame it on either the sensor or your software scaling/mapping method.

PS: They say a man with one watch always knows the time, man with
      two watches never quite sure.  smiley-wink

Lefty
« Last Edit: January 10, 2011, 11:51:04 pm by retrolefty » Logged

'round the world...
Offline Offline
Faraday Member
**
Karma: 42
Posts: 3244
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the tolerance on the resistor used with the Thermistor?

Also, where did you get the data to convert from resistance to temperature? From Vishay's website they provide tables... meaning that a function might not be good enough to get a temperature X resistance plot.
Have you tried plotting the data and creating a regression on the curve?

4 fahrenheit is way too much error for this type of NTC. :\
Logged

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

Atlanta
Offline Offline
Sr. Member
****
Karma: 1
Posts: 254
Arduino still rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As usual retrolefty has the best advice.  Sorry, iRagDoll a better sensor wont fix short cycling or chattering.  

Quote
I do have a delay so it doesn't "chatter" on and off.  I was looking more to average the thermistor reading so it doesn't keep swinging (even 1 degree is a big swing if done quick enough).
Please note delay is NOT deadband.  Delay is TIME and deadband is TEMPERATURE.  

http://en.wikipedia.org/wiki/Hysteresis see In Engineering, Control Systems a little more than halfway down.  There is some loose confusion among HVAC workers between "delay" and "hysteresis", the difference is subtle but vitally important.
Logged

Left Field
Offline Offline
Newbie
*
Karma: 0
Posts: 13
In Squad We Trust
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have this issue with my thermistor device as well.

I went in and in my programming have the sensor readings set up as if/then statements.  This way I can setup "windows" of acceptable values...

For example...

If the temp you want the room to be is 74 degrees, then you set the acceptable window from 72-76 (sensor reading).   This 4 degree swing is essentially debouncing the system.   You also have to set the parameters so that the temp must remain outside the window for a given amount of time before the system attempts to correct it.

Desired temp: 74
Window: 72-76
Time to correction: 5 minutes
If/Then: If the temp falls out of the window for 5 minutes, take corrective action until the desired temp is reached

My application has a 15 second buffer between changes to the system and a window of 5 degrees C (but it requires exceptionally quick use of the temp data)
Logged

Pages: [1]   Go Up
Jump to: