How control signal drive PWM ???


Thread Starter


Hi friends...
I have a problem to drive PWM for controlling DC motor using PLC.
Now, I have signal control u... Then how the value of signal control change the duty cycle in PWM. Please give me the algorithm about it and some example !!!

Thanks alot

Michael Griffin

The first thing you need to do is to figure out a few things.

1) Do you have a PLC yet? If so, does it have a PWM output? What model is it?

2) What PWM frequency do you need?

3) If you are sending a control signal through a PWM controller, is the signal normal or inverted? Is there a base speed? What is the
valid signal range (e.g. 0% to 100%, or 10% to 90%, etc.)?

At present, you haven't given enough information about the application to really give a meaningful answer.
How you plan to control DC motor with PWM from PLC? What you need control - current (torque), velocity, position?
I have a Siemens PLC S7 200 series. I don't work in PWM mode, but I try with high speed counter.

This program in STL:

Network 1
LDN M0.0
TON T32, +100

Network 2
LDW>= T32, VW50
= Q1.0

Network 3
LD T32
= M0.0

For example if the value of VD50 = +40, so PWM--> 60 on and 40 off.

Base speed about 70% duty cycle.
I have the algorithm to get control signal:
c1(k-1)= - sigma from i=0 to i=k-1 {e(i)y(i)
c2(k-1)= - sigma from i=0 to i=k-1 {e(i)y'(i)
c3(k-1)= - sigma from i=0 to i=k-1 {e(i)r(i)

This Algorithm is applied on PLC Siemens S7200 in STL. And this result has U always decreasing...
My problem is how to drive PWM from U (control signal). It means how to make the duty cycle value from U.


Michael Griffin

You need to "normalise" the control signal value. That is, you need to scale it to whatever range it is you are working in. So you need to ask yourself, what are the maximum and minimum valid values of "u"?

If for example valid values of "u" can be between -500 and +500, you need to rescale this to the range your timer is operating in (0 to 100 in your example). E.g. for the above numbers, you would add 500 and divide by 10 to scale +/-500 into the range of 0 to 100.

If you need to invert the signal, then subtract the result from the maximum normalised value (100 in the above example). E.g. 100 - 60 = 40.

This is just y = mx + b, where you know "m" and "b" and are solving for new "x" and "y" values for the two end points of the new range. Draw the two lines on a graph, and it should become obvious.