# how to drive a N channel Mosfet transistor

Hi I'm using an atmega 16 chip to drive a BS170 N channel enhancement mosfet. I'm unsure how would I go about this. Having read the datasheet, I'm guessing I set the pin the fet is connected to as a output pin. I would then set the PORTxn to high for on and low for off. Yes?

I would have eight of these connected to the same chip. Is that ok?

-

Yes that would work. Connecting 8 to the 8 outputs should be fine. Just remember MOSFETs are ESD sensitive.

-
 Why do I have to be careful in this instance? I'm not quite understanding. I'm very new to electronics. Been forced into doing this. Are u saying I need some sort of protection diode? but I thought that was for induductive loads? Its leds am switching – Ageis Apr 20 '11 at 20:07 No just when handling them such as placing in breadboards and things. – Dean Apr 20 '11 at 20:20 ah thanks. I assumed it was something more complictaed lol – Ageis Apr 20 '11 at 20:44

Yes.

Did you also read the datasheet for the BS170? Datasheets are documents you have to learn how to read. In case of the BS170 $V_{GS}$ (page 2) is important. It's the minimum gate voltage at which the MOSFET starts conducting. For the BS170 this $V_{GS}$ can be anything between 0.8V and 3V. This wide range is typical of MOSFETs. It means that in a worst-case scenario you only get 1mA of drain current when driven from a 3V microcontroller, which isn't enough to drive a LED! If you're using the ATmega16 (and not the ATmega16L) you won't have this problem.
Most important graph for the BS170 is figure 1 on page 3.

This shows that at $V_{GS}$ = 5V you can have 800mA of drain current.

MOSFET's gates are extremely ESD sensitive; you can zap them just by looking at them, so to speak. Make sure you're properly grounded when handling them (antistatic wrist strap), this also goes for your soldering iron.
I also make it a habit to have a resistor from the gate to the source, this ensures that the BS170 remains off when for one reason or another the gate should be floating. This can be a 1M resistor.

-
 How do you make sure your iron is grounded? Just touch it to metal before you solder or something more clever...? – Nick Halden Jun 24 '11 at 13:33