It is my understanding that a Rasperry Pi cant handle 5V on the GND-pin. For that reason I got myself a level-shifter which is supposed to be able to change the output from 3.3V to 5V. I need it to be 5V because that's what the stepper driver operates on.
I don't know if the 5v-output is programmable or if its just a steady stream of power. If it's programmable i assume i could plug pin2 directly into the stepper driver and send it back through the level shifter making it 3.3v that i can connect to a GND-pin.
The connection from the stepper driver to the motor should be fine.
This is the code im using trying to activate the stepper driver
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library from time import sleep # Import the sleep function from the time module GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BOARD) # Use physical pin numbering GPIO.setup(3, GPIO.OUT, initial=GPIO.LOW) # Set pin 3 to be an output pin and set initial value to low (off) for x in range(0,100): GPIO.output(3, GPIO.HIGH) # Turn on sleep(0.1) # Sleep for 0.1 second GPIO.output(3, GPIO.LOW) # Turn off sleep(0.1) # Sleep for 1 second
Stepper driver: Hybrid Servo Drive HB860H Datasheet