advertisement
from the Forum department...
PID PWM
Motion control, servos, steppers, etc. topic
Posted by Joe on 21 May, 2009 - 3:14 am
Hi there,

I'm trying to control a motor using PWM modulation.

I did something similar to:

dutyCycle[n] = dutyCycle[n-1] + Kp*error[n] + Kd*(error[n]-error[n-1])

Basically dutyCycle adjusts until there is no error. I tried this out and it seems to work correctly. It this correct? Or is it not a PD controller?

I did some research and it seems that there exists an incremental form of the PID. But it involves proportional, derivative and integral gains. What is the use of the integral when dutyCycle is acting as an integral sum?

Thank you


Posted by William Sturm on 21 May, 2009 - 9:52 am
By adding the dutyCycle[n-1] factor, you are integrating the output. You technically have a PID loop. Most PID loops integrate the error and use an integral gain factor. You need to prevent the output from rapidly rising to 100% or falling to 0%, otherwise you have an oscillator. Your example may work with a perfect load (no lag or inertia). The problem with a PD loop is that zero error = zero output, you will always have some level of error that is proportional to your PWM duty cycle. I would suggest starting with a PD loop, and then slowly integrate the error until it is at zero.

Bill Sturm
Abbeytronics LLC

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2010 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.


Fortune
Always borrow money from a pessimist; he doesn't expect to be paid
back.
Advertise here
advertisements
Servo, stepping motor control, analog & web HMI in one system!
Control.com is the largest Automation community on the web. Learn how to advertise here now...
MatrikonOPC has over 500 OPC interfaces and out of the box software. Find an OPC Server for your devices here.
Servo, steppers, analog, digital & web HMI - Fully Integrated!
Time to incorporate data handling, web HMI and motion in one system!
our advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive