Hello Guest it is May 23, 2019, 03:39:56 PM

Author Topic: PWM Questions  (Read 7972 times)

0 Members and 1 Guest are viewing this topic.

PWM Questions
« on: December 31, 2009, 11:59:23 AM »
I'm trying to figure out some specifics about the PWM output.  No luck on the forum, so maybe this could be a reference for others.

Questions:

1.  Is there a set pulse rate for the PWM?  If so, what is it?  Or, does it change if you change the Kernel Speed?

2.  If I set Pulley #1 to 0-100, does that mean that I can vary the PWM by using S0 - S100 in a G-Code line?

3.  If I set the PWM Base Frequency at 500, that is a divisor into the the Kernel Speed.  So, if Kernel Speed is 25000, the I have 25000 / 500 = 50 possible speeds.  What are the ins / outs of setting the Frequency higher or lower.  That is, if I set this at 10 do I get smoother output?  Why would I set this higher or lower?


My guesses at the moment are:  1.  No clue  2. Sounds right but I don't think it actually works that way  3.  I think too small will make it jumpy
Re: PWM Questions
« Reply #1 on: December 31, 2009, 12:08:28 PM »
1) PWM base frequency is set in Config->Ports&Pins->SpindleSetup.  The PWM output gets updated at the kernel rate.

2) Yes,

3) There is nothing to be gained by setting a high base frequency for the PWM.  5-10Hz is pretty typical.

Regards,
Ray L.
Regards,
Ray L.
Re: PWM Questions
« Reply #2 on: December 31, 2009, 07:10:48 PM »
I'm trying to figure out some specifics about the PWM output.  No luck on the forum, so maybe this could be a reference for others.

Questions:

1.  Is there a set pulse rate for the PWM?  If so, what is it?  Or, does it change if you change the Kernel Speed?

2.  If I set Pulley #1 to 0-100, does that mean that I can vary the PWM by using S0 - S100 in a G-Code line?

3.  If I set the PWM Base Frequency at 500, that is a divisor into the the Kernel Speed.  So, if Kernel Speed is 25000, the I have 25000 / 500 = 50 possible speeds.  What are the ins / outs of setting the Frequency higher or lower.  That is, if I set this at 10 do I get smoother output?  Why would I set this higher or lower?


My guesses at the moment are:  1.  No clue  2. Sounds right but I don't think it actually works that way  3.  I think too small will make it jumpy

1. The base frequency and the kernel speed determine the resolution of the PWM output. The resolution is the number of PWM steps you have between 0 rpm and your maximum speed.

The resolution is determined by kernel Speed/PWM base frequency. So;

For Kernel speed of say 25KHz and a PWM base frequency of say 10Hz you end up with,

25000/10 = 2500 steps. If you have a PWM base frequency of say 100Hz then you get;
25000/100 = 250 steps.

If you have a spindle maximum speed of say 10,000rpm, then the resolution will be
4 rpm per step for the 1st example, 10000/2500 = 4. for the 2nd it will be 40rpm per step.
10000/250 = 40.

The higher you set the PWM frequency, the lower the resolution you can achieve. That said, an open loop speed control would be hard pressed to use a resolution of 4 rpm.

From a practical point of view I recommend a base frequency of 50hz. I provides good response and seems to be less affected by electrical noise.

2. The PWM output is a mark/space waveform calculated as a % of the maximum spindle speed. So if you set the max pulley speed to 1000, then the PWM output ratio is calculated as;  PWM = Speed/Max Pulley Speed  * 100. So if you set speed to 300rpm by S300  the PWM ratio will be
300/1000 *100 = 30%

3. I have found that a higher base PWM frequency, gives better noise protection.
    If you have a low base frequency, you need more filtering to keep the output ripple down.
   


Cheers,


Peter.





----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: PWM Questions
« Reply #3 on: December 22, 2016, 12:29:50 PM »
I have a different problem. My PWM output is getting affected by mouse movement and screen selection. If on the MDI screen and I move the mouse i get near perfect square wave output at the programed rate. I stop moving the mouse and the output becomes very jerky. Also if I select the jog screen the jerkiness is more pronounced, still affected by mouse movement but square wave output is not as good as MDI.
I have tried different frequencies settings as recommended but all get affected in a similar manner. I also tried a different mouse USB and PS2.