Can I use I²C level shifters to power digital LED strips, more specifically, WS2812B strips?

I can only find I²C level shifters, are they ok?

  • \$\begingroup\$ I believe you mean 'I2C'? \$\endgroup\$ – Chris Fernandez Apr 12 '19 at 16:30
  • \$\begingroup\$ @ChrisFernandez, yes I do \$\endgroup\$ – Saker Alabas Apr 12 '19 at 17:03
  • \$\begingroup\$ Well hit the edit link under your question and fix it. Welcome to EE.SE! \$\endgroup\$ – Transistor Apr 12 '19 at 17:13
  • \$\begingroup\$ What voltage levels are you interfacing and from what part? \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Apr 12 '19 at 19:12

Can I use I²C level shifters to drive WS2812B Digital LED strips?

Your question could do to be clarified somewhat.

I assume that you want to interface a 3.3V MCU controller to the 5V required for the WS2812 LED strips data input.

The readily available level shifters use a single active device and are very suitable for your task.

I assume you are using something like this: enter image description here

This is the typical schematic for the level shifter:

enter image description here

These will work well for your application.
Connect LV to 3.3V, and drive the TX2_LV from your 3.3V MCU.
Connect HV to 5V, and drive the WS2812B data pin from TX2_HV.

The cost of these level shifter (10 for less than $3) makes them ideal for the hobbyist. One level shifter board will drive 4 individual LED strips.

Note: After active discussion in the comments I'll add this:

  1. It may be worthwhile to put a resistor (I'd recommend no less than 1k Ohm) in parallel with the 10k pullup on the level translator.
  2. Some recommend a series resistor in the Din line ….but from my experience all the WS2812B based LED strips already have a 33 Ohm in series with Din. In my view that is enough. Some comments on this series resistor advise it because the first pixel can be damaged by high voltage. The only way I can conceive of this happening is if the LED strip is unpowered and the MCU is powered. In this case the pullup resistor for the level shifter already acts as a series resistor, so IMO no addition series resistor is required.
    Using a series resistor for the push-pull level translators (positioned at the translator and before the TP cable actually introduces extra risetime and I don't recommend any more than 150 Ohm.
  3. Most of the strips I've bought are WS2812B based ….eventually they will all be WS2812B-V4 based. The Din pin on this unit is 12V proof so any of the fixes for the WS2812B will no longer apply. The -V4 is supposedly 3.3V compliant, so the need for level translation will I assume vanish with time.
  4. If you are driving LED strips far from the controller then you have more to worry about. If the strips are powered from different power supplies or if there is voltage drop in the ground wires this is best fixed with optical isolation of Din. I've used two opto-couplers and an SR flip-flop to provide long runs (both for PWM and Data driven LED strips.

From the comments these two links provide useful commentary (particularly the comments):

  • \$\begingroup\$ Maybe. The 10K pullup resistor may be marginal for the data rates that WS2812's are intended to run at. A bidirectional IC driver is really preferable. \$\endgroup\$ – Chris Stratton Apr 12 '19 at 18:59
  • \$\begingroup\$ @ChrisStratton You are driving a single input on the WS2812 LED strip …..there would be zero problem with the 10k pullup out to several meters. You could drop the resistor if the line length was long of course. \$\endgroup\$ – Jack Creasey Apr 12 '19 at 20:11
  • \$\begingroup\$ ANy communication channel design needs much better specs in the question to give a guaranteed solution in any answer. bit rate, cable type, grounding., length, Voltage impedance. stray noise PSU CM noise, Why guess on a level shifter and R that might be a waste of time? \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Apr 12 '19 at 21:50
  • 2
    \$\begingroup\$ FYI - happyinmotion.com/?p=1247 \$\endgroup\$ – Whiskeyjack Apr 13 '19 at 6:43
  • 1
    \$\begingroup\$ @SakerAlabas no, this is not the simplest, and it is the wrong tool for the job with a very real chance of not working. A push-pull IC driver as in Spehro's properly engineered answer will be both simpler and cheaper. \$\endgroup\$ – Chris Stratton Apr 13 '19 at 16:44

I2C is bidirectional, you don't need bidirectional level shifters for the WS2812B which uses a single-wire asynchronous protocol.

For example, 74LVCH1T45 is a suitable unidirectional level shifter that will work with a wide range of input and output voltages.

Edit: Bidirectional level shifters with discrete MOSFETs that use 10K pullups will likely cause problems- the tolerance is +/-150ns on the timing. A time constant of 150ns with 10K is the equivalent of only a few inches of wire. It will probably work with a very short wire, but become erratic or stop working with longer lengths. If you mount the level shifter right beside the first WS2812B in the chain it may be usable.

Timing requirements from the datasheet:

enter image description here

Here is a simulation of the BSS138 circuit. The red represents the minimum the WS2812B requires (timing and Vih). With a load of only 5pF and all voltages at nominal the timing is barely meeting spec typically. In any real setup this will be guaranteed to be out of spec, and if it works it will be by luck.

enter image description here

When estimating we cannot ignore the input capacitance of the WS2812B nor the significant capacitance of the BSS138 (although it's one of the lowest capacitance types that is suitable).

Of course you can, most likely, reduce the output 10K resistor or parallel it with another resistor and get it to work reliably enough for a hobby project.

  • \$\begingroup\$ I disagree. A 10k pullup is more than adequate to drive several meters of twisted pair and meet all the timing requirements. For example it adequately supports I2C at 1Mbps out to several meters. ...Though I have to agree with you that the 74LVCH1T45 is a good solution if you are designing you own PCB. \$\endgroup\$ – Jack Creasey Apr 12 '19 at 20:44
  • 1
    \$\begingroup\$ as the 74LVC family is Vol/Iol= 550mV/32mA @ 4.5V =17 ohm typ. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Apr 12 '19 at 23:37
  • 2
    \$\begingroup\$ @JackCreasey They won't come close to meeting specification (has to be 400ns +/-150ns over Vil = 0.7 Vdd) even with the 15pF input capacitance load on the 400ns pulse width and perfect input waveform. Do a simulation if you don't believe me. The bandwidth has to be much higher than 1MHz to meet spec even with no noise margin. \$\endgroup\$ – Spehro Pefhany Apr 13 '19 at 0:37
  • 1
    \$\begingroup\$ @JackCreasey See simulation. We can't ignore the MOSFET output capacitance nor the input capacitance. \$\endgroup\$ – Spehro Pefhany Apr 13 '19 at 4:38
  • 1
    \$\begingroup\$ FYI: happyinmotion.com/?p=1247 \$\endgroup\$ – Whiskeyjack Apr 13 '19 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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