Mosfet and optocoupler

Hi. Would this ( on the schematics ) be a good way to drive mosfet thru optocoupler ?

I want to pass 12V ( 40W ) to circuit output when i detect some value on one of the sensors.
To be sure i have planned to add one safety diode into the circuit...

Final product will be one head on top PCB.

A

No, not with that (P-channel) MOSFET.

Why do you need an optocoupler? From the schematic there's no clear need for galvanic separation.

Hi,
I have redrawn your schematic so you can see the signal flow;

Crossing wires can make for a confusing layout, here your signal flows from left to right.

Tom... :smiley: :+1: :coffee: :australia:

i agree with @koraks, why do you need an optocoupler? are you trying to design a gate driver circuit? if so, that seems excessive for an LED

Almost; you've drawn a sensible schematic with an N-channel mosfet. But that's not what OP did, and it does happen to be the stage where there's a serious problem.

Hi,
I missed the fact that you had a P-CH MOSFET in your circuit.
The P-Ch MOSFET would be conducting all the time through its D - S protection diode.

A N-CH, as shown, will work a whole lot better in that configuration.

The opto coupler looks like its acting as a level shifter.

We await @arnix reply..

Tom... :smiley: :+1: :coffee: :australia:

Than you guys for your input !... maybe it would be better to describe this in detail :-).
When i was using old board ( just wires ) i have used ready made 2 relay board with optocoupler and at that moment we didnt know why the system crashes every time relay triggers.
We finally checked power consumption of end device and then find out that he uses 40W !
I was calculating that it should be around 15W but we didnt have any datasheet, so...

The problem remain until we have separate power lines of relay and arduino.
After that we switched to mosfet but i would like to add OC and diode to this so i can be sure that nothing will happen in the future..

Btw. i have used Eaglein past, but before few days i switched to kiCad. What lib do you use for mosfets or, what program are you guys using for schematic design ?

A.

Ok, sounds like you're trying to prevent a problem that you don't yet understand, and I would suggest in that case to go back one step and nail down the cause of your crashes before designing a new version of the circuit. For all we know you're still dealing with undefined parameters and hence a good chance of disappointment.

Hi,

I use ExpressPCB CAD, just for using here for quick diagrams.
I use EASYEDA for major projects that require PCB files.
https://www.expresspcb.com/
I use the CLASSIC Version.

Tom... :smiley::+1: :coffee: :australia: