Internet PLC Forum

General => Technical support => Topic started by: acxysty on October 13, 2019, 01:36:30 AM

Title: Changing STEPSPEED
Post by: acxysty on October 13, 2019, 01:36:30 AM
I want to increase/decrease slowly the PPS of a stepper motor without going through acceleration/decceleration phases from/to 0. Is that possible using the STEPSPEED command ?

In different topics it is said that it is possible to modify the PPS of a stepper motor using the STEPSPEED command providing this is not done during the acceleration or decelarration phases.

By doing so is the PPS be varied 'level' by level with going down to 0 each time?

Thank you in advance



Title: Re: Changing STEPSPEED
Post by: garysdickinson on October 13, 2019, 04:23:30 PM

You will have to test this.  I have tested most of the stepper motor hardware and firmware, but have not attempted to change the PPS (step rate) of a running stepper. 

I do use the PWM outputs to generate variable frequency pulses.  The PWM outputs will change frequency while running. I have verified this with a digital oscilloscope and see that the output goes to the new frequency very "cleanly".  You could use a PWM OUPTUT to control a stepper motor and change the frequency, periodically.

The following code has been extracted from one of my products that is in production.  The code is called every 0.1 second (10 Hz rate) and changes the PWM frequency.  The code is used to simulate the output of a flow meter. The physical flow meter outputs a variable frequency signal that is proportional to the flow of fluid through the flow meter.

if (VFDCurrentHz < 5.00)
   ' Main Pump speed is too low to generate meaningful flow values
   SimProductGPM = 0.0
   SetPWM 1, 0, 1         ' 0% duty cycle so output is "OFF"
   ' The main pump is running so we will calculate flows based on VFD frequency
   SimProductGPM    = 0.0007 * VFDCurrentHz * VFDCurrentHz + 0.0194 * VFDCurrentHz + 0.7229

   ' Generate pulse output for flow.
   SetPWM 1, 5000, SimProductGPM / 60.0 * ProductPPG

Best regards,

Gary Dickinson
Title: Re: Changing STEPSPEED
Post by: acxysty on October 14, 2019, 03:19:40 AM
Hello Gary

Thank you for your answer.

I will think over you suggestion and make measurments.
I would have thought that setting a pwm to a new value would have produced a brutal change in frequency like it is the case on micro-controller.

That raises another question related to my first post : What happen when you apply a STEPSPEED command immediately followed by a STEPMOVE command while still in the middle of the previous STEPMOVE command ? According to some older posts the built-in stepper motor pulse generator will modify its parameters (frequency and number of pulse). How the frequency transition will occur ? Brutal or according to the acceleration law define by STEPSPEED ?

In advance thank you for your replies and you help !



Title: Re: Changing STEPSPEED
Post by: garysdickinson on October 14, 2019, 12:45:10 PM
Hello Thierry,

In regards to issuing a StepSpeed command during an active step move command, what I have observed is:

My testing of the StepMove statement is that it is ignored while the stepper is executing a StepMove command.  This approach will not get the behavior that you want.

The PLC stepper motor control hardware/firmware is very simplistic.  It assumes that you just need to move a stepper from one position to another.  The acceleration/de-acceleration and maximum step rate is specified before the StepMove statement executes.

The only thing that you can do while a StepMove is executing is to abort it with a StepStop statement.  This command just shuts down the stepper control system and the steps are abruptly stopped.

I do use the StepStop statement in production PLC code. I use this to stop the stepper system when a switch is closed indicating that the system is in the "home" position. However, the move statement that I use to find the "home" position has the PPS set to a very low rate and no acceleration/de-acceleration is used.

If you are really in need of a variable speed stepper based system you have only a few choices:

Best regards,

Gary Dickinson