# Could a resistor work as well as a signal diode in this level-shifting circuit?

The following hackish circuit uses the internal circuitry of one "sacrificial" WS2811 LED to level up the logic voltage to 5V for the remaining strip by placing a signal diode in series with the power supply input of that first WS2811 circuit.

Since all we're trying to do is drop the voltage by 0.7V, could we conceivably have found a resistor to be used in place of the diode to drop the voltage by a comparable amount? If so, are there any considerations that make the diode the better choice? If not, why not?

(I'm sure that to veterans this very question exposes a deep lack of understanding of electronic basics on my part. You probably don't need to point that out - I'm here to learn.)

• The WS2812 uses a 1.3V threshold like 74HCTxx logic so there is no need to increase the "1" voltage Commented Dec 11, 2019 at 5:37
• @TonyStewartSunnyskyguyEE75 no, it has CMOS levels 0.3 and 0.7 VCC cdn-shop.adafruit.com/datasheets/WS2812.pdf second table on page3 WS2811 is the same. Commented Dec 11, 2019 at 8:29

I don't think so. For one thing, the WS2812 chip receiving 3.3V data may actually work. It may not be reliable, but you can't count on the LED's to stay off nor on or in any consistent state.

So then if the first chip changes output state of its LED's, then the supply current will also change. If the supply current changes, then the current through the diode will change. If you substitute a resistor instead of a diode, with the potentially non-constant current, you won't get the voltage drop you are trying to get. You will get a variable voltage drop that depends on the state of the LED's in the first chip. Also, these chips have internal switching. This means that even if the LED's are in a consistent state, the current will not be constant. So, all around, it is not a good idea to try to use a resistor.

In my opinion this circuit is really crappy. I would suggest you use a level shifting buffer if you want reliable operation. The sacrificial LED makes no sense to me.

• yeah, it only takes a logic level mosfet and a resistor to level shift (nxp.com/docs/en/application-note/AN10441.pdf) that seems better than a buffer pixel. Commented Dec 11, 2019 at 8:35
• @Jasen for these three wire RGB LED interfaces, that might not be sufficient and fast enough. But there are buffers that can do the job. Commented Dec 11, 2019 at 15:28
• presumably that works for high speed I2c at 3.2 up-to Mbit/s WS2812 is only 0.9Mbit/s, WS2812 has 15pF input capacitance, so a 4.7K pull-up resistor should be fine, add a ferite bead in series if you want extra speed. that app note is the same circuit as the logic level shifter sold by adafruit. Commented Dec 12, 2019 at 2:06
• The WS2812 uses the pulse width to determine if the data is a zero or a one. It is pretty important to avoid using a circuit that will distort the pulse width. I would not feel comfortable using an open-collector driver because my fear is that the asymmetrical rise and fall times will not faithfully reproduce the correct pulse widths. Commented Dec 12, 2019 at 8:36
• I have used a level shifting circuit like @Jasen suggests for logic level interchange between 5V and 3.3 (eg: Arduino to ESP8266) but for WS2812 I think the waveshape would be too mangled. Commented Dec 20, 2019 at 20:19

A resistor might work under some conditions, but it is a poor choice because the voltage drop across it depends on the current being drawn-- and you have to know the expected current draw. The diode provides a roughly fixed voltage drop (depends on diode type, but typical silicon diode is about 0.6-0.7V).

If you use a resistor, the behavior might change when the LED is set to different brightness level.

The MOSFET level shifters, at least the cheap ones people get on Amazon, reportedly don't do a good job at the 800kHz required for the LED signals (the one listed in the comment above says it's only good for a 400kHz I2C bus, so probably not recommended). A decent level shifter (e.g. TXS0108E) should work but is more complicated and more pins than the pixel method here.

The purpose of the sacrificial pixel is to raise the logic level (amplify the '1').

The diode drops the power supply voltage a bit, but not too much, so that it's more likely to work (levels are okay, but not a huge amount of noise margin).

Typically threshold will be around half of Vcc with a range of 0.3 to 0.7 of Vcc so 3.5V maximum, which is obviously more than 3.3V.

With a lowered Vcc to 4.3V, the upper bound drops to 3.01V so the 3.3V output is within range. The daisy chain output of that pixel will be 0/4.3V which is within the acceptable range to drive the next pixel with a 5V supply.

A resistor does not have a constant drop so it's not really suitable.

This is kind of a clever solution, if you have to get things going with what's available but I'd be happier with a single 74HCT08 and gate with the inputs tied together (and a series resistor on the 3.3V out) or a proper voltage translator (better in case the 5V supply disappears then the aforementioned resistor would come into play).