8
\$\begingroup\$

I am using BeagleBoard-xM GPIO outputs to drive some DC motors with the help of L293D IC. The problem is that there is a difference between voltage levels. The GPIO outputs only supply 1.8V while L293D needs at least 4.5V for logic high. So I need a unidirectional voltage level shifting. I have BS170 N-channel FETs for this purpose. However I am not good at semiconductors. What is the proper configuration for the transistor? Do I have to use any additional components?

\$\endgroup\$
2
  • \$\begingroup\$ @curb brought forward a valid point on another answer, what speed signal are we dealing with level shifting, if you are running at 9600 baud it will be much easier then 1GHz. \$\endgroup\$
    – Kortuk
    Dec 21, 2011 at 15:34
  • \$\begingroup\$ @Kortuk Since this is for a DC motor driving circuit, the speed is not so important for me. PWM signal that will drive the circuit is at about 100Hz and I need to set duty cycle between 0 and 100. So theorically 1KHz is enough speed for me. \$\endgroup\$ Dec 21, 2011 at 22:15

3 Answers 3

6
\$\begingroup\$

The BS170 will not work very well here as it's threshold voltage (i.e when it starts to turn on) is typically 2.1V, which is higher than 1.8V.
So you could use a FET with a lower threshold voltage, but I'd probably just use an NPN for this.

Something like this should do okay:

NPN Level Shift

Be aware that the schematic above will invert the logic levels e.t. *0*V@PIN -> +V at the collector. If you can source a better FET then you can use the above circuit but swap the NPN for the N-Channel FET. In this case the base/gate resistor is not necessary, but it won't do any harm providing you don't need to switch at very high speeds (this particular solution is for lowish speeds)
Resistor values are not too critical, the R3 is to limit current flow into the base of the transistor, and R2 sets the current through the transistor.
If we assume the gain of the transistor is ~100, then if you wanted to reduce current drawn from the pin (e.g. battery powered device that needs to be power conscious) you could go a lot higher than 1k with R3 (probably up to around a maximum of 15k), as the base needs a minimum of only 5mA / 100 = 50uA to work (the 5mA comes from 5V / 1k (R2) )

If higher speed switching is needed you are probably best off with a level shift IC. Here is a Maxim page that mentions a few high speed level shift ICs.

\$\endgroup\$
7
  • \$\begingroup\$ Thanks for your valuable suggestions and the schematic. Minimum gate threshold voltage for BS170 is 0.8V, so isn't that possible to switch it on with 1.8V? What is difference between min., max., and typical values of Vgs? \$\endgroup\$ Dec 21, 2011 at 12:24
  • 1
    \$\begingroup\$ This will not work, however, for fast signals (> ca. 500kHz) because the transistor will turn off too slow. See my answer to electronics.stackexchange.com/questions/23349/… \$\endgroup\$
    – Curd
    Dec 21, 2011 at 15:18
  • \$\begingroup\$ @Emre Yazıcı: min, typ., and max means that if you have a large number of transistors of that type all possible values are in the range between min. and max. value. The typ. value is most likely one. \$\endgroup\$
    – Curd
    Dec 21, 2011 at 17:31
  • \$\begingroup\$ @Curd - No, I was assuming low speed here. If high speed is needed then a dedicated level shift IC might be a better idea. Places like Maxim,TI,etc make some decent ones. \$\endgroup\$
    – Oli Glaser
    Dec 21, 2011 at 18:33
  • \$\begingroup\$ I have implemented the circuit that is shown on the diagram. Without L293D Vr3=1.14V, Vbe=0.7V and Vce=5.54V (Power supply is 5.5V). However when I connect L293D's enable pin to the collector, Vce and Vr2 become 2.77V. Unfortunately this voltage is not enough to enable L293D. By the way, I made power supply's and the microcontroller's ground common, connected to emitter of 2N2222. Is there anything that I am missing? \$\endgroup\$ Dec 25, 2011 at 20:33
15
\$\begingroup\$

I used following circuit successfully as logic level shifter 1.8 V --> 5V for frequencies up to some MHz.
The FET I used was a BSN10A.

enter image description here

\$\endgroup\$
9
  • \$\begingroup\$ I do not think the OP has that transistor, or has he defined he needs that frequency. This might be a right answer, but can you make a right answer with his component? \$\endgroup\$
    – Kortuk
    Dec 21, 2011 at 15:35
  • \$\begingroup\$ @Kortuk: I guess it works also with a BS170 if he picks a particular device with Vgs(th) that is small enough. \$\endgroup\$
    – Curd
    Dec 21, 2011 at 17:27
  • \$\begingroup\$ Could he use two BS170s, one to step up the voltage to turn on the second fully? \$\endgroup\$
    – Kortuk
    Dec 21, 2011 at 17:34
  • \$\begingroup\$ @Kortuk: no I think that wouldn't work. If Vgs(th) in the first stage is too high a second stage doesn't help. I haven't tested, but maybe raising the 1.8 V to a value that is just high enough (>Vgs(th) but not too high) could help. \$\endgroup\$
    – Curd
    Dec 21, 2011 at 17:52
  • \$\begingroup\$ I am sorry, i have downvoted you. This is specifically because this question uses a different transistor and you are designing for speed when he does not need it and never implied he would. In this circumstance I am not sure the answer is of value. Please do not take this the wrong way, you clearly know your subject matter, but remember the focus is answering the OPs question. I hope to continue getting answers from you. \$\endgroup\$
    – Kortuk
    Dec 22, 2011 at 3:54
1
\$\begingroup\$

I'd vote for a bus switch. It's like using the circuit in Curd's answer, but with small MOSFETs optimized for this purpose (low Vds breakdown, low parasitic capacitance, low gate resistance).

We've used Fairchild NC7SZ384 for this purpose; other manufacturers make them also.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.