I'm currently working on a circuit that later should control a pump. For the debugging I replaced the pump with a LED and ramp up the signal every second (0>25>75>100%). In the end the PWM signal of the Arduino should control the LED/pump. But the LED is fully on (maybe a bit flickering) I tested following things:
Disconnect the arduino pin >> LED still on (shouldn't it be off?)
Disconnect the Vin >> LED is off (OK)
Connect the arduino pin directly to the gate >> LED full on (should follow the ramp)
Remove R2 >> still got the problem.
Switched the MOSFET >> still got the problem (=part is not broken or both).
Connected the LED directly to the Arduino pin >> works as it should.
I got the sketch (and part list) for the circuit from a tutorial, but unfortunately can't find it anymore online.
At this point I have no more ideas what the reason could be, I don't think its the optocoupler. Maybe there is something fundamentally wrong with the circuit... Can somebody spot the problem?