Stepper skips steps sometimes

nuBee24

New member
Hello everyone,

I found a couple threads on different forums describing issues similar to mine, but still struggling with the problem after trying everything recommended...

Have a very simple project - NEMA 23 motor, DM556T driver and Teensy 4.1

The driver's inputs DIR+ and PUL+ connected to 3.3V pin from Teensy - I know technically the driver needs 5V but 3.3V should be enough (and seems a number of others are using 3.3V to control this driver without any issues). Also I tried to connect those pins to 5V from Teensy and it didn't change the situation, so I went back to 3.3V to be on safe side with Teensy's pins...

The test code is here:

Code:
#include <AccelStepper.h>

#define dirPin 8
#define stepPin 7
#define motorInterfaceType 1

AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);

void setup() {
  stepper.setMaxSpeed(500);
  stepper.setAcceleration(500);
  stepper.setMinPulseWidth(100);
  delay(5000);
}

void loop() {
  stepper.move(200);
  stepper.runToPosition();

  delay(1000);

  stepper.move(-200);
  stepper.runToPosition();

  delay(1000);
}

Unfortunately the motor SOMETIMES skips a couple steps - probably about once at every 10 rotations back and forth.

I tried EXACTLY the same code with the same motor and driver, but using Arduino Uno instead of Teensy - no skipped steps after 30 mins of running...

Does anyone have any ideas what to try besides of building 3.3V -> 5V converter ? Would really appreciate any recommendations, thanks !
 
I know technically the driver needs 5V but 3.3V should be enough (and seems a number of others are using 3.3V to control this driver without any issues)
If it's working than it is a lucky shot because, as you stated, the device requires 5 V.
If you look at the datasheet, figure 9:

1717591335229.png


you see that you require 5V to make the optocoupler work reliably. According to the datasheet, the minimum Logic signal current must be 7mA. With the PUL+/DIR+/ENA+ pins connected to 3V3, the optocoupler LED + 270Ω resistor will be very much on the edge of the required 7mA when grounded by the Teensy.
Best is to add external BJTs (2N3904) or FETs (FQP30N06L) in open-collector/open-drain configuration to pull the PUL-/DIR-/ENA- lines to GND and connect the PUL+/DIR+/ENA+ lines to 5V. More info here.

Also I tried to connect those pins to 5V from Teensy and it didn't change the situation, so I went back to 3.3V to be on safe side with Teensy's pins...
You have been lucky since the Teensy 4.1 pins are NOT 5V tolerant...

Paul
 
Last edited:
Yep, adding a couple transistors/resistors fixed the issue.

I just hoped for some miracle fix without additional hardware :)))
 
Back
Top