1
\$\begingroup\$

I have a digital output from a 3.3v device that I would like to make 5v tolerant - i.e be able to connect it to either a 3.3v OR 5v MCU.

I could technically connect the output directly to the Arduino Uno (or a 3.3v MCU) without any problems. The problem with the output is that the VOH minimum is 3v, while the VIH for the Arduino Uno is 3v - so there is no margin for error.

So I will need to shift this output up to 5v (if so required). I have considered 3 options:

1) a part like this - MC74VHC1GT125 - would do the trick. 2) Use an optocoupler - like the HCPL-181 3) Use a bi-directional level shifter using a MOSFET and 2 resistors - like in this Philips AN97055 note

  1. Takes a wide variety of input voltages (3v in our case), and translates it to the Vcc reference voltage (which may be 3.3v or 5v depending on our MCU of choice)

  2. The output from the optocoupler can be tied to the Vcc reference voltage, so it will work with either 3.3v or 5v MCU

  3. The output side of this (connected to the MCU input) can be pulled up to the Vcc reference voltage, and so is again tolerant of 3.3v or 5v MCU and will pull up to the appropriate level

3 looks very attractive as I am already using a couple of MOSFETs (BSS138) in my design (for the I2C lines), for simplifying the BOM.

However, I see that it seems to be mainly used for open drain/collector configurations like I2C pins - a digital output pin is not an open drain/collector type.

My question is - can the bi-directional level shifter shown in the Philips note above be used in the uni-directional case of a digital output pin with no ill-effects?

If so, what does say, the MC74VHC1GT125 or another specifically designed level shifter IC, offer in terms of advantages over this approach? And how does the optocoupler approach compare?

I have scoured the internet quite a bit, but am left deeply yearning for more clarity and understanding!

Thanks! Sridhar

\$\endgroup\$
1
\$\begingroup\$

The bidirectional MOSFET level shifter automatically detects when one side is pulled down, and then pulls the other side down. So it will still work if only one side is ever pulled down.

The pull-up resistors are needed to get a defined high level when no device is pulling the line down. When you have a push/pull output, you do not need the resistor on that side.

A pull-up resistor combines with any parasitic capacitances in the circuit to form an RC low-pass filter, i.e., the rising edge of the output signal is slowed down. This is typically not yet a problem at the 100 kHz of I²C, but might become one at higher frequencies.

The MC74VHC1GT125, or actual level shifters like the SN74LVC1T45, have push/pull outputs, so they can reach higher frequencies.

An optocoupler is used if you need galvanic isolation. When you connect the grounds of the two devices together, it is not needed (but would still work).

\$\endgroup\$
  • \$\begingroup\$ Thanks! This was exactly the kind of information I was looking for! Since the digital out does not need a pull-up resistor, will a circuit like this one suffice? \$\endgroup\$ – Sridhar Rajagopal Jul 5 '17 at 19:36
  • \$\begingroup\$ imgur.com/a/W4L6a \$\endgroup\$ – Sridhar Rajagopal Jul 5 '17 at 19:45
  • \$\begingroup\$ In my case, the signal is way less than @ 100 KHz \$\endgroup\$ – Sridhar Rajagopal Jul 5 '17 at 19:46
  • \$\begingroup\$ Yes, that pullup resistor can be omitted. But a 10 V power MOSFET will not work with a 3.3 V signal. \$\endgroup\$ – CL. Jul 6 '17 at 6:36
  • \$\begingroup\$ Oops - I just used the circuit symbol just to illustrate - didn't realize it had a part number with it! The part I'm using is the BSS138. \$\endgroup\$ – Sridhar Rajagopal Jul 7 '17 at 15:24

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.