How does the Bi-Directional Logic Level Shifter work?

How does the Bi-Directional Logic Level Shifter work?

The PiSwitcher Plus board communicates with the Raspberry Pi board through the I2C interface. A small problem arises since the board operates at 5V, but the Raspberry Pi GPIO pins operate at 3.3V.

Since the communication is bi-directional, and connecting the lines directly won’t produce reliable results, we use a Bi-Directional Logic Level Shifter (or Level Shifter). In this article we’ll discuss how you can build the simplest bi-directional logic level shifter and how it works.

The Bi-Directional Logic Level Shifter Circuit

The circuit includes three components: a MOSFET transistor and a couple or resistors, Figure 1.

The Low Voltage Data Pin (LVDP) connects to the transistor’s Source (S) terminal and the resistor R1 pulls it up to the Low Voltage Supply (LVS). Transistor’s Gate (G) connects directly to the LVS. The High Voltage Data Pin (HVDP) connects to the transistor’s Drain (D) terminal and the resistor R2 pulls it up to the High Voltage Supply (HVS).

The resistors can have the resistance value between 4.7KOhm and 10KOhm. For high frequency communication, you can lower resistors’ value to 1KOhm as the gate-source parasitic capacitance may interfere.

As a MOSFET transistor, you can use 2N7000 or BS170 devices.

Bi-Directional Logic Level Shifter Circuit

Figure 1. Bi-Directional Logic Level Shifter Circuit

Low Level to High Level Conversion

The Low to High level conversion occurs when the LVDP acts as an output, and HVDP acts as input, see Figure 2. When the LVDP outputs the low logic level “0”, the Gate-Source Voltage (VGS) drop becomes above the threshold voltage. The transistor opens and pulls down the Signal Line. Both pins read Low logic level. The LVS and HVS will drop on resistors.

Signal Line pulled down by the Low Voltage Data Pin

Figure 2. Signal Line pulled down by the Low Voltage Data Pin

When the LVDP switches to High logic level, the VGS voltage becomes relatively close to 0 (below the threshold voltage) and closes the transistor. The resistor R2 pulls up the HVDP and reads the High logic level, see Figure 3.

Signal Line pulled up

Figure 3. Signal Line pulled up

High Level to Low Level conversion

The High to Low level conversion occurs when the HVDP acts as an output, and the LVDP acts as input.

When the HVDP outputs Low logic level, because the potential on the Source terminal is higher, the transistor’s substrate diode starts to conduct. There will be a 0.7 voltage drop between Source and Drain terminals, the VGS will also rise above the threshold voltage and open the transistor, and consequently pull the Signal Line low for both pins, Figure 4.

Signal Line pulled down by the High Voltage Data Pin

Figure 4. Signal Line pulled down by the High Voltage Data Pin

When the HVDP switches to High logic level, the transistor closes again and the resistor R1 pulls up the LVDP, Figure 3.

Summary

In summary, the Bi-directional Logic Level Shifter converter circuit is a cheap, simple and reliable solution in case you want to facilitate communication between two circuits that use different logic level voltages.

A few things to keep in mind, the transistor’s Gate-Source parasitic capacitance and pull-up resistor can act as an RC filter, which may impede the high frequency communication. You may lower the resistor’s value, but this will increase the currents, so you’ll have to do a trade-off.

This solution may not work with circuits that work below 1.8V logic level because of the transistor’s threshold voltage level to open the transistor. There are integrated circuits that support voltage levels below 1.8V, so consider them when appropriate.