Convert analogue to digital controller

C

Thread Starter

control_rocks

Hello there. I am designing a PI controller to control a robot I am building. The robot consists of two DC Motors which drive a wheel each.

A C-programmable microprocessor is installed in the robot to allow the robot 'to think'.

I have designed a PI controller on paper using the Root Locus method to get the gain values. I have been told that the best method to convert this to digital form is to use the Backward Difference Method.

Can anybody help me as to how to implement this analogue controller as a C-program that the microprocessor can read?

Thanks,
control_rocks
 
Hi,

You actually want to implent a digital PI controller. for this you have to use the Z-transform technique and you have to select the appropriate sampling time as required by your system.Afterward you simply have to write the codes for of the PI controler formula in any software language. Plz pay special attention to the sampling rates of ADC and DAC. If you need any further assistance you can contact me.

Hope I helped you solve the problem.
 
Basically, you take your 1st sample and subtract the 2nd sample and this gives your error.
Sample is either position or velocity or whatever feedback that you're using. The error is scaled (multiplied) by a gain (Kp) term.
The integral is just the accumulation of errors over time. You add these up and scale by the KI term. There are things you'll need to do like put limits and resets to keep your integral from winding up. Add both up and scale your drive signal to these.
Hopefully that helps.
oj
 
Top