One transistor-noninverting bidirectional level shifter

AllyCat

Senior Member
Hi,

Your diagram is not quite correct: The gate should go to the 3.3 volt Vdd.

Alternatively, a PICaxe will usually work fine on a 3.3 volt rail. Or with its traditional 4.5 volt rail, simply taking the pullups to 3.3 volts may be adequate for I2C communications.

Cheers, Alan
 

cravenhaven

Senior Member
Hi,

Your diagram is not quite correct: The gate should go to the 3.3 volt Vdd.

Alternatively, a PICaxe will usually work fine on a 3.3 volt rail. Or with its traditional 4.5 volt rail, simply taking the pullups to 3.3 volts may be adequate for I2C communications.

Cheers, Alan
Oops thanks for that catch Alan. fixed now.

I came across this when I was building a tank level gauge with wifi connections. The picaxe has to communicate with an ESP8266 at 3.3 volt and an ultrasound detector at 5v, so one way or the other it needed level shifting.
 

tracecom

Senior Member
I assume that the source/drain connections are reversible, i.e., each can be connected in either direction.
 

cravenhaven

Senior Member
It might be helpful to show where the signal lines connect.
And to add some practical component values.
Thats why I put the link to the App note. This cct can do far more than just 5-3.3 voltage levels and the resistors would change depending on the circumstance. Also at the stage I made the post, I hadnt actually tried it so didnt want to propose values that might not work well. This evening I did actually try it with values of 3k3 on the low (source) side and 4k7 on the high (Drain) side and it worked very well for 5v to 3.3v. The scope traces showed no visible distortion with a 20us timebase and voltage levels of approx 3 and 4.6 depending on direction.
 

Goeytex

Senior Member
The BSS138 FET used on the Sparkfun Board is superior to the 2N7000 that I showed on the diagram. The BSS138 is a true Logic Level FET with a Gate Threshold Voltage of ~1.5V. The SparkFun board uses 10K Pullups which may not allow enough current in long IC2 runs, but it it simple enough to add an additional parallel resistor at the device pin.

In a pinch, I have used this basic circuit with a Bipolar NPN transistor. Just need to add a resistor at the base.
 

cravenhaven

Senior Member
The BSS138 FET used on the Sparkfun Board is superior to the 2N7000 that I showed on the diagram. The BSS138 is a true Logic Level FET with a Gate Threshold Voltage of ~1.5V. The SparkFun board uses 10K Pullups which may not allow enough current in long IC2 runs, but it it simple enough to add an additional parallel resistor at the device pin.

In a pinch, I have used this basic circuit with a Bipolar NPN transistor. Just need to add a resistor at the base.
Like this Goey?
single transistor level shifter.jpg
 

Goeytex

Senior Member
The diode is not necessary. You may need to adjust the resistor values.

And remember this circuit is designed for I2C where the signal line is pulled low and the pullup resistor pulls the line high. It is not designed for push-pull drive.

What that means that if you drive the 5V side with a strong "high" that there will be some shoot through on the 3.3v side. In that case you will likely need to add clamping diodes on the 3.3v side to suppress the nasty little spikes.

Here is the basic circuit I used. The components in the box are for suppressing spikes due to shoot-through. They should not be needed for I2C.
 

Attachments

Last edited:

AllyCat

Senior Member
Hi,

Like this Goey?
No, as Goey says, the diode is not needed. In this configuration, the transistor sometimes operates "upside down", i.e. with base and emitter exchanged. That still gives some current gain (typically 5) but the (reverse base-emitter) breakdown voltage is not much greater than 5 volts.

Thus, when the right-hand side is pulled low, the left-hand side signal is only a (Vce) "saturation" voltage higher (which should be less than a forward diode drop). The gain of 5 should be fine if base and pullup resistors have a similar value, but if a lower pullup resistor value were desired on the 3 volt side (and the high voltage never much more than 5 volts), then it might be better to swap emitter and collector in the diagram. ;)

Cheers, Alan.
 
Top