8

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.

Ricardo
  • 6,134
  • 19
  • 52
  • 85
soyxan
  • 83
  • 1
  • 1
  • 3
  • 3
    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 03 '14 at 11:38

5 Answers5

8

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.

schematic

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.

jippie
  • 33,033
  • 16
  • 93
  • 160
  • 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 04 '14 at 01:56
  • 1
    Maybe you found it there? ;-) http://electronics.stackexchange.com/questions/82104/single-transistor-level-up-shifter 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
6

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.

Peter Mortensen
  • 1,676
  • 3
  • 17
  • 23
venny
  • 3,058
  • 13
  • 16
  • 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 03 '14 at 11:20
  • @Dzarda Answer updated. I did not know there were TTL compatible buffers in small packages. – venny Sep 03 '14 at 11:27
  • 1
    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 03 '14 at 11:34
6

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.

enter image description here

JIm Dearden
  • 18,926
  • 30
  • 40
  • +1 for the exquisite quality of the hand drawing on this one! –  Sep 03 '14 at 17:06
  • A 4N25 cannot do 800kHz. It has 2us Turn-On time and 800kHz is 1,25us per bit. I tried it before reading the datasheet..... – Hasse Jun 26 '23 at 12:51
1

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

1

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.

Ralph Bolton
  • 277
  • 1
  • 4