MOSFET Control Circuit

I built a N-ch mosfet circuit for various loads using IRF520N and a low power transistor BC548C(NPN).
Altrough it works and is sensible enough to turn a 50W lamp on just when i touch input an ‘+’ end,on arduino it won’t work even if they are powered by the same 12V 4.5 A Pb-acid battery.This is the program i used for testing (i tried pin 11,12) and the eagle schematic with values. Arduino board works fine .
Thank you .

sketch_may29a.ino (297 Bytes) (5.3 KB)

Could you attach a *.pdf or *.jpg or *.png for the schematic ? In the menu is a auto-format for the text. Could you try that ?

Hope it can be seen.
It’s in Eagle window snip.
Bjt resistence(resistor)=470 ohm.
Gnd-gate resistence(resistor)=18kohm
gate-emmiter resistence(resistor)=330 ohm


The IRF520N is not a "logic level" mosfet. Now you have to increase the gate voltage. The transistor won't work, since the base voltage is the output voltage of the Arduino pin (5V). You need a PNP transistor to increase the gate voltage. But it is better to use a "logic level" mosfet.

This is the mosfet that Sparkfun has choosen :

Other solutions .I don't have any logic level mosfets around.How do i use the pnp bjt? Thanks.

IRF520N is N-channel MOSFET. Use 1K pullup to +12 to turn it on. Use NPN with emitter to Gnd, Collector to the MOSFET Gate to pull Gate low to turn it off.

I can't find a schematic with PNP, and I can find a lot with NPN, like this one (figure 1) : The drawback is that when the Arduino is turned on, the transistor is not active yet, and the mosfet will turn on. In many cases that is not a safe design. (I think figure 1 is the same as CrossRoards mentions)

Or do you have an optocoupler ? An optocoupler with resistor to turn it on with Arduino output pin, and the the output from 12V to gate (with two extra resistors).

So add a 1K pullup to 5V to NPN base to turn it on and keep MOSFET off until such time as the Arduino comes alive and starts driving the NPN.

Thank you.I do have 2 optocuplors in my toolbox so i think ill try this solution.Thank you all for help. :slight_smile:

It may sound a bit stupid but how do i output '-' voltage(drive the NPN) in this case (NPN has 1k to+5 v) like CrossRoads sugested? Can i write "analogWrite(-255);"?

Do you want to control the brightness ?

analogWrite ( pin , 0 ) ; is the same as output 0V.
analogWrite ( pin , 255 ) ; is the same as output 5V.

So if the lamp is off with 5V, and on with 0V, then value 255 is off and 0 is on.

int brightness = 10;      // 0 (off) to 255 (on)
analogWrite(pin, 255-brightness);   // it is an inverted circuit

You can also use a MOSFET low-side driver chip.

Thank you.It works now,and the mosfet stays pretty cold .I just finished this "v2" .