Translating 3.3 V to 5 V
Вставка
- Опубліковано 13 сер 2024
- This video covers the following topics:
- What are voltage level shifters?
- Discussion of the Sparkfun BOB-11978
- Difference between open drain and (digital) push-pull-output.
Links:
Sparkfun BOB-11978: www.sparkfun.c...
TXS0102 datasheet: www.ti.com/lit/...
M74HCT125 datasheet: www.datasheetar...
M74HC125 datasheet: www.datasheetar...
I finally find a video that goes into great depths in explaining this and then I find out this video is 7 years old & this UA-cam creators last video was created four years ago!
I guess he couldn't be bothered making videos anymore because he is busy with work?
We need more people like him on here!
The most underrated electronics explanation on UA-cam I found so far
This was a fantastic video. I appreciate the effort you put into it!
Very well done!! I wish I had watched this earlier. I tried a couple of solutions and was about to use the M74HC125! I really appreciate your thorough treatment of the subject!
Thank you! Keep up the good work :-)
This was just what I needed. Thanks a lot for the thorough explanation!
I use the 74LVC573, the 74LVC373 is the same device with a different pin out, they will handle faster switching signals than discrete FET based level shifters.
Outstanding! Thank you. I'm an EE by education but a SW guy by trade. This was the perfect refresher for me and probably many others.
Thanks Tony, I know exactly what you mean. I'm glad you liked it.
7:08: A voltage divider can get you in trouble in those cases where you should have made a buffer to the next section. The numbers shift in the next voltage divider (without a buffer), so to speak. Took me some time to figure that out.
This is correct, any load at the "output" of the divider is in parallel with the lower resistor and loads the divider. You can take that effect into account when designing the divider but I would advise against that and use a buffer in cases where you have a low impedance load. That buffer can do the level shifting by itself if selected properly...
Great Video. I had to search really long to find a video that explains the details of voltage level shifting
Thank you so much for this video. Such good detail and excellent explanations.
Thank you for this great video! Currently working on my first electronics project, and the Logic Level Converter I bought uses a MOSFET. I encountered some issues with SPI communication, and the oscilloscope part of the video helped me to understand and then solve the issue!
At 8:03 you're describing an "N-Channel Enhancement Mode Insulated Gate MOSFET".
However, there are other MOSFETs called "N-Channel Depletion Mode Insulated Gate MOSFETs" that do conduct when the gate voltage is 0 volts and turn off at negative voltages.
With Depletion mode you don't require a pullup to +3V. Just connect the gate to 0V or gnd.
Hint, maybe +3V isn't readily available. You can also use "N-Channel Depletion Mode Junction FETs", (nearly all are) for this.
redrok
Cool vid. Switching the source instead of the gate obviates the need to use a second transistor to avoid inversion of the signal.
well done, alot of meat and direct (as opposed to most current videos that seem more focused on editing and "side entertainment")....very dense but very useful video. A big thanks!
Thank you 😀
Good explanation of methodology for buffer circuits working amongst logic chips.
Thank you brother you saved my efforts ❤.
you singlehandedly saved my project
thanks :-)
Man, you should make this kind of video a lot. That's impressive. You are so clear and explain everything detailly. I need a mentor like you.
One question: Is open-drain configuration bidirectional?
Hello and thank you. No the circuit I show is not bidirectional. If you need that, you could look at e.g. learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all this circuit
@@MrCircuitMatt I ask that question for clarification. I saw same open drain configuration in that url. But it says that open drain configuration is bidirectional as I understand from that guide. learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all
@@BiqBanq The circuit in that guide is bi-directional. I'm not sure I would call it "open-drain" but at the end of the day, the circuit in the guide is bi-directional and the circuit that I show in the beginning of the video is not. I do show the circuit from the guide at 5:00 in the video, though -- maybe that is the source of confusion. I had forgotten that I actually also discuss this circuit.
Excellent video all aspects covered.
Wow. Helps me understand I2C buffer.
Great explanation, just what I needed! Thank You
Very clear explanation. I've learned a lot. Thanks!
when the frequency increases... it is not only resistance...but impedance... where might get into the area of EM.. Smith Chart... Well.. Thank you so much for your video!
This is pure gold..thanks ☺️
Thanks for your time.
Excellent explanation!!! thank you very much!!
Very good video. I also liked the theory refreshing part as I actually needed that. :-)
Thank you :-)
Showing your breadboard circuit would have made this the perfect video for novices.
Thank you very much
Can I remove the 10k pull-ups, as I wish to logic level shift but not using current sinking. I will be push-pulling logic levels from a 5V schmitt trigger and wish to down-convert the logic levels to the Raspberry Pi's 3.3v GPIOs. I know the resistors can be changed to e.g. 1k for a stronger pull-up, but can they be removed entirely?
I don't think you can remove that resistor altogether but I'm not sure why you would want to do that. Maybe I'm missing something though; you are describing a uni-directional system (your schmitt trigger is a strict output) and to knock that down to 3.3 V you could just use a resistive divider or a zener clamp.
Just use opto isolator. I use a few on a esp8266 and mosfets to pwm dim led lighting. Using this method you can send 5, 12 or even more volts to drive the mosfet.
That's a nice idea if isolation is desired. But other than that it doesn't add anything compared to the single transistor solution I show. Also please note that the main application for the circuits I show in the video is level shifting of signal lines with a focus on moderately fast signals. The PWM-dimming of LED that you use works well with any optocoupler, but the signal I was dealing with when I did the video was > 1 MHz. What's your PWM frequency? I bet it is much lower than that. Propagation delay of a typical optocoupler (say 4N25) is above 1 us for a load resistor of 1k. "Just use opto isolator" would not work in this case, you'd have to consider a few things and I don't think it pays off to do that except if you need isolation. It's a good thing to be aware of the option though, thanks for your comment!
If I wanted to use a BSS138 to shift from 3.3V to 5V BUT not bidirectionally, would it be reasonable to only connect the 3.3V to the gate and then not supply any reference 3.3V with a pullup to the normally input side? Basically trying to avoid using a diode if necessary.
I guess you are referring to the traditional N-FET circuit where the gate is tied to the lower reference voltage and where two pull-ups are used. But no diode is used in this circuit. Since you're not using this bidirectionally, I'm not quite sure which would be your input side... I feel that there's some information lacking for me to confidently answer your question. Feel free to drop me an email though if you want to discuss this :-)
You could use a positive voltage shifter with an inverter. A pull up resistor is necessary since you have an inverter.
How do you calculate the max frequency at which you can use a mosfet for level-shifting SPI or I2C communication? If I use something like the source drain capacitance and the RDS ON to calculating a rise time (3 tau should be enough?), that seems a lot different (less time) than the turn on rise time of the Mosfet.
You have to take into account the time required to charge up your gate. Have a look at the document I am linking in at the end of thid response. In Fig. 1 you'll see how no drain current is flowing at first until the Vgs reaches the threshold voltage. Then some drain current starts to flow but the transistor is still maintaining the Vds it had in the of state. And only after that Vds starts to fall. (This is also where the Miller effect kicks in). This is why it's more tricky than simply assuming that you're charging a parasitic capacitor through a resistor of the value of RDS ON. In fact RDS ON is only really reached once you have turned on the transistor hard, which is not the case yet when you're in the "turn on phase". I would say that the your calculations are still optimistic even if you neglect the time needed to charge up the gate. Hope that makes sense. Here's the link: www.engr.colostate.edu/ECE461/chapter_supplements/ch21_supp2.pdf
Hi, I'm quite the noob, but I really hope you can help. I'm currently working on a simple radio project using an arduino uno, RDA5807M, small amp and LCD. At the moment I'm trying to add the blue lit 16x2 LCD but, unfortunately, the LCD is 5v and the RDA is 3.3v(maybe I should have bought the 5v TEA5767 instead). I don't want to be buying extra modules because everything will be going on the same PCB, so I believe I have two options: use a 5v supply and drop the voltage to 3.3v for the RDA, or use a 3.3v supply and boost to 5v for the LCD. Looking at your video I think you can put me on the right track. What would you recommend I use?
Hello. Definitely easier to work with a 5 V supply and drop it to 3.3 V for the tuner, especially if power consumption is not super critical. If you do that, I think that both your arduino as well as your LCD are 5 V systems and you can readily interface between the two. However, you will have to design the communication bus between the arduino and the tuner carefully since the two parts are running off different voltage rails. I'm not sure how you have solved that right now. I'd be glad to further discuss this with you but this is sort of hard to do in youtube comments. You are welcome to send me an email to hb9frv@uska.ch though, I'm also on skype and IRC. Would be nice to hear from you. In any case good luck with the project!
Thanks for the quick reply. Will contact you soon via email. Cheers.
I need to convert 12v signal to 5v can I use the same concept mentioned
Thank You
Great explanation but with respect to the open drain usage for the I2C lines I wished you elaborate on how if 2 lines are low ,one can still be high?
I have observe the same from Sparkfun Level shifter in my test I did few days back. I think M74HCT125 is better alternative. But how about limiting the current as well? say 3.3v Raspberry Pi that is limited at 2mA on it's pin at LV side and a 5v servo which can draws above 15ma on the HV side - is there a feature as well or additional current limiting circuit is required for M74HCT125? any advice.. Thanks I learn something.
fnjyusername So sorry that I missed your comment. Better late than never, though: I hope that I'm not misunderstanding the question. If you use a solution such as the M74HCT125, the current on the high voltage side (15 mA in your case) will be soured from the supply (pin 14). Not from the input pin. So if this is your concern you should be fine.
Tks
Thanks for this explanation.
It was very nice.
Keep going!
Hi could you explain how when the source is at zero volts the output is dropping to zero? How do you calculate the Ids to find out the drop in pull up resistor? We just know overdrive voltage ...
Hi! Assuming this is about a simple inverting level shifter with an n-FET: When the source is grounded and the gate is charged up to a sufficiently high voltage, the FET turns on. This means that it allows for current to flow from the drain to the source (the drain current) and that the voltage between source and drain (Vds) is almost zero. Now if the source is at ground potential and Vds is almost zero, then the voltage at the source and therefore the output is almost zero. That should answer your first question.
On your second question: Under the above conditions, i.e. when the transistor is turned on hard, the current is only limited by the resistor. I.e. Ids is Vsupply/Rpullup and the drop in the pullup resistor is Vsupply-Vds which is approximately Vsupply. (It would be unusual to implement level shifting without turning on the transistor hard). Does that make sense?
Hi
Can you please help me
I need to send a pulse that is 10 MicroSeconds at 3.3V to a 5V device what do you recommend for doing that?
Hello Luis. The solution based on the M74HCT125 should work well, ist you want something easy. Just remember to bypass the chip and to terminate the unused buffers.
Very informative. Thanks!
very nice video. Great presentation and content.
Matt Thanks for the great video! I have a question for you. I have 3.3v output signal to 5v input for a stepper driver. Is it that important to use the spark fun product or the logic buffer chip in your video?
It might work but I really wouldn't bet on it. The 3.3 V vs. 5 V issue aside, to drive the motor, you have to sink some amount of current into the motor coils. Chances are that whatever generates your 3.3 V signal cannot deliver that current. Less current means less torque so your motor might not start rotating at all or might be super weak. Plus you have to consider protecting your driver from inductive kickback since the motor is an inductive load (afrotechmod has a nice youtube video on that). On the bright side, if you come to the conclusion that you need a driving transistor to drive the stepper, you get the voltage conversion for free it you do it right. Google application note AN235 for a primer on how to pull this off.
Or are you driving an integrated stepper driver that requires a 5 V logic level with 3.3 V? In that case please share the part number of the driver or check the datasheet, but the general points in the video hold in this case. Let me know if you need more help with this. Good luck!
Thanks for getting back to me, here is the link to the driver.www.omc-stepperonline.com/stepper-motor-driver/stepper-motor-driver-24-72a-max-80vac-or-110vdc-ma860h.html
I already have a working project with arduino controlling this driver and nema 34. I tried using a teensy 3.3v and it would not put the driver to logic high for Puls or Direction. So i figured this would be the perfect video to watch! I'm working on a new project and I wanted to use a arduino Due. So I needed to find out how to control the driver.
Many thanks for a really useful video.
Very nice video! Many thanks.
@27:15 did you try it @20Mhz? i would love to know if it solves the rising edge curving issue
This was a number of years ago, but no, I did not try this at any other frequency. I needed a level shifter for a signal of that particular rate and thus this is what I used. If I remember correctly, I did not have any issues with curved rising edges in the end.
could we possibly convert the 3.3 volts to 10 volts?
as connecting an Arduino with a larger mosfet?
I have a 2n7000 mosfet and a IRFP460 mosfet.
Thanks anyways :D
I guess you're asking about the unidirectional, single transistor, inverting approach. You can absolutely use the same approach for shifting up to 10 V. You will need a transistor that can take 10 V across its drain-source-channel but that's fairly common, both the 2N7000 as well as the IRFP460 are OK. (I don't think you need a power FET there for signals, though). If you need to level-shift more than one channel, you could use a transistor array like the ULN2803 or similar. I hope this was helpful.
well what we where planning is using the 2n7000 (since its a logic level mosfet) to switch on the IRFP460 (since its Vgs = 10 V) to work for a 3 phase motor (Which needs 380 V and 15A) using Arduino but for some reason our setup doesn't work properlly.
and yes its very helpful thanks :D
Nice video, you are very good at explaining, thanks a lot :-)
Hi, could you explain if it can be done using a non-inverting amplifier instead? To amplify a 3.3V to 5V
Sure, it can be done without inversion. I show a number of methods, e.g. the TXS0102, the single-MOSFET circuit and also if you chain two inverters together you get level shifting without inversion (kinda like double negation). Do those work for you? Or maybe you mean something specific when you say "non-inverting amplifier"? Are you trying to do it with an opamp circuit? It can be done but I don't think it makes a lot of sense to do digital level shifting with an opamp. Or are you trying to amplify an analog signal?
MrCircuitMatt Sorry Matt I meant yeah with an non inverting op amp? Could you possibly show me how the circuit will look like. Also another question if you can, what circuit need to be built to modulate eg a 50 hz AC signal -4 to 4V to a range 0 to 3.3V?
Hey there! Have a look at photos.app.goo.gl/hR5YswRaCxjuNwof2 which shows a bunch of interpretations of what you want to do. (1) is what I did in this video. I believe what you want is (2) but it could also be (3) or (4). Which one is it? I believe (5) is what you want in the second question but I'm not sure.
Really informative video.
I need to level shift from 5v to 35v with a 1Mhz bandwidth. Any suggestions how I might achieve this? thanks
When you say a bandwidth of 1 MHz, what do you mean exactly? Let's say you had a square wave at a fundamental of 500 kHz... the third harmonic would be at 1.5 MHz and thus outside of your bandwidth. So amplifying the fundamental would be sufficient? If so, I would look into amplifier designs that are designed for these kinds of loads. That should get you started and would show what kinds of caveats there are. (Or maybe a step-up transformer works, I don't know enough about your application to give a good answer here :-( ).
very useful. can you make one for analog shifter? thanks a lot!
NIce video very good explanation of content. Thx
8:03 N-channel Enhancement mosfet. Otherwise a really nice and complete video.
This was an exceptionally well done youtube video. I'm relatively new to electronics and have been trying to understand level shifting by watching youtube videos as my time is very limited...and this covered just about everything I had in doubt. Well done, I'm subscribed to your channel, keep up the great work! I have a book called Practical Electronics for Inventors and it is a very long read which I'm sure will take me lots of time to get through. Videos like this help me get quick, but incisive answers to subjects that I have an immediate need to understand. Thanks again. You should setup a Patreon account, I would definitely fund that.
Thank you for your kind words! I do this for fun, I have a cool job that pays my bills so there's no need for me to go the patreon route. I should make videos more often though! Let me know if I can help you with anything and I wish you the most awesome ride into electronics you could possibly imagine. It's an awesome field indeed.
Great. Thanx man. Keep going!
great tutorial. thanks!
Extremely irritating that excellent UA-camrs such as this MrCircuitMatt are dead. As though their mere purpose to appearing is to save humanity, and then magically vanish to quantum realm with their excruciating entanglement when their sole purpose of life is achieved.
I am not dead :-). I just had a difficult period in my life that made it hard for me to continue with the videos. That, or maybe my quantum state collapsed upon your observation haha
@@MrCircuitMatt Ah, there you are!
Uhmm. I do not know what you are going through but I can relate and understand whatever that/those are. I have my own share of idiotic dramas that I never ask for, and that are beyond my control.
Yes, the word 'dramas' with an arse. Because language is alive I say dramases, lots of arses.
@@realchristopher4334 Don't worry, I'm OK. Thank you for your comment, really made my day :-D. Regards, Matt
@@MrCircuitMatt The pleasure is mine, Matt.
Well explained.. Thanks!!
Explained well
Can't I just use Op-Amp as level shifters?
You can use Op-Amps, but there's a number of catches that make this somewhat non-trivial. There may be more benefits if the signal was analog, but the video is about shifting a relatively fast digital signal in a particular way. There is no doubt that you can do it with an opamp, but you'd need one with a sufficiently high slew rate. Furthermore you'd need one that can go down sufficiently close to the negative rail as I had no negative rail in the design this was intended for, and adding one surely would be overkill. Plus, the opamp solution requires more more passives than what I show, hence I wonder what the real advantage would be here...
Thank you Sir.
You might wanna use some Audio-Post-Processing so we can hear you more clearly. :-)
The truth is the circuit with one MOSFET and two resistors works 90% of the cases and is cheap.
Then take a 74LS125 or 75HCT125
Good
9:21
I think you want chapter 12 to get the history.
Which edition of the book do you have? Note that the 3rd edition of the book was not released yet when I recoded this. In my 2nd edition book, chapter 12 is "Electronic Construction Techniques". If you're referring to the new edition, thanks for the note.
AND WHY DON'T YOU BETTER CONFIGURE YOUR ARDUINO PIN AS INPUT, AND PUT IN IT, FOR EXAMPLE, A 4.7K RESISTOR, AND WHEN YOU WANT A ZERO YOU SIMPLY CONFIGURE IT AS OUTPUT AND SEND A ZERO.
This is essentially the open drain approch, just with a microcontroller. What I discuss in the video, however, does not presume the presence of a microcontroller.
Also, keep in mind that according to the datasheet of the microcontroller used on any arduino board, there is a maximum input pin voltage that you are not supposed to exceed. This is usually a little bit above the supply voltage. Following your suggestion for a down-shifting converter would violate that spec and the internal protection diode would start conducting. The series resistor would limit the current and probably prevent damage, but it would also limit the rate at which you can toggle the pin, as discussed in the video. I would advise against this technique unless you are down-shifting or have checked that you are not in violation of the the spec.