I'm designing an incubator for reptile eggs that will allow for continuous adjustment of temperature setpoint according to a sinusoidal function.
I have successfully made it work using a bang-bang method of control; the incubator unit has a lot of thermal mass so switching on and off doesn't cause much sawtoothing of the temperature curve. However, I am interested in more elegant methods of control. I do not have an engineering or physics background, but I have been researching PID algorithms in Arduino.
My question is this: would it be possible to control the duty cycle of a simple nichrome resistance wire heater using a 220v solid state relay and a PID-type algorithm on the Arduino. Has this been done before (I imagine it probably has), and if so, can anyone link to some example code?
If it can't be done, I would be interested to hear why. In my mind a solid state relay is similar to a switching transistor used in PID control hardware.
Snarky responses welcome, provided they point me in a direction that broadens my understanding
PID is generally used when you have proportional control of something. In your case it sounds like you only have on or off.
You can still use PID though, You can use the output from the PID to specify what proportion of a window of time (that you select) the heater should be on.
Awesome, thanks, that's a great pointer. Could there be a situation where the PID function causes such rapid switching that the solid state relay melts? Is this a possibility outside of the paranoid recesses of my inadequately educated mind?
You can get to a situation where you're close to the set point and the PID tells you to run the heat for one percent of the window, so it'll turn on and off rapidly, but for the rest of the window it'll be off. There's similar behavior at 99% as well of course.
PID is great if it fits your need, but it doesn't know or care what it's controlling. You might consider making your bang -bang controller a little more clever by taking advantage of the fact that you do know.
Yes, I did actually do that, and it worked great. I specified hysteresis intervals, and switching on/off points etc based on observed thermal inertia (not sure if correct terminology) of the entire system.
I was just wondering if I was missing something obviously superior.
An alternative to the SSR is a triac; this allows for a finer grade of control.
I needed something similar for an electric blanket controller (I'm a wimp!).
In the end I used a SSR; it works great - simple to impliment - silent - cheap - robust - but was limited to 2A (which was fine for me).
I also have considerable "thermal capacity" so I just defines 16x 1 second intervals and turn it on for "X" number then off for "16 - X" number. In my case I decide what level using up and down switches (it starts on full for 20 minutes then drops to 4/16 but can be over-ridden at any point) but it would be trivial to tie in something like an I2C protocol thermometer.
On a final note - since lives are at stake - be sure to include some safeguards; would be horrible if something stuck on or off for an extended period of time (remembering too that the millis() function wraps around after (off memory) about 56 days if you're using that).
Hope this helps.
This project uses a 240V Solid state relay with bang-bang control and keep the temperature within +/-0.1 C
But noisier. Lights flicker if the load is significant.