Ds1820 -> pid -> pwm


Closed Thread
Results 1 to 24 of 24

Hybrid View

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

    Default Ds1820 -> pid -> pwm

    Hi Everyone;

    I need to do a university project, for "Computer Control. The project consists of performing a PID controller based on a Microcontroller.
    The PID wiil work on an Aquarius Water heating process, it will acquire the temperature from a DS1820, compare the temperature with the SetPoint them do the PID calculations, and them output the value to PWM that is connected to a resistive heater. The Man/Machino interface will be performed by a LCD2X20 and 3 Buttons. I need a menu to change the SetPoint, and other to Change the value of the Kp, Ki, and KD variables to see the PID response for different values of these variables!

    I'm looking at this threads;
    http://www.picbasic.co.uk/forum/show...ghlight=pwm%2A
    http://www.picbasic.co.uk/forum/showthread.php?t=12712

    It is possible to do this? I think so, however i would like your opinion.
    My questions, for now, do you think that this is possible to do with a PIC16F877A@20Mhz??

    Thanks everyone!
    Thanks and Regards;
    Gadelhas

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gadelhas View Post
    My questions, for now, do you think that this is possible to do with a PIC16F877A@20Mhz??

    Thanks everyone!
    Well originally we had 4 PID loops running on a 16F877A with a 20Mhz Xtal so I guess the answer to your question is yes !

    As most of your project has already been provided in the sample code in one of your links, there is little work required on your behalf... however I would suggest you didn't rip off the code from that thread and claim it as your own when you submit your project for assestment. This wold be plagerisum (?)

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    Well originally we had 4 PID loops running on a 16F877A with a 20Mhz Xtal so I guess the answer to your question is yes !

    As most of your project has already been provided in the sample code in one of your links, there is little work required on your behalf... however I would suggest you didn't rip off the code from that thread and claim it as your own when you submit your project for assestment. This wold be plagerisum (?)

    Hi;

    Thanks for the answer;

    I don't intend to suggest to my teacher that the code is mine. I need to do a report, and i have to mention where i get the source code and all other things, like images, texts..... My teacher is also a user of this fórum.
    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.

    If i complete the project, it's my intention to post here as open source!!!

    Hope i can count with your help, i will make the schematic and them post here!!

    Should i use a solid state relay to control de Heater Resistor or a Triac??

    Thanks once again!
    Thanks and Regards;
    Gadelhas

  4. #4
    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

  5. #5
    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

  6. #6
    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

  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

    I don't intend to suggest to my teacher that the code is mine. I need to do a report, and i have to mention where i get the source code and all other things, like images, texts..... My teacher is also a user of this fórum.
    Quote Originally Posted by aratti View Post
    In this case I will expect from him to challenge the highest performace he could think of.
    He will be a tomorrow electronic designer and he will have to face an extremely aggressive global market, so I do expect from him something more than "something that will likely work just fine"


    Al.
    Do we have teacher and pupil here ???

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,557


    Did you find this post helpful? Yes | No

    Default

    Hi Al,
    I believe that creating a product that serves its purpose without making it more complicated than it needs to be is key for an electronic designer, today and in the future.

    Going by the project description in the first post (ie temperature control (with PID) of a fish tank) I do beleive that low frequency PWM will work just as fine as a phase angle control but will be easier to implement, produce less electrical interference, require less parts and be easier to build - and it'll work on 50 and 60Hz mains without paying special attention. That's good product design in my book but I don't work as an electronics designer, I don't have a degree and I never went to university so what the heck do I know.

    If the students gets assessed by what they CAN (possibly) create then by all means, throw everything you got at it. Phase angle control, datalogging, GLCD with trend charts, TCP/IP interface, you name it. But I hope they gets assessed by their abillity to indentify the real needs to solve the problem at hand and then design a product that works - properly of course.

    I DO agree that the correct method should be used. If phase angle control in this application offers benefits that justifies the extra complexity then it IS the correct choice.

    Well, that's my view on it. 10-4

    Sincerely,
    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default

    Hi Again Everyone, and once again thanks for all of your answers to the thread!

    I can only come to here at late night because i work during the day, and study at night, so sorry for only now answer to the thread!

    @malc-c
    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 Allready have that code, however this code don't permite changing the variables with hiperterminal like you said, can you give me the one that does?

    Do we have teacher and pupil here ???
    Yes, my teacher usualy comes to here and MiKroelektronika forum, however he is more a Assembler fan!!!

    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)
    That's exactly what i wont, to see the response of the system, by changing the variables, that is the real porpose of the work!!!

    @aratti
    I know that the phase angle control it's much better to control AC charges, however, since it's slow speed PWM, because the system is slow, i think, that i have other advantages, like Henrik said! I have PID controllers on the University that i can use, however my teacher made me this challenge, and i accepted!
    Please don't judge me wrong, if i have the time, believe me that i would do the phase angle control, and I will put a GLCD to show the curves of the system response, but in the meantime i need to understand the PID, put it to work, and them improve the whole system, if i've got the time! This is not an excuse, but i work, i study and in 3 months my baby will be born, however like i said this is not a excuse. I really appreciate your opinion!

    @HenrikOlsson
    Why to you have the "pid_I_Clamp" and "pid_Out_Clamp"i'm not understanding the meaning of this variables?

    Thanks all for all your support!
    Thanks and Regards;
    Gadelhas

Members who have read this thread : 0

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