Problem with driving the mosfet through optocoupler

mosfetmosfet-driver

enter image description here

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.


Thanks for your answer, now I attached the image of my schematic. Please check it.

enter image description here

Best Answer

schematic

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.