• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM Control

Not open for further replies.


New Member
Hi, I have implemented a PID controller on a microcontroller. The PID controller controls the duty cycle of a PWM signal as follows.

duty_cycle = duty_cycle + ( Kp * e[n] + Kd * {e[n] - e[n-1]} )

where, duty_cycle is a register that controls the duty cycle,
Kp and Kd are the proportional and derivative gains respectively,
and e[n] is the current error and e[n-1] is the previous error.

Since the PID output does not produce the output directly, but rather specifies the change, from what I gather it's called the 'velocity-form' PID.

Notice that I didn't use an integral term, cause I'm thinking I don't need it since duty_cycle is acting like an integrator. However, I'm doing some research and I found statement saying that you cannot use it in velocity-form without an integral term.

Am I doing something wrong? Intuitively, I think that if I add an integral term I will always get overshoot.

Please correct me if I'm wrong.
Thank you
Not open for further replies.

EE World Online Articles