Hi guys, I'm trying to use the pwm signal from my arduino to control a motor with 12v, I'm following this diagram, with the exception I'm using an IRF540:
Is there anything wrong on the diagram above? The only way I was able to use the pwm signal was with this other diagram but this one doesn't use an optocoupler:
I'd like to know how can I work out the other diagram too.
Top one looks fine.
When Arduino output is high, LED will light, will turn on NPN to pull MOSFET gate low & turn off the motor. Otherwise MOSFET is on.
I see IRF530 shown as both N-channel and P-channel
yudopplyr:
Note: I added a 10k resistor to ground connected to the Gate, is it ok, or should I remove it?
It's not necessary - either the optocoupler is off, in which case the FET is turned on, or when the optocoupler is on, it is pulling the gate to ground. The resistor is only necessary when you are driving the gate directly from a microcontroller pin which may be neither "on" or "off" as the program is starting up.
tempo1218:
How are resistors (R2 and R3 ) chosen for mosfets? How are they calculated?
Sheer necromancy!
R2 and R3 relate to the fact that the gate of the FET is highly capacitive and its switching speed is limited by how fast you can charge and discharge the gate. R2 in particular needs to be fairly low - you can calculate just how fast you need it to switch and work on that and the gate capacitance to derive the value.
R3 is a curious matter - I am not quite sure what it does. The opto-coupler has a transfer factor, so the actual current it can draw is constrained, but if it is commutating rapidly, it may be preferable to have it saturate in order to pull the gate down, so that its power dissipation is minimised.