# How does a bidirectional level shifter work?

I have the following circuit with an NPN HEXFET Q1 (BS170)

Correct me if I'm wrong:

When the TX-3V3 microcontroller is 3.3V i.e. logical 1, the TX-5V is a logical 1. This is because the gate of Q1 is CLOSED when $V_{GS}$ is greater than 0, and OPEN when it's not. So right now it is OPEN since $V_{GS} = 0$.

Question:

I get confused when the TX-3V3 microcontroller is 0V i.e. logical 0. I know from my measurements that the result is that the TX-5V is 0 in this instance. I don't understand why.

I would say the gate of Q1 is closed, since $V_{GS} \approx 3.3V$. Possible scenario's I can think of, please correct me where my thought process is wrong, I want to know my mistakes:

• The TX-5V has impedance, and since current takes the path of least resistance my guess is that the current coming from the 5V supply will flow towards the TX-3V3. However, then what happens? I always think of current as marbles moving through a tube. Since the TX-3V3 is a 0, then where will the marbles flow to? There's no ground connected...
• Another one of my guesses is that the voltage across the R2 resistor will be 5V, so the potential left over at the TX-5V is 0V. In this scenario there's still no ground though. So where can the current go? Please answer this question: Since the current has nowhere to go, does this mean theres no voltage across R2?

According to the assignment, the TX-5V can also control the logical '1' or '0' for the TX-3V3. Can one of you explain the scenario where the TX-3V3 is 0V and the TX-5V is 5V? How will the TX-5 be able to control the TX-3V3, like the TX-3V3 controls the TX-5?

## 2 Answers

When the 3.3V input is pulled down to 0V, the source is at 0V, the gate is at 3.3V and the MOSFET is (more or less for this particular part) 'on'.

Therefore the driver for the TX-3.3V sinks current from R1 and R2 and the output goes to slightly above the input voltage (because Rds(on) > 0 and some current goes through R2).

If you pull the TX-5V output low, then the body diode of the MOSFET conducts and brings the TX-3.3V input (and MOSFET source) down to the TX-5V low level plus 0.6V or so. If the MOSFET has low enough threshold voltage the channel conducts further reducing the source voltage and the situation is the same as with it driven from the other side (the MOSFET channel will conduct in either direction).

Without doing a detailed evaluation, I think this particular n-channel MOSFET is pretty marginal- I suggest picking something with a guaranteed lower Vgs(th) at 1mA, something more like the BSS138.

• what is a body diode? May 31, 2015 at 22:21
• Body diode (shown as a zener in the schematic symbol) is part of the MOSFET structure and acts like a diode that conducts if the drain gets much more negative than the source. Imagine an internal 1N4148 connected from drain to source. May 31, 2015 at 22:25
• @user1534664 More on MOSFET body diode here. May 31, 2015 at 22:30
• @SpehroPefhany So if the drain is much more negative than the source, the diode conducts. But if the drain is 0V, then how is it any more negative than the source which is 0V by default? May 31, 2015 at 23:09
• @user1534664 The body diode comes into play only in the second part of your question. "How will the TX-5 be able to control the TX-3V3". May 31, 2015 at 23:19

This is as simple as I can imagine it.

Whatever happens the gate is always at 3.3+ volts. When TX-3V3 goes to zero, VGS is +3.3 - 0 making the switch close and dragging the voltage at TX-5V to zero also.

When input at any side is high, nothing happens and both sides are high.