Re: Refrigerator control



radolin@xxxxxxxxx wrote:

Hi, Andy!

It seems we have typed our messages at the same time. Please see my
reply to Jerry above. I think what I described is close to what you
call a 'D term'.

I don't know much about control theory, I've downloaded some books I
could find online and will try to educate myself a bit.

See http://www.wescottdesign.com/articles/pidwophd.html and other articles on, or linked from, my website. Sometime this spring my book, http://www.elsevier.com/wps/find/bookdescription.cws_home/707797/description#description, should be coming out. I hope it will be helpful (it does go into the math, but I tried to make it as painless as possible).

I use a mechanical relay to switch the heater on/off so I try to keep
the number of switches low. That's why I think a PWM solution is not
appropriate, I think solid state switchin is required for PWM to work
reliably, but designing the circuitry for solid state switching is
beyond my skills.

There's PWM and there's PWM. To effectively PWM a driver you need to switch it slower than the time constant of your plant. In this case your plant's time constant is measured in minutes, if not 10's of minutes, so having a PWM period of a minute (or two, or five) is no problem at all. The two biggest concerns that you should have if you choose to PWM are wear on the relay (which you could fix with a solid state relay) and any efficiency lost in the cooling process when the heater is heating up but not yet making the cooler percolate.

How can I control it without hysteresis? Won't this cause rapid on/off
switching?

If you use my suggestion of switch then wait a while you will be guaranteed switching times that are no shorter than the wait, and will probably be longer because the temperature will change.

I thought at least some hysteresis is needed (though I
agree my first 2 degree C quess is too much) if not for something else
my temp sensor LM335 has at best +-1 deg accuracy, and the 10 bit ADC
is +-1LSB accurate.

1LSB accurate or repeatable?

I see the measured temp fluctuate within some
limit, which is surely because of errors, real temp can't change that
fast - i measure it 2 times per second to display it on the LCD.

You may get better resolution (_not_ accuracy) by measuring significantly faster and averaging. Averaging over a power of two interval is easy, because you just add up the readings and right shift the result. If the last ADC bit is really random you'll pick up quite a bit of resolution this way.

I'd suggest 32 times a second -- take 16 samples, add them up. Don't shift them down for internal use -- use the extra 4 bits of noisy data for the resolution they'll give you. Do shift them down for temperature display, however.

I'll
try putting the MCU in some ADC sleep mode it supports and see if this
will improve measurement accuracy, at list according to the datasheet
it will eliminate internal noise.

Regards,
Rado



--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/
.



Relevant Pages

  • Re: Need small micro dev kit
    ... I want to develop an inverter to take a 200v dc bus and convert it to ... controlling the switching trajectory of each fet the output will be ... So what the micro has to do is output the pwm routine to drive the 4 ... Top left and bottom right both on. ...
    (sci.electronics.design)
  • Re: Using a uC for DC-DC conversion?
    ... > Micro controllers can be used to drive a switcher from their PWM output. ... control and DC bus voltage limiting. ... switching frequency. ...
    (sci.electronics.design)
  • Re: Using a uC for DC-DC conversion?
    ... >> Micro controllers can be used to drive a switcher from their PWM ... > switching frequency. ... > didnt make it any larger, my stuff fitted into the existing design). ...
    (sci.electronics.design)
  • Re: SkyWave 2879AB Amplifier
    ... Look at that example link, it uses 100kHZ in the PWM AM modulator, ... In case of direct pwm to the RF, yes, I mentioned 1nS switching time, ... Remember the modulation frequency is in the audio range, ...
    (rec.radio.cb)
  • Re: Fastest way to run a software feedback loop?
    ... it out with an analogue feedback loop, ... because I want to use a small FET to control the heater. ... then stuffing the MSBs into the PWM ... not an ADC? ...
    (sci.electronics.design)