User: eric22, Location: Boston
Asked on: Saturday, December 7, 2024 at 3:39 am EST
Answered on: Thursday, March 6, 2025 at 6:00 am EST
Question: 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?
Okay, let's troubleshoot this stepper motor noise and erratic movement issue with your PLC-controlled system. You've already done some good preliminary checks, but let's dig deeper.1. Double-Check Basic Wiring and Settings
DIR (Direction) Signal Integrity
You mentioned leaving the DIR signal as is. This is a critical point. How are you leaving it? It needs to be a stable, clean signal. If it's floating, susceptible to noise, or has a slow rise/fall time, it can cause the erratic behavior you're seeing.
PLC DIR Output Configuration
Make sure the PLC output used for DIR is configured correctly (e.g., as a digital output, not an analog or PWM output).
Pull-Up/Pull-Down Resistors
Depending on your driver and PLC configuration, you may need a pull-up or pull-down resistor on the DIR signal to ensure a defined logic level when the PLC output is "off." A 4.7kΩ to 10kΩ resistor to either VCC or GND is a common starting point. Consult your driver's manual for the recommended configuration.
Signal Coupling
Insure that the signal wires for PUL and DIR signals are properly connected to the PLC's and stepper driver's signal ports. Also ensure that a common GND is connected between PLC and stepper driver circuit.
STEP (Pulse) Signal Wiring
Ensure that the signal wires for the PUL and DIR signals are properly shielded, and that the ground (GND) connections are secure.
Driver Configuration
Microstepping
What microstepping setting are you using on the driver (e.g., full step, half step, 1/4 step, 1/8 step)? High microstepping can make a motor run smoother, but requires a proportionally higher pulse frequency for the same RPM. Try a lower microstepping setting (e.g., 1/2 or 1/4 step) for initial testing.
Motor Current
Verify the motor current setting on the driver. Is it correctly matched to your NEMA 17 motor's specifications? Too low current will result in torque loss and missed steps. Too much current can overheat the motor.
Driver Enable/Disable (if applicable)
Some drivers have an enable/disable input. Make sure it's properly enabled during operation.
Power Supply
Voltage
Ensure your power supply voltage is within the stepper driver's acceptable range and is appropriate for your motor.
Current Capacity
The power supply must be able to provide enough current for the motor under load. A low voltage can cause the motor to be underpowered and produce erratic movements.
2. PLC Programming Issues
Pulse Width/Duty Cycle
The pulse width (the "on" time) and duty cycle of your STEP signal are critical. The driver needs a minimum pulse width to reliably register a step. Consult your driver's datasheet for the required pulse width and polarity (active high or active low). The PLC's cycle time might have an effect on the duration of the pulse.
Timing Between DIR Change and First STEP Pulse
Crucially, you need to allow a settling time after changing the DIR signal before sending the first STEP pulse in the new direction. This is often called the "DIR setup time" or "DIR hold time." The stepper driver data sheet will specify the minimum delay. A typical value is 5-10 microseconds.
PLC Scan Cycle/Interrupts
Understand how your PLC's scan cycle affects the timing of your pulses. If the PLC scan is slow or unpredictable, it can introduce jitter in your pulses, leading to jerky motion. If possible, use a high-speed counter or interrupt routine to generate the STEP pulses more precisely.
Code Structure
Simplify your PLC code for initial testing. Create a very basic program that only does the following:1. Set DIR high (or low, depending on your wiring).
2. Wait for a specified settling time (e.g., 10 microseconds).3. Send a single STEP pulse (of the correct width).
4. Wait for a longer period (e.g., 1 second).5. Repeat from step 1.This allows you to isolate the basic pulse generation and timing.
3. Noise and Interference
Electrical Noise
Stepper motors are inherently noisy electrically.
Shielding
Use shielded cables for all connections between the PLC, driver, and motor.
Grounding
Ensure proper grounding of all components to a common ground point. Avoid ground loops.
Filtering
Consider adding low-pass filters (small capacitors) to the STEP and DIR inputs of the driver to filter out high-frequency noise. Consult the driver's datasheet.
Mechanical Resonance
Sometimes, the mechanical system (motor, load, mounting) can resonate at a particular frequency, causing vibrations and noise. This is more likely at certain speeds. Changing the motor speed, microstepping, or adding damping to the system can help.
4. Testing and Debugging Steps
Oscilloscope
If possible, use an oscilloscope to examine the STEP and DIR signals directly at the driver's inputs. This will allow you to: Verify the pulse width and frequency. Measure the rise/fall times of the signals. Check for noise and glitches. Confirm the DIR setup time.
Simplify the Setup
Disconnect the load from the motor shaft. Does the problem persist? This will help determine if the load is contributing to the issue.
Compare to Mach3
You have a working Mach3 setup. Carefully compare the pulse characteristics (frequency, pulse width, polarity) of the Mach3 signal to what your PLC is generating. This is a crucial step in identifying differences.
5. Specific Questions to Answer: What is the exact model number of your PLC and stepper motor driver? What is the rated voltage and current of your NEMA 17 motor? What is the voltage and current rating of your power supply? What microstepping setting are you using on the driver? What is the pulse width you're using in your PLC program? Can you share the relevant snippets of your PLC code that generate the STEP pulses and control the DIR signal?By systematically addressing these points, you should be able to isolate the cause of the motor's erratic behavior and noise. Good luck! Flag for review