2

Sorry if this is a silly 'beginner' question, but I'm still only just getting into working with the Pi.

I have a Pi Zero that I want to use to drive a module of a few WS2812 LEDs. Because the GPIO pins output is 3.3V, and the module input is 5V, I'm using a Sparkfun bi-directional logic level shifter to step the voltage up. My question is this: If I wire from the GPIO pin to the level shifter on the LV side, then the HV side of the level shifter to the LED module's data line, does the ground for the data line need to run back the level shifter (HV to LV) then to the Pi? Or can I simply wire the module's DIN ground directly back to a GND pin on the Pi? Or is something about my intended wiring plan completely off, and I need to rethink the whole thing?

I'm pretty vague on how all this will look in the end so either solution works for me, I just want to make sure I don't accidentally fry any of the components.

1

2 Answers 2

1

I think you will find that the grounds are already connected in the level shifter so it will not matter.

You DO NEED to connect the grounds to the converter AND the Pi AND the LED strip.

This is a prototype I made earlier. As there are only 5 LED the 5V is derived from the Pi, but a more realistic use would have an external 5V supply.

This is a prototype I made earlier

1
  • Not sure I follow. Does this mean that I can ignore the data GND on the module? And if not, where should it be connected to?
    – Xono
    Oct 26, 2018 at 4:13
1

GND - the ground - is to be connect to all components here: the Pi and its power supply as well as the LED strip and its respective power supply. It is the common reference point in your electrical circuit. Without it there is no meaning to the voltage levels with respect to each other. Expect the GND of the "data line" of the LED module to be connected to the GND of the power connector of the LED module.

With this level shifter you are expected to connect the Pi's GND and the Pi's 3V3 (from the "GPIO" header) to GND and LV of the level shifter; and the LED's GND and supply voltage (5V) to GND and HV of the level shifter. See level shifter's schematics; taken from there:

enter image description here

Note that GND of the level shifter (on the LV side and the HV side of the board) are connected. Which you can tell from the bottom side of the printed circuit board (source), both GND pins are connected to the ground plane:

enter image description here

Note that in electrical circuits and their respective schematics it is common sense that a thing with the same name (e.g. GND) is expected to be the same thing everywhere in the circuit - it is on the same net and thus connected. This is true for nodes and component terminals. A nice read on that matter.

See also: Sparkfun's hookup guide on how to connect and use the level shifter - quite a hands-on guide and worth a read.

2
  • This was a great answer, kudos. I'm still missing a little bit: what are the ramifications of connecting grounds? For example I have a 3.3V ESP32 and a 5V UART for controlling an air conditioner. Can anything go wrong connecting the grounds? I'm considering using a TXB0102 (I know I don't need bidirectional, but it doesn't hurt).
    – NateS
    Aug 22, 2022 at 1:39
  • 1
    @NateS thanks. There is always the risk of ground loops (see here: electronics.stackexchange.com/questions/192550/… ) that might trouble digital communication too. Feel free to post a new question on the topic here or on EE.SE
    – Ghanima
    Aug 23, 2022 at 8:15

Your Answer

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

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