2
$\begingroup$

I need a digital output from a raspberry to power a stepper driver that takes 5v as input. After that, the output from the stepper driver must be converted back to 3.3V because a Pi can't handle 5v on the GND-pins.

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

But since it is I2C-safe, im not sure if it will allow being turned into 5V because the "master" only handles 3.3V?

$\endgroup$
2
  • 1
    $\begingroup$ "... the output from the stepper driver must be converted back to 3.3V because a Pi can't handle 5v on the GND-pins." The +5 V line would never be connected directly to ground. That would be a short circuit. "Can a level shifter convert power from 3.3 V to 5 V ...?" Level shifters don't convert power, they alter logic signal voltage levels. Can you edit to clarify. $\endgroup$
    – Transistor
    Feb 10, 2021 at 21:32
  • $\begingroup$ The level shifter you have is bi-directional. Your concerns should not be an issue. Based on your other post, I don't se any I2C requirements. At a quick glance the controller doesn't seem to have signal sent back to the Raspberry Pi. I could be wrong. Respond to my question posted on your other question. Then we can better help you. $\endgroup$ Feb 11, 2021 at 2:18

1 Answer 1

0
$\begingroup$

The pi does not "handle" voltages on the ground pins, ground is just ground. The pi, the driver and the level shifter must all have common ground for communication to work.

For you application:

  • Connect the shifter GND to the pi GND and to the GND pin on your driver.

If the driver has separate grounds for signals and power, use the signal GND.

  • Connect 3.3v to the LV-pin, the pi has a 3.3v output.
  • Connect 5v to the HV-pin, this can come from either you pi or driver, it's just a reference.
  • Connect the signal pins from the pi to the A-pins on the shifter.
  • Connect the signal pins from the driver to the B-pins on the shifter.

Power everything up and have fun with your project :)

EDIT:

To answer the question in the title. The level shifter will not convert power in the sense that you can input 3.3v and output 5v to power something with the 5v. It will "translate"/change the voltages of the signals you connect to A and B.

It has a low voltage side (A) and a high voltage side (B). If you send a signal to A1 at the A side voltage the same signal will be output at B1 but at the B side voltage. This shifter is bidirectional so inputting B level signals at the B pins will output the same signals at A level on the A pins.

The A level is set by what you input on the LV-pin and the B level on the HV-pin. The LV and HV voltages can come from anywhere, but you need to supply both. Since the pi has both it's probably easiest to take them both from the pi.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you! The hint i needed was that the Level shifter needed a 3v and 5v input. So i just connected the steady 3v (pin 1) and 5v (pin 4) output gpio's from the Pi to the LV and HV input on the level shifter. After that it worked perfectly. $\endgroup$
    – Nlas
    Feb 11, 2021 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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