PID Controller

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

PID Controller

Postby picpicpikapika » Fri May 13, 2011 8:24 am

Hi all the experts here, I have a project with me now, it is a PID controller for X-Y positioning table.

I have tried to read the relevant DIY project set (PR24) in your site, I am able to understand the concept and idea of the project, but for the source codes I still need to go deep into it before fully understand them.

I have some questions regarding to PID controller...is it all PID controller have similar algorithmic with the one in the codes ( Integral = Integral + Error; Derivative = Current error - Previous error).

Apart from this, what is the typical way to implement PID controller? Is it make it controlable from the external world (like what you all did in the project), or get the precise value of P, I, D and set the value fixed in the codes??

Another question here, from what I learned in control system, I know that a system require mathematical modeling in order to obtain its relevant transfer function. In a typical closed-loop block diagram, a controller is needed before the plant transfer function, and PID controller is acted as a compensator for the controller in order to fully meet the system specification.

But I am quite confused if I relate the theoretical part with practical application...In real time application, how are we going to obtain the system mathematical model and transfer function, what is the use of this transfer function after obtaining it, is it used for simulation??


Hope to hear from you all soon...
Thanks a lot...best regards.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: PID Controller

Postby robosang » Sun May 22, 2011 5:48 pm

It is not possible to get those parameters for you to get transfer function in real life. Those equipment that come with these parameters might cost you more than you can afford :) Not joking. So many of people uses trial and error method to get the K for PID.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PID Controller

Postby picpicpikapika » Mon May 23, 2011 12:27 pm

Hi thanks for the reply,
I have some questions here regarding to the PR24 source codes...
I have tried to read the codes, I am able to understand most of the parts, except the two functions void send_string(const char *s) and void send_dec(unsigned long data, unsigned char num_dig).

For the second function mentioned, how are we going to display number, lets say 75 in LCD display screen. This function seems like can only undergo one loop...

Another question here...I know the remainder of 75/10 (75%10) is equal to 5, but I become confused when it comes to 75%1000, is it consider zero??

Sorry for the silly question, thanks a lot.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: PID Controller

Postby robosang » Mon May 30, 2011 8:43 am

I din study the code of PR24 from Cytron, but it seem to be that send_string(const char *s) should be sending string to either UART or LCD. send_dec(unsigned long data, unsigned char num_dig) should be function to display value in decimal format on LCD or UART. Let's say you want to display a value from 0-255 (a byte) - named data, and you are expecting the most 3 digits, then you should call the function like this:
send_dec(data, 3);

As for %, yes it is reminder, Try and see what is the result of 75%1000, you get 0 or 75? That is debugging...
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PID Controller

Postby picpicpikapika » Tue Jun 07, 2011 11:10 am

Hi, thanks for the reply...
I would like to ask is it possible to use microcontroller to control a xy table??
Can I use the concept in the DIY PR24 to control my xy table...thanks a lot.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: PID Controller

Postby shiyan » Sun Jun 12, 2011 7:06 pm

picpicpikapika WROTE:Hi, thanks for the reply...
I would like to ask is it possible to use microcontroller to control a xy table??
Can I use the concept in the DIY PR24 to control my xy table...thanks a lot.


Well, obviously you don know what is PID. is a control method, an algorithm to control something. It can appllied any place. Din really look at PR24, but I think most of Cytron DIY project is to show the concept. Of course you can apply it, but the question here is how to apply it? How do you integrate the control into your XY table?
User avatar
shiyan
Amateur
 
Posts: 189
Joined: Wed Jun 09, 2010 10:59 am

Re: PID Controller

Postby picpicpikapika » Sun Jun 12, 2011 9:25 pm

Hi, actually I have some understanding about PID, I know it is a control algorithmic...but I can't say I am totally comprehend its principle. From what I meant in my previous question, I just wanted to know whether it is practical to control a xy table using microcontroller...In the PR24, the objective is to build a PID motor controller, and my xy table will be using two dc motor, therefore I am thinking of modifying the codes in PR24 to achieve my project objectives.
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: PID Controller

Postby robosang » Mon Jun 13, 2011 4:45 pm

picpicpikapika WROTE:Hi, actually I have some understanding about PID, I know it is a control algorithmic...but I can't say I am totally comprehend its principle. From what I meant in my previous question, I just wanted to know whether it is practical to control a xy table using microcontroller...In the PR24, the objective is to build a PID motor controller, and my xy table will be using two dc motor, therefore I am thinking of modifying the codes in PR24 to achieve my project objectives.


I think shiyan would like to point out that:
1. It is possible for you to use the code in PR24 on your XY table.
2. But as you might have know, the PR24 uses simple example to show the PID control. Cytron uses potentiometer to feedback the angle/position of motor shaft, which is not conventional method, it will be different from motor uses in XY table.
3. From hardware point of view, you will need to modify a lot of interface, PR24 is using 1 input to control 1 output. Since you say you want to do XY, surely you will need at least 2 input (feedback) and 2 output (motors). And the feedback surely is not potentiometer 8-)
4. Code wise, you can use PR24 code as the basic and further modify it, the hardwork ---- to modify it into what you want, suit your project and achieve your objectives :mrgreen:

So good luck and do share the progress here.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PID Controller

Postby picpicpikapika » Mon Jun 13, 2011 6:11 pm

Hi, thanks for the reply, I will try my best to do it...but can I know why I can't use potentiometer, doesn't it also a position sensor?? I will be using multi-turn potentiometer, so when the potentiometer is at turn 0, it means the xy table is at its origin, and when the potentiometer reach its full turn, the xy table will be at maximum distance.
Thanks...
picpicpikapika
Apprentice
 
Posts: 46
Joined: Thu Feb 10, 2011 5:57 pm

Re: PID Controller

Postby ober » Tue Jun 14, 2011 8:57 am

picpicpikapika WROTE:Hi, thanks for the reply, I will try my best to do it...but can I know why I can't use potentiometer, doesn't it also a position sensor?? I will be using multi-turn potentiometer, so when the potentiometer is at turn 0, it means the xy table is at its origin, and when the potentiometer reach its full turn, the xy table will be at maximum distance.
Thanks...


Sure you can use the potentiometer, robosang just pointed out that it is rarely used in industrial application as the potentiometer introduce performance drop across time as it will become insensitive. That would be one of the point. Another point might be the interface from mechanism to the potentiometer, you will need to figure how to mount it to your XY table.

Anyway you are more than welcome to share your work here.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Next

Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 16 guests

cron