Arduino mosfet and horn


I have a question about my circuit, I would like to turn on/off a car horn which draws around 8 Amps at 12 Volts with arduino and mosfet as seen in the picture. Before I didn’t use optocoupler and transistor to turn on the mosfet I did that directly from arduino pin and it worked like a charm, but I would like to add some safety to my circuit, so my question is, will this circuit work properly? and if I use transistor is it still necessary to use 47k Ohm resistor between gate and source of mosfet so it doesn’t accidentally turn on? also does R3 have correct value?

I forgot to add that on the schematic but Q1 is BC 337 NPN Transistor, and LOW on the schematics = digitalWrite(pinNumber, LOW).

Many thanks in advance for all Your help guys.

but I would like to add some safety to my circuit,

"Safety" from what???

[u]Here is a MOSFET driver circuit[/u].

If you want to use that circuit, I'd lower the value of R3 because R3 & R4 make a voltage divider and you're only driving the MOSFET with about 4V. Or you could drive the MOSFET directly with the opto-isolator, just using it's built-in phototransistor in place of Q1.

D1 is wired across the coil of the motor to prevent reverse EMF from damaging the MOSFET

and optocoupler to separate MCU from Mosfet circuit.

Anyway I changed the schematic a bit, any Resistor required on a phototransistor side?

Yes, clamping the gate pin to GND will cover for any unexpected floating on the pin from a control aspect... because you are going to remove that Optocoupler.

Unless you plan to run your arduino from battery or from a totally different power source (unlikely), then they (the controller and the "controlled" ) will share a GROUND path... making the use of an optocoupler illogical.

You already have enough isolation from the 12V rail with the mosfet. Don't fear it... you won't get 12 Volts back-fed through the gate.

Opto couplers are for cases of full galvanic isolation and basically wasted when that's not the case.

Problem solved. Thanks for the help :slight_smile:

You've drawn that transistor upside down - please stick to the conventions of positive at the top, negative
at the bottom, otherwise diagrams become unreadable and confusing.

The opto coupler is a very good idea if there is any risk at all of the MOSFET failing - once a mosfet
fails it will likely destroy anything connected to the gate.

The opto coupler output should just connect 12V to the gate to turn the MOSFET on directly, the original
circuit was completely over-thinking it (and not providing any opto isolation). And of course a pull-down
resistor between gate and source of about 1k.

To opto-isolate the isolation barrier must be between the 5V and 12V circuits, with no wires crossing the

MarkT beat me to it. I agree the opto is a good idea and the two systems should be isolated.

I would keep the 4N25 but have it drive the MosFet gate directly from the +12 V. I would put some resistance between the +12V and the 4N25 and add a 18V or so zener. The Zener will limit voltage spikes from the vehicle +12V system from damaging the opto output and Mosfet Gate input.

Note: Depending on the mfg of the vehicle (if this is a vehicle) the +12 Volt system can have some pretty long time duration pulsed on the +12 line. In the 10's of ms at either 50 or 80 Vdc (by specification)