Need help with level shifting board (going 3.3v to 5v)

Hi-

My project is using a Teensy 4.1 and I need to control a stepper using a DM556T driver with the Accelstepper library. I think the DM556 needs 5V for the control pins but Teensy 4.1 only outputs 3.3v on digital pins.

I tested the setup below on an ARDUINO MEGA and the TEENSY 4.1 and it works perfectly on the MEGA but it does not on TEENSY..

..so I purchased these level shifter boards - I will get them Saturday.

This is the setup I used for testing. (works on Arduino Mega but not on Teensy 4.1)

STEPPER WIRING:

DIR+ and PUL+ connected to 5V
DIR- to pin 2
PUL- to pin 3

CODE:

// Include the AccelStepper library:
#include <AccelStepper.h>

// Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver:
#define dirPin 2
#define stepPin 3
#define motorInterfaceType 1

// Create a new instance of the AccelStepper class:
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);

void setup() {
  // Set the maximum speed and acceleration:
  stepper.setMaxSpeed(1000);
  stepper.setAcceleration(500);
}

void loop() {
  // Set the target position:
  stepper.moveTo(8000);
  // Run to target position with set speed and acceleration/deceleration:
  stepper.runToPosition();

  delay(1000);

  // Move back to zero:
  stepper.moveTo(0);
  stepper.runToPosition();

  delay(1000);
}

So while waiting for the level shifting boards, I'm planning how to wire it to the DM556T driver.

Would you mind looking at the diagram and see if that will work? I may have something wrong in there, I never used level shifting boards/chips before.

Thanks for looking!

When compared with the following figure, I see your connection meaningful.

1 Like

Ok thanks very much! I think you mean that the wiring should work, I'll try this when I get the boards.

Adding this line in the setup fixed it without any level shifting board.

stepper.setMinPulseWidth(10);

I assume this would happen on the DUE since logic is also 3.3v.

Thanks to Mark T on the Teensy forum. He's the one who found it.

Here's the thread to close this - there's more info there on how the solution came.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.