0
$\begingroup$

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.

enter image description here

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: http://sahel.rs/media/sah/techdocs/hb860h_manual.pdf

Level shifter: https://www.spikenzielabs.com/Catalog/adafruit/breakouts/4-channel-i2c-safe-bi-directional-logic-level-converter-bss138

$\endgroup$
5
  • $\begingroup$ Can you share the schematics for your raspberry pi board, data sheet for the level shifter and stepper driver? $\endgroup$ – Mahendra Gunawardena Feb 10 at 19:27
  • $\begingroup$ Im not sure what you mean by schematics, but if I understand correctly, the schematics for the Raspberry Pi is what you can see in upper photo on the left. For the level converter and stepper controller i can sadly only give you the links (added them above). I found out that the level shifter seems to only give me 3,3v on the high voltage side. Can it be due to it being I2C? $\endgroup$ – Nlas Feb 10 at 19:43
  • $\begingroup$ There are many versions of Raspberry Pi. Here is the link raspberrypi products. It is worth while tell us more about the hardware. $\endgroup$ – Mahendra Gunawardena Feb 10 at 23:37
  • $\begingroup$ What is actually your question: if you can connect without the lever shifter? or you have a problem in the software and it is not working? $\endgroup$ – Adrian Maire Feb 11 at 10:41
  • $\begingroup$ The 5V is not programmable. It's a direct connection to the raspberry pi power rail. $\endgroup$ – Drew Feb 12 at 8:32
0
$\begingroup$

The GND of the stepper motor, the GND of the level shifter and the GND of the raspberry pi GPIO needs to be connected together. Your diagram seems correct.

As 3.3V and 5V are quite similar, you "could" output GPIO to the stepper motor and it will most probably work. However as 3.3V is close to the shifting level of 5V digital electronic, you will experience issues with noises and eventually weird startup problems. I suggest you to keep the level shifter in middle.

I don't see the GPIO_5 setup. I am not aware of the internal implementation of the stepper driver neither the level shifter, but, be sure that a high-impedance input for "Dir+" can cause malfunction.

Also, driving the level-up and level-down by software will only work at low speed: Rapsberry pi (and any modern computer) has operating system multi-tasking, memory cache failures, etc. which causes the software to not run timely. Jitter of Raspberry pi is commonly over 1ms, which, for driving a stepper motor will become a problem. This is an other problem, but keep it in mind.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.