Electrical – Doubt with the conversion from output PID signal to PWM on inverted pendulum control problem

pid controllerpwm

I am working on the design of a PID controller to control an inverted pendulum. The last days i got stuck in trying to understand the relationship between the PID's output, and how can relate it with the PWM signal (or percentage).
At first i supposed that it is necessary to measure the force that is generated by every percentage of PWM, so i can get a linear relation between both values. But then, looking for information on the internet and papers, i found that some of that papers say that the PID's output is the PWM signal, and the conversion is a scalling of the control signal in order to map it to a interval that the microcontroller can understand.

So, my question is, which of them is the correct answer?

Best Answer

i found that some of that papers say that the PID's output is the PWM signal

PWM represents an analogue signal just as the output of an ADC can represent an analogue signal. So, having a PID output that is purely analogue should be the same as having the same analogue signal represented by PWM. The whole point of PWM is that the operating frequency of PWM is high enough so that the recipient analogue/mechanical system does not see it as anything other than the original analogue signal.

In other words the receipient mechanical system is so slow at responding compared to the PWM switching frequency that it doesn't respond to the up/down nature of PWM but rather it just averages things out.

Go research class D audio amplifiers if you want a comparison.