Note quite correct at 8:23. While yes, the diode will conduct initially down to 0.6V. But this is where the MOSFET will take over and bring down the voltage to close to 0 volts! You can see this on your oscilloscope at about 12:08. Cool huh! Yes, MOSFETs do conduct in both directions when turned on. (Actually, MOSFETs conduct "Better" in the reverse direction, of course within 0.6V were the body diode takes over. Thair often used as "Free Wheeling Diodes" in power converter circuits to increase efficiency.) BTW, junction FETs and Depletion mode MOSFETs can also do bidirectional level shifting, and they don't even need the 3.3V pullup resistor and their gates are connected to ground. redrok
What I like about this video is it’s also a very good explanation on how transistors are turned on/off. So it’s two explanations in one if you pay attention!
The two transistor circuits are a form of common-base/common-gate. Another option that can be used with care it to just use a current limiting series resistor, many IC allow forcing current into the ESD diodes as long as it is limited
I noticed you use 10K pullups! Have you tried values from 4K7 down to 1K? It does consume more power, but will produce a nicer, crisper output. Also, If you use a 10 ohm resistor at the gate of the FET, instead of connecting it directly to +3V3, the ringing will go away. I am sure many people learn a lot from your work. Great job.
A transistor can also be switched on when a current flows from B to C, then C also opens to E. But the current gain is not as high as when the current flows from B to E and the path E opens to C. I use 4k7 for pullups. A gate resistor degrades the rise time.
Good example of level shifting, surprised about the performance of the resistor network, must have been a lot of capacitance there ( you were on bread board after all). The FET clearly wins, probably due to the tiny capacitance between G-S ( hampered by the inherent capacitance from the bread board but still wins out as the transistor was in the same ball park)
Hey Kevin, thanks for the explanatory video. I was wondering, I was having some trouble talking to my ESP8266 through serial on my Arduino while using a resistor divider for my level shifting (it was just printing binary garbage at all baud rates). I know some 8266's default to a 115200 baud rate, do you think that's a high enough baud rate that rise/fall times would become an issue? Thanks!
I wouldn't trust it - but the scope shot looked decent at 125kHz - when I was first analyzing the modules, I used a buffer, then migrated to the bjt/fet method
What I often see from the Chinese is a 5V level via a 1k directly into a 3V3 input. Each input should have protection diodes towards VCC. The 1k limits the current to 1.7mA. But this is really a dirty circuit and is based on the fact that the 3V3 is loaded with at least 2mA. The rise time should be really hard and fast.
Kevin, I'm on a tight budget but for a long time have wanted to upgrade my workbench with newer gear such as function generator, programable power supplies, and most of all a digital scope. Any idea where to find super bargains on this gear?
thanks for this, I'll try using the Mosfet next time I need to shift a logic level, a lot cheaper solution than using an IC and looks effective on your scope :)
I see that you link to the CD4050 chip in the description. I've checked the datasheet on this chip, but I don't understand how to hook it up for levelshifting.
I sometimes use it but to shift between 2.8V and 3.3V systems. It is not a proper solution though. Here's how it works: You hook up CD4050 to 3V. So the highs are 3V and lows are 0V. This is within the tolerance range of both 2.8V and 3.3V systems. You are essentially banking on tolerance of the two systems, and then there is no safety margin left for noise. So CD4050 is not a proper solution. 74LVC245 is what you should use instead. But even 74LVC245 is not seamlessly bidirectional like the techniques mentioned in the video.
May I suggest another method? And if it's wrong can you please tell me why? This is not bidirectional. one NPN. Base: HV Collector:3.3v Emittor:LV And 10K pulldowns on B and E I wanto to use this for serial transmissions, can it work?
Hello Kevin! Your videos are awesome, they helped me a lot and you learned me a lot of new things. I have a question regarding the transistor level shifters. If I want to go from 3.3V to 5V, do I need to keep the pull-up resistor on the Low-Voltage side or I just take it out from LV and put it to HV? Thank you again!
Tried doing this myself with the BJT design as I don't have any FET's. The voltage does not go full range 3.3v to 0v, its more like 3.3v to 1.5v and its not low enough to pass the threshold reliably so data is corrupt. I have tried putting extra resistance on the 3.3v rail to weaken it, and it gets it to around 3.3v to 0.9v which works more reliably but still doesn't seem right. Also the signals overshoot all the way upto the full 5v, the pulse is very small so doesn't seem to do any harm, but again its a clue I've got something wrong :-/ Any ideas would be great. (p.s. resistors I use are 10k on the E and C from the 5 and 3.3 rails, with an additional 10k on the 3.3v rail itself. the B has a 4.7k, (I did use a 1k as per this video but that pins the output at 3.3v regardless of the input) Transistor is a 2n3904, the devices are an Arduino @ 5v and a raspberry Pi's UART @ 3.3v)
kal9001 its because you have that additional 10k resistor on C and E, you only need one from the rail. You are cutting your high voltage in half, simple voltage divider
Can someone explain why the resistor divider is so slow? Is this due to the limiting of the current flow? Instead of using resistors in the K's, can perhaps 200 and 300 ohm be used instead? Dumb question, but the two transistor solutions use resistors on the low voltage side, so why isn't the same behavior seen at those node as we see on the resistor divider solution?
Thanks for the video! I am a newbie in this area, so please bare my dummy questions: 1. Could you please explain why when MOSFET is on, Vds can be 0? 2. Just wondering if a voltage regulator can do the trick as well since it can also convert a high voltage to low voltage?
ya! When I was watching the MOSFET method in the video, I came up with the same thought, it's like a diode and a resistor can do the job by its own. BUT while I typing this comment, I got some new thought, too. That is, the forward voltage of an diode is around 0.6~0.7 V, so when transferring an LOW signal, the output side will not go all the way down to the zero voltage, instead, it will stuck at the forward voltage of the diode. Then in the case of MOSFET method, the on-state MOSFET will keep pulling down the voltage (maybe?). Just a quick thought, maybe I'm wrong some where, welcome to discuss. :)
2N7000 is not a good MOSFET for this kind of circuit in 3V3 applications. Vgs threshold is a bit too high. You might wanna use BSS138, it has a much lower threshold voltage.
Excelent but... i don't know what component is each simbol :( May you show us how you do that on a protoboard please? and the components and each name? May be a practical example... I would like to use my old cellphone charger (5v 0.7A) to give power to my ESP8266 and may be turn on/off a small cooler. :D I enjoy very much your channel.
He is explaining a specific and concrete point. If you don't know the basics needed to understand the video, maybe you need to study those in the first place. Pretending a complete explanation including the fundamentals of electronics is ludicrous and slows down the learning of people that already have the necessary knowledge to understand the video.
Gracias!! Tengo un Arduino Mega y un Arduino Uno y, aunque no entiendo bien tu idioma, el lenguaje universal de la electronica me ayudaa enterderte. :)
Note quite correct at 8:23.
While yes, the diode will conduct initially down to 0.6V. But this is where the MOSFET
will take over and bring down the voltage to close to 0 volts! You can see this on your
oscilloscope at about 12:08. Cool huh!
Yes, MOSFETs do conduct in both directions when turned on.
(Actually, MOSFETs conduct "Better" in the reverse direction, of course within 0.6V were
the body diode takes over. Thair often used as "Free Wheeling Diodes" in power
converter circuits to increase efficiency.)
BTW, junction FETs and Depletion mode MOSFETs can also do bidirectional level shifting, and they don't even
need the 3.3V pullup resistor and their gates are connected to ground.
redrok
What I like about this video is it’s also a very good explanation on how transistors are turned on/off. So it’s two explanations in one if you pay attention!
This is easily one of the most useful electronics videos on the net. Thank you.
The two transistor circuits are a form of common-base/common-gate. Another option that can be used with care it to just use a current limiting series resistor, many IC allow forcing current into the ESD diodes as long as it is limited
Awesome video!
Clean, informative and practical.
I noticed you use 10K pullups! Have you tried values from 4K7 down to 1K? It does consume more power, but will produce a nicer, crisper output.
Also, If you use a 10 ohm resistor at the gate of the FET, instead of connecting it directly to +3V3, the ringing will go away.
I am sure many people learn a lot from your work. Great job.
A transistor can also be switched on when a current flows from B to C, then C also opens to E.
But the current gain is not as high as when the current flows from B to E and the path E opens to C.
I use 4k7 for pullups.
A gate resistor degrades the rise time.
Wow really great descriptions of each circuit and analysis! Thanks for this!
Good example of level shifting, surprised about the performance of the resistor network, must have been a lot of capacitance there ( you were on bread board after all). The FET clearly wins, probably due to the tiny capacitance between G-S ( hampered by the inherent capacitance from the bread board but still wins out as the transistor was in the same ball park)
Great video, thanks! I just wonder, according to your experience, how do all these compare to a level shifter IC?
Hey Kevin, thanks for the explanatory video. I was wondering, I was having some trouble talking to my ESP8266 through serial on my Arduino while using a resistor divider for my level shifting (it was just printing binary garbage at all baud rates). I know some 8266's default to a 115200 baud rate, do you think that's a high enough baud rate that rise/fall times would become an issue? Thanks!
I wouldn't trust it - but the scope shot looked decent at 125kHz - when I was first analyzing the modules, I used a buffer, then migrated to the bjt/fet method
What I often see from the Chinese is a 5V level via a 1k directly into a 3V3 input.
Each input should have protection diodes towards VCC. The 1k limits the current to 1.7mA.
But this is really a dirty circuit and is based on the fact that the 3V3 is loaded with at least 2mA.
The rise time should be really hard and fast.
nice video and detail explaination
Kevin, I'm on a tight budget but for a long time have wanted to upgrade my workbench with newer gear such as function generator, programable power supplies, and most of all a digital scope. Any idea where to find super bargains on this gear?
LabX is a used scientific clearing house.
www.labx.com/lab-equipment
thanks for this, I'll try using the Mosfet next time I need to shift a logic level, a lot cheaper solution than using an IC and looks effective on your scope :)
Very nice video, really liked it.
I see that you link to the CD4050 chip in the description. I've checked the datasheet on this chip, but I don't understand how to hook it up for levelshifting.
I sometimes use it but to shift between 2.8V and 3.3V systems. It is not a proper solution though. Here's how it works: You hook up CD4050 to 3V. So the highs are 3V and lows are 0V. This is within the tolerance range of both 2.8V and 3.3V systems. You are essentially banking on tolerance of the two systems, and then there is no safety margin left for noise. So CD4050 is not a proper solution. 74LVC245 is what you should use instead. But even 74LVC245 is not seamlessly bidirectional like the techniques mentioned in the video.
Great explanation. Can you recommend a book, website, or more videos that explain various circuit operations like this?
hey Kevin, how about using a buck converter? Its known have high efficiency and we can vary the ouput voltage
Nice wee vid, you should lookup an Analog Digilent Dicovery for some of your stuff, great wee toy/investment!
May I suggest another method? And if it's wrong can you please tell me why?
This is not bidirectional. one NPN. Base: HV Collector:3.3v Emittor:LV
And 10K pulldowns on B and E I wanto to use this for serial transmissions, can it work?
Hello Kevin! Your videos are awesome, they helped me a lot and you learned me a lot of new things. I have a question regarding the transistor level shifters. If I want to go from 3.3V to 5V, do I need to keep the pull-up resistor on the Low-Voltage side or I just take it out from LV and put it to HV? Thank you again!
Hi, can CD4050 be used also to level shift from lower to higher voltages?
In particular, could I use it for 5V-12V shifting ?
Thanks
Tried doing this myself with the BJT design as I don't have any FET's. The voltage does not go full range 3.3v to 0v, its more like 3.3v to 1.5v and its not low enough to pass the threshold reliably so data is corrupt.
I have tried putting extra resistance on the 3.3v rail to weaken it, and it gets it to around 3.3v to 0.9v which works more reliably but still doesn't seem right. Also the signals overshoot all the way upto the full 5v, the pulse is very small so doesn't seem to do any harm, but again its a clue I've got something wrong :-/
Any ideas would be great.
(p.s. resistors I use are 10k on the E and C from the 5 and 3.3 rails, with an additional 10k on the 3.3v rail itself. the B has a 4.7k, (I did use a 1k as per this video but that pins the output at 3.3v regardless of the input) Transistor is a 2n3904, the devices are an Arduino @ 5v and a raspberry Pi's UART @ 3.3v)
kal9001 its because you have that additional 10k resistor on C and E, you only need one from the rail. You are cutting your high voltage in half, simple voltage divider
Hey Kevin,
What oscilloscope are you using here?
Hi,
I like watching your videos and these are very informative.
What do you think about level conversion using zener diode..??
Can someone explain why the resistor divider is so slow? Is this due to the limiting of the current flow? Instead of using resistors in the K's, can perhaps 200 and 300 ohm be used instead? Dumb question, but the two transistor solutions use resistors on the low voltage side, so why isn't the same behavior seen at those node as we see on the resistor divider solution?
Cool vid man thanks
I like the explanation a lot. but would be great to see the used breadboards...
the whiteboard wasn't working for me. have you considered using the falstad simulator to help visualize the current flows? thanks!
yes, I use Falstad's simulator on a daily basis!
I meant use the simulator in your videos rather than drawing the circuits on the whiteboard.
Thanks for the video! I am a newbie in this area, so please bare my dummy questions:
1. Could you please explain why when MOSFET is on, Vds can be 0?
2. Just wondering if a voltage regulator can do the trick as well since it can also convert a high voltage to low voltage?
Kevin Darrah Hi Kevin,
When you have a chance, could you please let me know? I hope it won't take up too much of your time. Thanks a lot!
Interesting! Thank you for sharing.
Hey Kevin
Thanks a lot for this scientific and full explanation
great class for me just at the right time
it helps ;-)
Is that a Stone Brewery glass?? That's my local hometown brewery!
3.3v zener diode would work as well.
Could you not get the same effect by just using a diode instead of a transistor?
ya!
When I was watching the MOSFET method in the video, I came up with the same thought, it's like a diode and a resistor can do the job by its own.
BUT while I typing this comment, I got some new thought, too.
That is, the forward voltage of an diode is around 0.6~0.7 V, so when transferring an LOW signal, the output side will not go all the way down to the zero voltage, instead, it will stuck at the forward voltage of the diode.
Then in the case of MOSFET method, the on-state MOSFET will keep pulling down the voltage (maybe?).
Just a quick thought, maybe I'm wrong some where, welcome to discuss. :)
Well instructive, thank you
hi kevin, can you tell me how to step down 5v to 4v?
AWESOME!!!!!
2N7000 is not a good MOSFET for this kind of circuit in 3V3 applications. Vgs threshold is a bit too high. You might wanna use BSS138, it has a much lower threshold voltage.
what if i used a 2N2222 transistor ?
will it still work ??
( thanks for the explanatory video , it's really good )
yep, 2N2222 support 1A and also less noise than 2N3904 that only supports 0.2A
is there is any ic for shift up 5 volt to 12 votl
Excelent but... i don't know what component is each simbol :( May you show us how you do that on a protoboard please? and the components and each name? May be a practical example... I would like to use my old cellphone charger (5v 0.7A) to give power to my ESP8266 and may be turn on/off a small cooler. :D I enjoy very much your channel.
He is explaining a specific and concrete point.
If you don't know the basics needed to understand the video, maybe you need to study those in the first place.
Pretending a complete explanation including the fundamentals of electronics is ludicrous and slows down the learning of people that already have the necessary knowledge to understand the video.
Sure. I also asked him a very specific think, but luckly i've found it in another place.
very good job
Спасибо, не знал что вариант с делителем напряжения не подходит для больших частот.
Thanks you. great video
excellent thanks
Gracias!! Tengo un Arduino Mega y un Arduino Uno y, aunque no entiendo bien tu idioma, el lenguaje universal de la electronica me ayudaa enterderte. :)
so, ground is completely irrelevant?
Maybe it's better to take 3.3v Arduino and that's it?
Is he saying VBC or EBC? 🤯
nice moustache
schematic 2 swap hv lv
nice moustache