Simulating MOSFET based bidirectional 3.3V to 5V logic level shifter

Different logic levels are common problem in various circuits. For instance Arduino boards come powered from 5V or 3.3V. Raspberry Pi for is powered at 3.3V and it accepts and generates 3.3V signals on its GPIO. This is fine until you need to connect 5V peripheral to 3.3V device. This can be simple LCD. Of course you can get 3.3V LCDs, but this is not always the solution. Sometimes it is handy to build a voltage level converter. It can be a special buffer IC like SN74LVCC3245A. These work great as bidirectional voltage translators.

But in many cases there is no need for another IC in your circuit. Hobbyists like to go with simpler solutions. Simplest way is to use resistors where signal levels differ. The fact is that in most cases devices have clamping diodes on the inputs that are meant to protect further circuit from over-voltages. For instance clamping diode inside 3.3v device will try limit input voltage to 3.3V. This is why a series resistor necessary in order to limit current flowing through diode.

clamping diode

Using resistors, doesn’t guarantee safe operation. First of all you must be sure that 3.3V device has clamping diodes. Second thing is that such method won’t guarantee bidirectional communications either. If you want to be safe in both sides, you need some converter circuitry in between.

Today I want to discuss interesting and yet simple method of converting voltage levels using N-channel MOSFET and couple resistors. If you have several MOSFET transistors in your box, you can build level converter right away. This circuit or method isn’t new or fancy. Lots of people already use it and it works like a charm.

mosfet_based voltage level translator

This circuit is known as bidirectional level converter (shifter). This means that 3.3V signal is converter to 5V and vice verse. In circuit you also see a Shotky diode which plays significant part here. Normally there is a diode inside MOSFET transistor, so you don’t need to use one additionally. Lets see how this works.

Case 1: when there is a 0V signal from 3.3V device. At this point we have gate voltage at 3.3V. Source at 0V what means that gate voltage is above threshold and transistor is conducting. So output line is pulled down through transistor and its output also becomes near 0V (We can ignore internal transistor resistance which is several mΩ comparing to resistors R kΩ).

Case 2: When signal on input is high (3.3V). Then we have source and gate voltage levels same. This means that it is less than gate threshold and transistor isn’t conducting. So 5V line is pulled to 5V by resistor R2. This way 3.3V is translated to 5V.

Case 3:In this case we want to translate 5V signal in to 3.3V. Circuit remains same. Lets say we have high (5V) signal level at 5V side. Transistor is closed and both sides are pulled up to corresponding voltages. No big deal here.

Case 4: What about translating 0V from 5V side to 3.3V side. This may look a bit more complicated. In this part diode plays significant role. So when we apply 0V to transistor drain the diode cathode becomes 0V while anode is at 3.3V due to pull-up resistor R1. So diode starts conducting and thus pulls source pin of MOSFET to almost 0V (there is some voltage drop on diode). Then transistor gate-source voltage exceed threshold and transistor starts conducting. And do 0V from 5V side pulls down 3.3V side.

Lets run couple simulations with LTSpice. First of all lets construct a circuit for 3.3V to 5V converter:

3_3V_to_5V_LTSpice

Then run 3.3V periodic signal to its input. And here is result:

3_3V_to_5V_LTSpice_graph

Now we fix the power supply for translating 5V to 3.3V:

5V_to_3_3V_LTSpice

And here are nice results of level conversion from 5V to 3.3V:

5V_to_3_3V_LTSpice_graph

The circuit above is handy in other aspect. Simply speaking it can be used to convert higher range of voltages. Lower voltage side is practically limited to gate-source threshold voltage which opens transistor. Higher voltage side is limited to transistor limits. So you could translate like 2V to 15V or so. Be sure that you connect transistor in right way – meaning that drain side voltage were always higher or equal to source. Otherwise due to internal diode circuit won’t operate properly.

Download LTSpice simulation file here: 5to33

Leave a Reply

Your email address will not be published. Required fields are marked *