Ds1820 -> pid -> pwm


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    ....The PID wiil work on an Aquarius Water heating process....
    ...The meaning of the project is to unsderstand the funcionality of a PID controller, and see the response of the PID by changing the Kp, Ki, Kd variables.
    I strongly suggest you to remove the fish before experimenting with Kp, Ki, Kd variables.

    Cheers

    Al.
    All progress began with an idea

  2. #2
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by aratti View Post
    I strongly suggest you to remove the fish before experimenting with Kp, Ki, Kd variables.

    Cheers

    Al.
    I think it's better too....

    Thanks
    Thanks and Regards;
    Gadelhas

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post

    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

  6. #6
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default

    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
    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
    @ malc-c , if possible put the code here as you had mension. I would appreciate.

    @ 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

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gadelhas View Post

    @ malc-c , if possible put the code here as you had mension. I would appreciate.
    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.

    Quote Originally Posted by gadelhas View Post
    @ 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.
    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

    Quote Originally Posted by gadelhas View Post
    @ 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!
    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)

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts