Electronic – Problems with a two-diode 3.3V -> 5V level shifting circuit


I'm trying to drive a strip of 57 APA102 LEDs from an ESP8266.

Driving just one LED directly (without level shifting) with a very short (about 10 cm) bus seemed to work, even though the APA102 expects 5V logic.

Now I built what I actually need:

  • the ESP is about 1m away from the strip
  • added diode level shifters for clock and data as per this answer: https://electronics.stackexchange.com/a/82112/18496
  • the circuit is wired correctly, I checked all connections twice.
  • ESP and strip are supplied by a 5V, 7A power supply, with 5V and GND connected on both sides of the strip.

The strip shows wrong colors, though. I think this is caused by the level shifting circuit, which simply can't drive the long signal lines with proper waveforms.

I lowered SPI frequency to about 500 kHz (bit-banged SPI with 1 microsecond delay between clock transitions), but the result remains the same.

It's hard for me to get many of ICs suggested for this kind of level shifting, such as the 74AHCT125
. However, I can get the 74HCT125. It can run off 5V and minimum high level input voltage is 2V. Would that be a suitable chip for this purpose?

Any other things I should try or test?

Voltage levels:

  • The APA102 has a maximum low level input voltage of 0.3 VDD = 1.5V and a minimum high level input voltage of 0.7 VDD = 3.5V.
  • The ESP outputs max 0.1 VIO = 0.33V or min 0.8 VIO = 2.64V. It seems to be able to drive 12mA.

Best Answer

The diode level shifter referenced is a shockingly bad design and useless in many cases.

For Vin = 0/3V3, Vout ~= 0V6 / 3V9
If that meets your needs you are lucky - there are few needs that it would meet.

Someone pointed out that LS Schottky will meet the need - any gate - not just ones intended as level shifters.
Without going and looking at the various family's level specs, it seems likely that most TTL families would meet the need of 3V3 in/ 5V out.
So eg 74HCT244 datasheet here gives you 8 level converters per package as does 74HCT541 - both about $US0.45/1 Digikey.

A far better circuit than the dual diode one is the one shown in the question that you referenced - see below.
The main drawbacks of this circuit are

  • Iout = Iin - it does not provide any current gain.

  • Being "single ended" it has a slow low-to-high transition as the high level is provided by pullup resistor R2. For typical values of capacitive load this is probably not a major problem.
    E.g. with a 1 nF load time constant = RC = 6k8 x 1 nF ~= 7 uS, i.e. operation at perhaps 20 uS minimum per high level to be safe - faster would often work. Lower values of R2 will allow faster operation as long as the input driver is able to pull down the load resistor.

The 2N7000 circuit shown on the same page does not have the Iout = Ion limitation. It does have the slow rise time issue due to the single-ended output, but as the input does not have to supply this current a lower value of load resistor may be used with no impact on the input.

There are various level-shifter circuits around - almost all are better than the diode-based one. If you are still uncertain then please supply a requirement with voltage swings and loads documented.

enter image description here



The various single MOSFET level translators in the various answers that chain back from links in this one seem likely to meet your need.
Also, a deleted answer referred to this 2N7000 level shifter pair which can be bidirectional but is obviously OK unidirectional in your application. The 2nd circuit on that page works with just a 0/3V3 in and no access to 3V3 supply which they derive from 5V. It appears again in this SE answer

This EDN article
Don't pay for level translators in systems using multiple power-supply voltages - May 25th 2006, contains links to a host of potential solutions. Including

Microchip 3V tips and tricks

Nokia 2 transistor bidirectional level translator wow! :-) - I'm sure it's simple enough but at first glance it's 'interesting'. Cross coupled bistable transistor latch.

TI level translator selection guide - !!!
86 bidirectional and 161 unidirectional solutions offered for 3V3 -> 5V.

1966 BJT based patent horrendously obfuscated.

Silicon labs IIC translator - uses the BJT cct above.

Std 2N7000 bidirectional or unidirectional translator With and without 3V3 rail available. 2N7000 data sheet - $US0.27/10 Digikey.

Related Topic