# problem with driving the mosfet through optocoupler

I want to run the mosfet (irf540n) through opto coupler(4n25) for driving the motor. I refered some formula from this website, but my circuit is not working.

I calculated opto coupler current limting resistor by using this formula:

Rf = (vin-Vf)/If = (5v-1.15)/10ma = 385R

then calculated the mosfet gate resistor using

5v/150ma=34R

but this circuit is not working.

I tried this circuit too but not working.

• You can do all calculations you want but if your circuit is not correct it will never work. Show us your schematic first. – Bimpelrekkie Sep 15 '15 at 6:52
• You have to charge/discharge the gate capacitance to turn off/on, using just one gate resitor wont work, because MOSFET aint BJT. – Marko Buršič Sep 15 '15 at 6:56
• @MarkoBuršič Well, we don't know whether there is a pull-up (or pull-somewhere) resistor in that secret circuit … – CL. Sep 15 '15 at 9:18
• R2 is way too small in your second schematic. It is only there to pull the gate low when the opto-coupler is off. Try something around 10K. – Tut Sep 16 '15 at 11:50
• For more on determining the pull-down resistor value, see: Calculating the pulldown resistance for a given MOSFET's gate – Tut Sep 16 '15 at 12:07

simulate this circuit – Schematic created using CircuitLab

Is a circuit that should work for you. D1 and Q1 are used together to form the opto isolator. The values are just ball park, the schematic is just meant for topology purposes.

• Where did you get the load resistor value from? – Andy aka Sep 15 '15 at 8:25
• @Andyaka It's just balk park values. I was going for topology not values. – vini_i Sep 15 '15 at 8:27
• sir ,actually i dont know to calculate gate resistor please say me how to find it – vivek j Sep 16 '15 at 8:00
• the gate resistor needs to be just large enough to keep the inrush current in check. The maximum rating for the 4N25 is 150ma, so at 5v i would make the resistor (5/0.15=33.3) about 33ohms. – vini_i Sep 16 '15 at 10:33