3.3v-5v level converter


Using the level shifter shown I see 5V for 3.3V input and around 80mV for ground.
Assuming that’s ok (is it?) I’m trying to run some 2812 addressable leds but having no luck .

import board
import neopixel 
pixels = neopixel.NeoPixel(board.D18, 10)
pixels[0] = (255, 0, 0)
pixels[2] = (255, 255, 0)

I connect my raspi physical pin 12 (gpio18) to the level shifter and from that to the middle D0 line of the leds and bubkes. The leds are getting 5V ok and middle line is generally showing 0V (didnt try on scope) . anyone with some clues?
For instance is setting the correct length of strip (10 in the code above) mandatory? My strip is rolled up and I have no idea how many leds there actually are…

Please give a full schematic and I have a look and give you a schematic review.


You can set the number of LEDs smaller than the real number and only that number will light. I don’t see any reason why setting it to larger would fail, it’s a timing/shift register based protocol, but I’ve never tried it.

I’ve found a decoupling cap across the LED power at the start of the strip has helped stability for me before.

I’m not familiar with the library you are using (I’m using FastLed over C++ on Arduino,) but don’t you have to flush the array onto the led strip at some point?

‫בתאריך יום ו׳, 1 בנוב׳ 2019 ב-1:19 מאת ‪Duncan via T.A.M.I.‬‏ <‪noreply@discourse.telavivmakers.org‬‏>:‬

removing the 3.3v - 5v ckt allowed the lights on albeit limpingly - and the data line got pretty hot physically …
i’ll try the cap and a different 3.3v-5v ckt but have hit another limitation namely that the neopixel library seems to require the same pwm that runs the raspi audio , so i cant have audio and leds at once … ronen does the fastled lib require pwm , and will it run on a raspi ? I dont really need fast leds.

I have no idea.

‫בתאריך יום ו׳, 1 בנוב׳ 2019 ב-15:11 מאת ‪jeremy rutman via T.A.M.I.‬‏ <‪noreply@discourse.telavivmakers.org‬‏>:‬

For running the leds from raspi I used a shelf level shifter, lowering LED supply voltage with diode also worked, Elad also sent a sacrificial pixel method that would save heat on the diode.

To get audio and pwm at same time apparently the hdmi audio output can be used , this requires e.g. hdmi-vga cable with separate audio breakout .

BTW to monitor/control the wifi-lan connected pi from the net I used this , it was easy to get going and allows ssh from anywhere. You can also do that on your own with reverse tunneling but will need an always-accessible server

i am running a low side switch with the 3.3V gpio output of the pi, and for the particular transistor i’m using (irf520 ) the 3.3V is barely enough to turn on - is there some clever positive feedback i can use to force the transistor ‘very on’ when on and off when off?

How abt this, I put the gpio into high-impedance input mode to turn transistor on, and set output=0 to turn transistor off. current into gpio pin when output=0 is 1.2mA which i suppose is ok.

Here’s the GPIO pin from raspi:


If you use a diode, you drop .2 or so volts, which will probably mean it doesn’t turn on at all. If suggest using a higher gain transistor if possible. Possibly drop the base resistor if you’re using one.

i added a figure with new idea, putting gpio pin into input mode to turn on and output mode @0V to turn off, do you think this will fly?
Will 12V thru 10Kohm into a GPIO input be all right?

replace the transistor with a “logic-level mosfet” - google to find some options, or parametrically search in Digikey for low one with a sufficiently low Vth. there are plenty - depending on how large a current you need to switch and how fast you need to turn it on and off (PWM?).

another option is to use two transistors - one turns on another. The drain of the pi-connected mosfet goes to the gate of the next one, and also this net is connected with a resistor to whatever high voltage that you have in the system. That higher voltage must not be over the max gate voltage of the second transistor. Also note that your command signal is now inverted compared to before.

ok yes i know i can use another transistor or darlington.
I was actually curious in theory if the above idea would work (gpio as output 0V for transistor off, as input for transistor on @6V)

from here : “A GPIO pin should never be connected to a voltage source greater than 3.3V as prompt damage to the chip may occur as the input pin substrate diodes conduct. There may be times when you may need to connect them to out-of-range voltages – in those cases the input pin current must be limited by an external resistor to a value that prevents harm to the chip. I recommend that you never source or sink more than 0.5 mA into an input pin”