Pages: [1]   Go Down
Author Topic: Can't figure out how to use pwm with an optocoupler and a MOSFET  (Read 2565 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27114
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
http://www.digikey.com/product-search/en?x=0&y=0&lang=en&site=us&KeyWords=irf530
Do you have a complete part #?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not really, in the diagram it didn't specify that. What would you recommend me to check out if I'm connecting wrong the circuit?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27114
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The circuit is correct, if you don't have parts yet make sure you get an n-channel part.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

NSW Australia
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3562
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Now that is a bizarre arrangement, bound to cause big trouble!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At the end my IRF540 didn't work, so I bought a IRF530 N Channel, the circuit is working now using the first diagram as I linked, thanks for the help.

Note: I added a 10k resistor to ground connected to the Gate, is it ok, or should I remove it?
« Last Edit: April 13, 2014, 02:24:41 pm by yudopplyr » Logged

NSW Australia
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3562
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How are resistors (R2 and R3 ) chosen for mosfets? How are they calculated?
Logged

NSW Australia
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3562
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: