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.
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
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?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.
Yes, my teacher usualy comes to here and MiKroelektronika forum, however he is more a Assembler fan!!!Do we have teacher and pupil here ???
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!!!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)
@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
Hi Gadelhas,
I've explained the purpose and use of both of those variables in the original thread but I'll try again.
pid_I_Clamp limits the amount of "power" that the integral term of the PID-filter is allowed to contribute with to the total output. When doing your "PID homework" you'll come across the term windup, the pid_I_Clamp provides a way to prevent that.
pid_Out_Clamp can be used to limit the total output of the filter. For example, if you your PWM generator has a resolution of 8 bits there's no need (and can possibly even be bad) for the output value to go above 255. The pid_Out_Clamp allows you to specify the maximum "output swing" of the regulator. Note that if you set it to 255 it can swing +/-255, if your system doesn't accept negative drive you need to take care of that "outside" of the filter.
I hope that answers your question.
/Henrik.
I'll configure the EasyPIC5 board for use with a 16F877A and 20Mhz crystal and try the code, probably have to be tomorrow afternoon now as I won't be home from work until late. But I'm sure it does allow you to change and set the values of PID etc as it contains the code to do so (snippet attached)
It might not work with the version in MCS, but works fine with the version that came with windows XP - maybe google for a similar applicationCode:;----[handle incoming serial Terminal data]--------------------------------- Term_RX: HSERIN [Char] SELECT CASE Char CASE "R","r" ' Refresh GOSUB TerminalMenu CASE "S","s" ' Enter Setpoint X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter SetPoint ... (340=34.0",$F8,"): "] HSERIN [DEC SetPoints(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_SetPoint1,EE_SetPoint2, _ EE_SetPoint3,EE_SetPoint4],Bvar WRITE Bvar, WORD SetPoints(EditChannel) CASE "P","p" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter P term as HEX4 ... : "] HSERIN [HEX4 pid_Kp(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_pid_Kp1,EE_pid_Kp2, _ EE_pid_Kp3,EE_pid_Kp4],Bvar WRITE Bvar, WORD pid_Kp(EditChannel) CASE "I","i" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter I term as HEX4 ... : "] HSERIN [HEX4 pid_Ki(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_pid_Ki1,EE_pid_Ki2, _ EE_pid_Ki3,EE_pid_Ki4],Bvar WRITE Bvar, WORD pid_Ki(EditChannel) CASE "D","d" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter D term as HEX4 ... : "] HSERIN [HEX4 pid_Kd(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_pid_Kd1,EE_pid_Kd2, _ EE_pid_Kd3,EE_pid_Kd4],Bvar WRITE Bvar, WORD pid_Kd(EditChannel) CASE "T","t" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter Ti term as DEC ... : "] HSERIN [DEC pid_Ti(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_pid_Ti1,EE_pid_Ti2, _ EE_pid_Ti3,EE_pid_Ti4],Bvar WRITE Bvar, pid_Ti(EditChannel) CASE "C","c" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter I term Clamp as DEC ... : "] HSERIN [DEC pid_I_Clamp(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_pid_I_Clamp1,EE_pid_I_Clamp2, _ EE_pid_I_Clamp3,EE_pid_I_Clamp4],Bvar WRITE Bvar, WORD pid_I_Clamp(EditChannel) CASE "O","o" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Enter Output Clamp as DEC ... : "] HSERIN [DEC pid_Out_Clamp(EditChannel)] GOSUB TerminalMenu LOOKUP2 EditChannel,[EE_pid_Out_Clamp1,EE_pid_Out_Clamp2, _ EE_pid_Out_Clamp3,EE_pid_Out_Clamp4],Bvar WRITE Bvar, WORD pid_Out_Clamp(EditChannel) CASE "M","m" X=1 : Y=22 : GOSUB MoveCursor HSEROUT ["Manual Mode not available. "] CASE "1","2","3","4" ; select channel IF EditChannel != Char -49 THEN GOSUB ClearBox EditChannel = Char -49 GOSUB DrawBox ENDIF CASE ELSE HSEROUT [7] ; bad key, send Bell END SELECT RETURN
You should get something like
![]()
Last edited by malc-c; - 13th October 2010 at 13:02.
Hi;
@Henrik;
Thanks for the answer, i understand now what it means! I will have some more questions, so please don't be mad with me!!
@malc-c
Thanks for the code, but i'm not understanding how this piece of code works with the other. Where is the "terminalMenu", "clearBox", "Movecursor" routines?
When i post the schematic of the hardware, was according to my EasyPic6 Board. I will build the circuit and try the codes in the next Saturday. I think EasyPic5 has the same conections that EasyPic6.
Please if you try the code posted, tell me the results, if possible, of course. Thanks again!
Thanks and Regards;
Gadelhas
Don't worry, I'll try to answer/explain what I can.I will have some more questions, so please don't be mad with me
OK, I've just confirmed that the files in the first post of my thermostat thread compile and display the output in hyperterminal as per the image shown in a post above. This version is nothing fancy, it will display the temperature of 4 x DS18B20's on a 4 line 20 chr LCD and drive 4 outputs which can be connected to SSR's to switch main voltage devices, It also allows the values of the PID to be tuned by entering values via hyperterminal on a PC connected via a serial cable.
Ive re-attached all the files here, inc the compiled HEX - please see the hardware inc file which defines the connections to the LCD etc. You are welcome to use this as the basis for your learning....
Bookmarks