View Full Version : Driving BS170 FET From BS2 pin

04-21-2007, 07:55 AM

I need to switch 1 Amp (max)·at 12 Vdc and plan to use a BS170 FET.

Can I connect the BS170 directly to a BS2 pin? Is a resistor needed between the 12Vdc supply and the BS170?

Should an optical isolator chip be used to protect the BS2 if something happens to the BS170?

I assume a logic HIGH on the BS2 pin will turn the BS170 FET on. Is this correct? I've not worked with FETs before.


PJ Allen
04-21-2007, 08:06 AM
In this drawing, " +V " is 12V --

Mike Green
04-21-2007, 08:10 AM
If you are worried about something happening to the Stamp I/O pin if the BS170 melts or something like that, just connect a 470 ohm or 1K resistor between the gate and the I/O pin. The resistor would limit the current into the I/O pin to roughly 24ma or 12ma respectively which would not be a problem for the Stamp and should not significantly change the function of the circuit.

04-21-2007, 08:19 AM

If I replace the relay, in the circuit diagram you provide, with a 12 Vdc fan do I need the diode?

Phil Pilgrim (PhiPi)
04-21-2007, 08:38 AM
One thing you should always do when driving a MOSFET from a BASIC Stamp pin is to connect a resistor (100K is fine) from that pin to ground. When the BASIC Stamp powers up or is in reset, or if you're uploading a new program, its pins are all inputs. By itself, a MOSFET's gate draws no current. So, whenever the Stamp pin driving it is an input, it could float high enough to turn the MOSFET on. This could have dire consequences if the MOSFET is controlling a device that could do some damage. The resistor to ground will prevent this.

BTW, the BS170 is a poor choice to drive with a BASIC Stamp. Its gate threshold voltage is too high, and its transfer characteristics are spec'd with a VGS of 10V. Use a "logic MOSFET", like the IRL520 shown in PJ's schematic. It will turn on fully with a 5V drive signal. (And yes, even with a fan, as with any inductive load, you need that diode, unless the MOSFET is protected internally with a zener between drain and source. But even then, I'd include the diode.)


Post Edited (Phil Pilgrim (PhiPi)) : 4/21/2007 1:55:39 AM GMT

Mike Green
04-21-2007, 08:42 AM
The diode is needed for any inductive load. This includes solenoids and motors, anything with a coil of wire involved..

04-21-2007, 08:53 AM
The 12 Vdc fan has a motor in it, I assume with windings. So, should I use the diode? Thanks.

Mike Green
04-21-2007, 08:57 AM
What do you think? Do you understand why a diode would be used or needed? It's been mentioned before and is in the various Parallax tutorials.
What difference would it make if you used a diode in this way and it wasn't needed? You need to know these things.

04-21-2007, 08:57 AM
Phil, thanks for the detailed explanation. Now I understand.

Also, thanks to everyone else for your help. I'm ok now.