# Simplest uni-directional level shifter (3.3V -> 5V)

I want to drive a WS2801 LED strip from a Raspberry Pi GPIO.

I have connected the MOSI and CLK pins directly to drive the LED but it is not working as the WS2801 datasheet says that a high level is $0.8 \times V_{dd} = 0.8 \times 5V = 4V$ (I am guessing).

I know that there are assembled modules available on internet (such as this: 4-channel I2C-safe Bi-directional Logic Level Converter) but before buying any of these I will like to be sure that this will be the right solution to get it working so I want to purchase "simple level shifter" on any local store.

What I am looking is the simplest level shifter that shifts the voltage from 3.3V to 5V (uni-directional). By "simplest" I mean that it has the least number of components (resistors, capacitors, etc.) as possible, maybe a single IC in a DIP form so I can use it in a breadboard.

-
You never have too many of those cheap, ready-made level shifter circuits handy in your parts box for all kinds of digital circuit fiddling :) – JimmyB Sep 3 '14 at 11:38

If you are restricted to DIP packages, go for 74HCT125. The HCT family has TTL input levels (0-0.8 V low, 2-5 V high). No other components are required, other than a decoupling capacitor.

For real PCBs something smaller is suitable, like 74AHCT1G125 which is basically the same in a single-gate package.

-
I'd perhaps emphasize - The object of interest is not necessarily a level shifter. A regular 5V Buffer with appropriate input thresholds will do fine. – Dzarda Sep 3 '14 at 11:20
@Dzarda Answer updated. I did not know there were TTL compatible buffers in small packages. – venny Sep 3 '14 at 11:27
I have confirmed that the 74HCT125 is available locally so I will go for it as this solution seems the most reliable. Thanks! – soyxan Sep 3 '14 at 11:34

For electrical isolation as well as change in voltage you could use an opto coupler. eg. 4n25. They also come in dual and quad packages as well. A high on the input produces a high on the output.

-
+1 for the exquisite quality of the hand drawing on this one! – vaxquis Sep 3 '14 at 17:06
@vaxquis thank you – JIm Dearden Sep 3 '14 at 17:41

Maybe not lowest component count, but chances are that you have all parts readily available. Any general purpose low power transistor will do and resistor values aren't too critical either.

Possible disadvantage is that it acts like an open collector with R2 being the pull up resistor. This means the rising edge is determined by R2. The 3V3 output driver must be able to sink the current through both R1 and R2, in this case (5V/6k8)+((3.3V-0.6V)/2k2) = 2mA.

simulate this circuit – Schematic created using CircuitLab

Not sure where I once found the circuit.

Similar architecture can be used with a MOSFET, but you'll have a challenge finding one with sufficiently low threshold voltage.

-
Cool circuit! I've never encountered that one before, and the way the transistor is connected is pretty counter-intuitive but it works. Perfect for microcontroller output pins since they can easily sink that current, and it avoids the second transistor (or having to invert the output bit in software) that's involved in the more obvious simple level converters. – Rennex Sep 4 '14 at 1:56
Maybe you found it there? ;-) electronics.stackexchange.com/questions/82104/… Beware that there are limitations concerning input and output impedance. That should be fine for logic ICs though. – Nicolas D Nov 17 '14 at 17:02
Also, it's not energy efficient when the input is low. – Nicolas D Nov 17 '14 at 17:08

Maybe a digital buffer IC with open collector output pulled to 5V? Something like this

-

It's possible to construct something using a couple of MOSFETs. I've used this sparkfun module (https://www.sparkfun.com/products/retired/8745) which does this, although they've updated it with a more sophisticated version, which may be a better bet (they have circuit diagrams, and you can make them using through-hole components rather than the SMD they use).

If you're only going in one direction, then an ordinary transistor could do the job, although you'll have to think about the specs and design if you want to waggle the pin at high speed. Depending on how you choose to do it, you also may need to invert the signal, which is probably more hassle than it's worth.

-