3.3v Logic to drive LED strip Data Signal

In this post, I will be showing you my step up design to drive the data signal on a WS2812b LED strip. If you are using a different strip, please refer to the datasheet so you know what voltage you will need.

I needed this because I have an Arduino Nano 33 IoT that puts out 3.3v logic signals at a maximum of 10mA and is NOT 5v tolerant. I needed a way to drive the data signal to 5v. (see my other post about driving a P-channel MOSFET here My P-Channel MOSFET Driver)

What you'll need:

  • 2x 2N3904 (NPN BJT's)
  • 1x 10k Ohm, 1x 4.7k Ohm, and 1x 330 Ohm resistors
  • Arduino using 3.3v Logic

The first NPN BJT amplifies a little, but what it's really there for is to invert the signal and reduce drain on the Arduino since can't draw very much. The second one does most of the amplifying and driving but it returns the signal to high is on and low is off. The first transistor is on if the signal is high and turns off when the signal is off. This pulls the gate of the second one low, turning off the transistor. Current then flows through R2 and the signal is transmitted to data out at 5v.

Alternatively, when the first transistor gets pulled low, the transistor turns off. This turns on the second transistor because current now flows through R1 and opens the gate. This draws the current away from the data line.

Beware though. If you need to drive more current than the 4.7k resistor can supply, you can lower the value. The 3904 is rated for a max of 200mA IIRC, so dont go below 25 Ohms. I wouldn't recommend anything below 220 though as in my project, unless I drove these gates from the output of my MOSFET.

I think I would have just used 1 gate of 74AHCT08N and a 0.1uF cap on the VCC to GND pin.
https://www.digikey.com/en/products/detail/texas-instruments/SN74AHCT08N/375969
Can accept a HIGH IN as low as 2V to make a 5V HIGH OUT.
8mA output drive current is plenty for a WS2812B data line.

Yes, I could have for sure. But I'd rather use the '08N for if I had 3 or 4 bidirectional channels I needed. Since I only need 1 for my purposes, source this component would be costly and overkill. 48c compared to a mere 15 cents adds up over enough projects. You can get a pack of 200 2n3904s for 5.80 USD, so that's 3 cents a transistor. Resistors are even cheaper.

Also, the 2n3904 can source 200ma, which means we dont really have to worry about the peak current flow from the gate of the mosfet as we would with the 8ma rating of the '08N. Wed need a limiting resistor with the IC since the gate of a mosfet is essentially a capacitor.