• We will be performing upgrades on the forums and server over the weekend. The forums may be unavailable multiple times for up to an hour each. Thank you for your patience and understanding as we work to make the forums even better.

Controlling a stepper motor with a PLC

Learn the NEC with Mike Holt now!

eric22

New User
Location
Boston
Occupation
Clerk
I'm trying to generate the pulses to control a NEMA 17 stepper motor with a PLC.

The motor has a driver that converts the pulse/direction signals into the correct A and B phase signals for the motor. I programmed the PLC to output a series of pulses on an output pin to move the motor. The problem is that when the motor makes a stepping motion, it makes loud noises, like it's shaking violently. Also, the motor turns a few steps in one direction and then either misses a step or two or turns a few steps in the opposite direction. I left the DIR signal as is.

I've read about acceleration and deceleration ramps to keep the motor running smoothly and initially thought this might be the problem, although the same thing happens even if I only send a pulse to the driver every second or two. So for a single step motion, there is no possible acceleration/deceleration ramp (right??).

I have tested the same stepper motor and driver with a PC controlled system (running Mach3 software) and it runs smoothly and does not produce the noise or vibration I am getting during single step movements.

Any suggestions?
 

Tommy1776

Member
Location
SC
Occupation
Industrial Electrical Maintenance, AAS, CW
Youtube search for controlling a stepper motor with a click plc
what plc are you using?
 

mikeames

Senior Member
Location
Gaithersburg MD
Occupation
Teacher - Master Electrician - 2017 NEC
The frequency of your pulses matter. I know from using Arduinos to control steppers. The duty cycle of those pulses will be your speed. Not an expert here but I have had the same issue trying to make an Arduino drive a stepper and eventually I got it to work.
 

tallgirl

Senior Member
Location
Glendale, WI
Occupation
Controls Systems firmware engineer
The frequency of your pulses matter. I know from using Arduinos to control steppers. The duty cycle of those pulses will be your speed. Not an expert here but I have had the same issue trying to make an Arduino drive a stepper and eventually I got it to work.
The frequency and duty cycle are what does it. Also, being able to control the current, which determines the torque and can reduce the amount of noise, is also important.

And yes, they can make a ton of noise and shake if it's all done wrong. If the rotor is pulled too hard to the next "step", it will have more inertia, then get pulled backward after it overshoots where it should have gone.

Not sure how many ways there are to control a PLC to do this, but I'd try shorter pulses to reduce the noise and shaking. Then ramp the frequency to accelerate the rotor.

As for using Arduinos, there are SPI protocol stepper motor development kits that are probably easier than trying to code it up with an Arduino directly.
 
Top