27
\$\begingroup\$

I need a simple, single directionnal level shifter for 3.3V -> 5V conversion.

There are many options on the internet, some using a logic ic and some using 2 NPN transistors (converter and inverter), but I never found an option using only a single transistor (and 2 resistors).

My understanding is that when input is at 3.3V, the transistor is blocking and R2 pulls output up ; while when input is 0V the transistor is passing and pulls output down to transistor VCE(sat).

single directional level up shifter

So, why wouldn't such a converter work? There must be a reason...

\$\endgroup\$
17
  • 6
    \$\begingroup\$ @medivh It would give Vce(sat) as the output voltage at 0 Volts input - and for many small signal transistors, Vce(sat) is far smaller than the diode drop, e.g. 0.3 Volts maximum for the 2n2222. \$\endgroup\$ Commented Sep 12, 2013 at 10:50
  • 4
    \$\begingroup\$ Ug. You should draw your schematics more sensibly layed out, especially if you ask others to look at them. What you have is a simple circuit, but I had to tilt my head and think about it to realize what it is actually doing. With a proper layout that would have been immediately obvious, and might help you see what is really going on in the circuit too. (For more info see electronics.stackexchange.com/a/28255/4512 . ) \$\endgroup\$ Commented Sep 12, 2013 at 12:47
  • 23
    \$\begingroup\$ The schematic looks pretty clear to me.. \$\endgroup\$ Commented Oct 17, 2014 at 23:55
  • 10
    \$\begingroup\$ Schematic looks fairly good to me also. Olin can be a little picky. It's missing a junction dot on the bottom of R2, and the Q1 designator should be next to the transistor. Also, a part number for the transistor should be shown (e.g. 2N2222). It's got the input on the left and output on the right, which is correct. \$\endgroup\$
    – tcrosley
    Commented Oct 18, 2014 at 0:23
  • 8
    \$\begingroup\$ Also, you have pretty much rediscovered US patent 3283180, from the 1960s. \$\endgroup\$ Commented Dec 1, 2015 at 14:25

2 Answers 2

22
\$\begingroup\$

The single-BJT level shifter in the question would work: If the input impedance of the device on the 5 Volt side is significantly higher than the 6.8 k shown in the question, the expected ~0.3 to ~5 Volt signal would be received (taking a 2n2222 as an example).

However, for lower impedance inputs, the input would act as a voltage divider with the 6.8 k resistor, attenuating the high part of the signal significantly.

For instance, if the input impedance of the load on the 5 Volt side were, say, 100 k, the signal would top out at around 4.6-4.7 Volts. Still not too bad.

Any lower, and the level becomes problematic. This is when one needs an alternative, such as a two-transistor set-up mentioned in the question, to drive the output rail harder.

\$\endgroup\$
2
  • 4
    \$\begingroup\$ As long as the 3.3V driver can sink, say, 4 mA, the output resistor on the level shifter could be reduced to 1200 ohms. Under these conditions, the base resistor could be raised to 6800 ohms, which still gives plenty of drive (0.4 mA) to saturate the transistor. Total current sunk by the 3.3V driver would be 4.3 mA. \$\endgroup\$
    – Dave Tweed
    Commented Sep 12, 2013 at 11:13
  • 2
    \$\begingroup\$ I didn't think about that, since for my case I expect the 5V-side input impedence to be lots of MΩ. But that totally explains why people go the 2-NPN route! Thanks... \$\endgroup\$
    – Nicolas D
    Commented Sep 12, 2013 at 13:52
10
\$\begingroup\$

I like your solution. Since the question is about simple solutions, I have a few alternatives (some solutions provided by Microchip HERE):

1) Direct connection: If Voh (high-level output voltage) from your 3.3V logic is greater than Vih (high-level input voltage), all you need is a direct connection. (it is also required for this solution that Vol (low-level output voltage) of the 3.3V output is less than the Vil (low-level input voltage) of the 5V input).

2) If the above conditions are close, you can often boost the high-level output voltage slightly with a pull-up resistor (to 3.3V) and direct connect the signals.

3) The pull-up resistor can provide a small amount of high-level voltage increase. For more, you can use diodes and pull-up to 5V. The circuit shown will not pull-up clear to 5V, but it will increase the high-level input voltage to the 5V logic by the amount of one diode voltage drop (appx 0.7v). Care must be taken with this method that you still have a valid low-level as that is also raised by one diode drop. Schottky diodes may be used for a slight increase in high-level voltage while minimizing the undesired increase in low-level voltage. Refer to the above mentioned app note for more on this circuit.:

schematic

simulate this circuit – Schematic created using CircuitLab

4) If you can deal with a logic inversion (and don't require active pull-up), a mosfet and pull-up resistor may be used:

schematic

simulate this circuit

5) I know you aren't looking for a logic ic solution, but for completeness I will mention one (of probably many). The MC74VHC1GT125 is a "Noninverting Buffer / CMOS Logic Level Shifter with LSTTL−Compatible Inputs" in a SOT23-5 or SOT-353 package. Small simple and cheap.


Apparently this subject was also discussed the other day: Step up 3.3V to 5V for digital I/O although the solution there is incorrect (thanks Dave Tweed).

\$\endgroup\$
6
  • \$\begingroup\$ Yes, but they got it wrong in that other question. \$\endgroup\$
    – Dave Tweed
    Commented Sep 12, 2013 at 12:42
  • \$\begingroup\$ It looked a little suspect to me ... I'll edit to mention that. \$\endgroup\$
    – Tut
    Commented Sep 12, 2013 at 12:44
  • \$\begingroup\$ I like that 3rd solution, but I think it's subject to the same input impedance limitation as my original schematics... right? \$\endgroup\$
    – Nicolas D
    Commented Sep 12, 2013 at 13:56
  • 1
    \$\begingroup\$ Not exactly. Your 3.3V circuit must sink both the collector current and the base current (sufficient to saturate Q1), but should then deliver a lower Vol to the 5V logic. The diode circuit need only sink enough current for the 5V logic (and the added pull-up resistor) which may be quite low in the case of CMOS (for example), but will have a higher Vol due to the diode drop. Consult the data sheets to determine which works best. If you have sufficient margins, don't overlook direct connection which is quite common. \$\endgroup\$
    – Tut
    Commented Sep 12, 2013 at 14:38
  • 1
    \$\begingroup\$ Shouldn't something be said about switching times? With a 10 pF load, the time constant is 100 ns for one of the transitions for the last circuit. \$\endgroup\$ Commented Feb 10, 2018 at 2:34

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