James Langeford
Posts: 1
Joined: Sat Nov 30, 2019 12:18 am

Does the Raspberry Pi 2 is able to drive the DM542T stepper driver

Sun Dec 29, 2019 10:27 pm

I have been trying to use the DM542T to drive my NEMA 23 motor. When I hook up the GPIOs with the stepper motor driver, The motor is not turning at all. I've checked that the power is on. Furthermore, I used the same connections/set up with the Arduino and the motor spin. However, when I switch those connection to GPIOs of the Raspberry Pi, nothing works and I'm confuse as to why. From the way I understand it, the stepper motor driver only need 5V bias on PUL+ and DIR+, then I pull the PUL- high and low repeatedly to spin the motor. The same strategy works in Arduino but not in the Pi. Also, I check my PUL- pin with an LED to make sure that it is giving out output with my code, and sure enough, the LED works. I'm currently sitting at a lost right now.

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Does the Raspberry Pi 2 is able to drive the DM542T stepper driver

Sat Jan 04, 2020 7:41 am

Arduino outputs are 0-5v while rpi is only 0-3.3v. Maybe it s the reason?
You should check with the driver if 3.3v is accepted, else you can increase output voltage with a voltage translator ic.

Else I see no reason why the pi can t drive it.

pcmanbob
Posts: 11151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Does the Raspberry Pi 2 is able to drive the DM542T stepper driver

Sat Jan 04, 2020 10:30 am

Hi.

The DM542T requires a 5V supply to operate its control inputs it clearly states that on the controller, to drive the controller inputs from the pi 3.3V gpio you need to add a transistor driver circuit for each input.

https://www.omc-stepperonline.com/downl ... VCuJj7MUIp

like this

Image
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

randyrtx
Posts: 1
Joined: Wed Mar 25, 2020 1:11 am

Re: Does the Raspberry Pi 2 is able to drive the DM542T stepper driver

Wed Apr 08, 2020 3:12 am

Thank you for this..It took me a bit to realize when you go hi out the Pi output you are really giving it a low to the controller.

So this is my "hello world" version of the code necessary to talk to the motor. spins right then spins left based on how many times and speed (enter 1 - 100)


Code: Select all

#!/usr/bin/python3

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)

on = GPIO.HIGH
off = GPIO.LOW


pul = 16
dir = 20
ena = 21


GPIO.setup(pul,GPIO.OUT)
GPIO.setup(dir,GPIO.OUT)
GPIO.setup(ena,GPIO.OUT)

GPIO.output(dir,off)
GPIO.output(pul,off)
GPIO.output(ena,on)
time.sleep(.0001)
GPIO.output(ena,off)
time.sleep(.0001)


def moveright(rotate):
    for i in range(rotate):
      GPIO.output(pul,on)
      time.sleep(.001/int(speed))
      GPIO.output(pul,off)
      time.sleep(.001/int(speed))

def moveleft(rotate):
    GPIO.output(dir,on)
    time.sleep(.0001)
    for i in range(rotate):
      GPIO.output(pul,on)
      time.sleep(.001/int(speed))
      GPIO.output(pul,off)
      time.sleep(.001/int(speed))



howmany = input("Please enter how many times to steps: ")
print("You entered: " + howmany)


speed = input("Please enter how fast to step: ")
print("You entered: " + speed)




moveright(int(howmany))
time.sleep(.0001)
moveleft(int(howmany))

GPIO.cleanup()

pcmanbob
Posts: 11151
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Does the Raspberry Pi 2 is able to drive the DM542T stepper driver

Wed Apr 08, 2020 10:59 am

randyrtx wrote:
Wed Apr 08, 2020 3:12 am
Thank you for this..It took me a bit to realize when you go hi out the Pi output you are really giving it a low to the controller.
That's not quite right,

when you output a high on the gpio pin , you turn the transistor on , which provides a ground to the LED on the selected input.

then then turns on the opto isolator in the controller.

So the high output on the gpio results in a high input to the controller , its just that you are switching a ground to achieve this.

Glad you got it all working, many people seem to struggle with this type of controller.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”