Good advice Al
@gadelhas
Most of the code in the PID thermostat thread was written by Darrel and Henrik, and contains a means of tuning the values you mention. Later this evening I'll go back through the early versions of the code I have for a single PID channel that can be configured via a PC running Hyperterminal and communicating via the serial port. I'll zip it up and attach that to the post. You can then experiment with the values and compose your report
Hi,
What you want to do is very much doable with pretty much any PIC, a 16F877 will be plenty. Make sure you read thru the complete PID filter thread (if you haven't already) as it covers several things - and provides an updated version of the PID filter in post #57.
The easiest way is to use a solid state relay as it isolates the load from the PIC and is easy to drive (it's basically just a LED). But to give a more detailed answer we'd need to know if the heater is AC and you by PWM really mean phase angle control. Or if it's DC and you intend to use the CCP-module in the PIC to produce a PWM signal - or (if it's either AC or DC) you intend to create a slow speed PWM with a period of several seconds or longer (I beleive this is what Malcolm did) where the fact that a triac or solid state relay for AC doesn't switch off until next zero crossing doesn't matter.
/Henrik.
I agree, an SSR is the simplest way to interface the output from a PIC to mains device. In the development of the thermostat project I'm now using zero-crossin opto-triac isolators to drive 16A triacs, but the original prototype used 4A SSR.
As Henrik stated, my thermostat project uses low speed pwm to apply power to the heaters, the result is that the heaters remain at a nice stable temperature rather than the normal method of heating which results in large temperature swings
Here's an example of the frequency
Last edited by malc-c; - 11th October 2010 at 22:55. Reason: added video
Hi Again, and thanks for all of your answers!!
Here is my 1º schematic of the PID Controller. As i say in my revious post, the Buttons, is to set the SetPoint, and change the Ki, Kp, Kd, variables.
@ malc-c , if possible put the code here as you had mension. I would appreciate.malc-c
Good advice Al
@gadelhas
Most of the code in the PID thermostat thread was written by Darrel and Henrik, and contains a means of tuning the values you mention. Later this evening I'll go back through the early versions of the code I have for a single PID channel that can be configured via a PC running Hyperterminal and communicating via the serial port. I'll zip it up and attach that to the post. You can then experiment with the values and compose your report
@ HenrikOlsson, I'm reading and trying to understand your PID routine, i will post some questions soon about it, i have some questions!!
The Heater resistor that i have is 220V AC, i think it's better to do, like malc-c did, with a Solid State Relay, and low speed PWM.
@ malc-c Again. I see your video, and i think the result its really great. If you change the Kp, Ki, Kd, variables, do you see any change to the process? Like, more slow/ fast to achive the SetPoint, for instance?
Thanks once again for everything.
Hope you can understand my english, sorry for all the errors!
Thanks and Regards;
Gadelhas
To be honest you could use the code attached to my first post in the thermostat thread http://www.picbasic.co.uk/forum/showthread.php?t=12712
You would need to build / breadboard your hardware to match that used in the included hardware file.
I've not tried it, but I would of thought that it would be kinder on the resistive element of the aquarirm heater, especially as with it immersed in water the heater has less chance to cool as a similar element would in air. A SSR is the way to go - bit costly, but a lot safer
From memory, changing the values altered things like the amount of over-shoot of the set point, the range at which the output started pulsing, and the length of pulse. The advantage with the code that Darrel and Henrick had put together was that using a serial cable and Hyperterm I was able to change the values via the PC and see what effect it had on my test rig which comprised of a heater in a wooden box with the sensor 6" below a ceramic heater. Over several weeks the values were adjusted and tuned until the temperature set point either maintained or was within half a degree either side (as you can see by the video - in the real environment it's almost spot on)
Working with ac and resistive load, phase angle control is the choice (dimmer principle), PWM works very well only with dc.
Since you will have 50 Hz main, every half cycle will last 10 millisecs, so once you have found the zero crossing moment, you will fire your triac with a delay from 0 millisecs to max 10 millisecs.
where:
0 millisecs delay = 100% duty
.
.
5 millisecs delay = 50% duty
.
.
10 millisecs delay = 0 % duty
Remember that your triac will turn off at every zero crossing, which make phase angle control a rather efficient and easy way to control resistive loads with ac.
Cheers
Al.
Last edited by aratti; - 12th October 2010 at 12:53.
All progress began with an idea
Bookmarks