Trouble with MOSFET (maybe stupid question)

Discussion in 'General Electronics Chat' started by CanElec, Dec 31, 2008.

  1. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    I have been trying to get an ATMega32 to drive a motor via PWM through a MOSFET. After some trouble, I decided to isolate the MOSFET on a separate breadboard, take the PWM and everything else out of the equation, and play around with it to see if it is the source of my frustration.

    I think I must be wrong about this, but here's what I found...

    If you're using a power source, lets say a 9v battery, I'll call it BatteryA, for your Drain/Source to drive something, you would connect the gate to BatteryA's +ve to get the MOSFET going, then connect the gate to BatteryA's -ve to shut the MOSFET off.

    If you're using two separate power sources, lets say the same 9v from before, BatteryA, and another power source, lets say another 9v, BatteryB, things don't work the same. If BatteryA is powering your Drain/Source, you cannot use BatteryB's +ve or -ve to turn the MOSFET on and off.

    Is that correct or am I going nuts? :) Is this a simple rule of MOSFETs that I've overlooked?

    I am trying to use a separate battery pack to drive the motors, while using the uC to drive the gate. But because the uC is using a different power supply(going to the gate) than the motors, which are connected to the Drain/Source, the MOSFET is not turning on.
     
  2. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Make sure that two power supplies share a common negative connection. i.e. the -VE of both is connected together.
     
  3. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0

    This is what I was thinking. But doesn't making both power supplies common ruin the isolation from noise etc that is the purpose of having two separate power supplies?
     
  4. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Having two separate power supplies does have its advantage and noise can be minimised.

    However, you will need special techniques to pass the drive signal from one system to another, e.g. via drive transformer or optocoupler.
     
  5. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    Can this be done even if the two power supplies are at different voltages? Say one being a 9v battery and the other being 4 AA batteries in series for a total of 6 volts.

    And maybe another dumb question, but if you make the -ve terminals common for both power supplies, can't power flow from one battery's -ve terminal to the other battery's +ve terminal? Or will an electron from batteryA only flow to batteryA's +ve terminal, even though with both -ve's connected, an electron from batteryA could flow to batteryB's +ve terminal?

    Doesn't connecting the -ve terminals create a problem with current flowing between batteries? After an electron has left from the -ve terminal of one battery, how does it know which +ve terminal to go to if they are both attracting it with the same potential(ok here I'm assuming the use of two batteries with the same voltage)
     
  6. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    If two isolated low voltage DC power systems is linked together with a single link, then no current will flow through the link. You can prove that easily with Kirchoff's circuit laws.
     
  7. hobbyist

    Distinguished Member

    Aug 10, 2008
    764
    56
    When I designed my motor controller, with 2 seperate power supplies, I had a 8v. supply, connected to the mosfet drain and source and load, and the other supply through driving circuitry connected to the 18 volt, source, I had to connect both neg. terminals together in order for the mosfet to recieve a signal at it's gate.
    Because the gate of a mosfet (enhancement) must be positive or neg. respect to the source terminal. So if the source term. and the gate term. don't have a common ground at there respective supplies then there is no potential between the gate and the source. So you need a common ground for more than one supply to be used with any circuit, using electron signals. The only time you wouldn't need a common is if the signals were opto isolated or magnetically isolated (relays and mechanical connections) and such.
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    What is the part number of the MOSFET that you are experimenting with?

    Standard N-channel MOSFETS will be off (open circuit) between the drain and source terminals when Vgs (voltage at the gate, using the source terminal as the reference point) is 0, and on (low resistance) between the drain and source when Vgs is 10v. They'll start conducting at a lower voltage, but it's best to get the gate up to 10v.

    P-channel MOSFETs are off when Vgs=0, and on when Vgs=-10. This can be confusing at first, but with P-channel MOSFETs, the source terminal goes to +V instead of ground like with the N-channel MOSFETs.

    There are also "logic level" and "low threshold voltage" MOSFETs. To my knowledge, all of these are N-channel. Logic-level MOSFETs are convenient for microcontroller applications, because the gate drive circuit can be much less complex than for standard MOSFETs at low speeds.

    Keep in mind that your microcontroller's outputs have limited current capability. You will need to use a resistor between the uC's output pin and the MOSFET gate to limit the peak current flow. If you are using a standard MOSFET, you will need a more complex driver circuit, or the MOSFET will get hot in a hurry.
    [eta]
    See the attached for circuits you could use in testing N-channel and P-channel MOSFETs.
     
    Last edited: Jan 1, 2009
  9. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    edit: double post
     
  10. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    I am using an IRLZ44A MOSFET with a 10ohm resistor between the uC pin and the MOSFET gate. I have connected both -ve terminals and the circuit works now. Thanks to all who helped.

    One more question though. I have attached an image of two power supplies in parallel(A) and the configuration I'm using now, two power supplies with common -ve (B).

    In the case of B, what is to stop electrons flowing from 1's negative terminal to 2's positive terminal?

    Say 1 is a D cell battery and 2 is a 9v battery. You only want 1 to discharge through it's load, but because the negatives are common can't electrons flow between batteries now (electrons flowing from 1's neg to 2's pos) ? Also if this happens will it cause a problem with the batteries? Is current able to flow from one battery to another? If you say hooked up the neg term from one battery to the pos term of another?

    Thanks to all for the replies. I enjoy getting things working but I think the learning is much more important. :)
     
  11. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Batteries can't interchange charge through the common negative connection unless the function of a component allows it or a fault occurs.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Your MOSFET has a total gate charge of 66nC. This is a capacitive load to your uC. You must use a large enough resistor to keep the maximum current draw within your uC's specifications, or you will soon burn out your uC.

    R = Vdd/MaxCurrent
    For example, if you're using +5v for Vdd supply to your uC, and if it's maximum source/sink current is 25mA, then:
    R = 5v/25mA = 5/0.025 = 200 Ohms.

    The batterys' negative terminals are tied together. This serves to keep all voltages in the circuit referenced to the common tie point.

    The only complete circuit that each battery has is through it's respective load resistor.
     
  13. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0

    This would explain why my PWM just stopped working lol. Luckily I have a few spare uC's laying around. Thanks!
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I guess I'm a day late and you're a few Ohms short. :rolleyes: ;)

    Keep in mind that since the current source/sink to/from the MOSFET's gate is limited, you should keep your PRF (pulse repetition frequency) fairly low, otherwise as the PRF increases your MOSFET will spend more and more time in the linear region (at some variable resistance rather than "ON" or "OFF").

    This will cause the MOSFET to dissipate heat.

    Have a look at the attached schematics & simulation.
    The 555 timer's output is a 5v pulse with a PRF of 50kHz, displayed as the pink trace. This is a simulation of your uC's PWM output; what frequency you're using I don't know - however it'll give you a decent idea of what your MOSFETs' gate charge will look like at medium frequencies.

    The red trace is the voltage on the gate of M2. Notice how long it takes to charge the gate up to nearly 5v, and how long it takes to discharge the gate to near 0v. R21 is the 200 Ohm current limiting resistor. R22 is a "safety" resistor; it ensures that Vgs=0 when there is no power to the system, or in case R21 or the output pin of the uC fails.

    The green trace is the voltage on the gate of M1, which is controlled by an improved driver circuit. Notice how much more quickly the gate of M1 charges and discharges than M2. Additionally, the load on the 555's output is 1/5 the current required by the original driver circuit.

    The components were carefully chosen, and should not be changed if you want to have similar performance results. In particular, D1 is a critical diode; it has a very low Vf (forward voltage).

    I didn't have an IRLZ44 in the default library; the selected MOSFET has similar gate charge and other performance characteristics to yours.

    If your PWM PRF is low (below 1kHz) you won't have to use a driver circuit like this. However, you may notice that your load "sings".

    If you'd like to experiment with the simulation, you can download LTSpice/SwitcherCad for free from Linear Technology's website. The .asc attachment is the simulation.
     
  15. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    I am using a PWM frequency of approximately 15KHz. I'm assuming PRF is just your PWM frequency correct? Thank you for all of your help.
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    PRF = Pulse Repetition Frequency. Since the output is basically a pulse which is made up of all of the odd harmonics of a fundamental frequency, it is more accurate to use the term PRF than simply "output frequency".

    I've adjusted the PRF of the simulation to show you the difference the driver would make for your PWM output. Note that the maximum load on your uC's output is 4mA instead of 25mA for your current circuit. I made a small change (moved R5 to the anode side of D1) that significantly improved the turn-off time. Note that the leads of Q3 must be very short, and very close to M1 to minimize their inductance, or H.F. oscillations may occur.
     
  17. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    Do you mean the maximum load is now 4mA if I use the driver circuit you've showed me, or does that apply irregardless? I looked up the max current from a pin on the datasheet and it said 40mA, so I figured I could get away with 125ohm resistors at the base of the MOSFET.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes
    No, with the 200 Ohm resistor, there are peak loads of 25mA.
    Yes, you could do that - but you must also be aware of the total current that all of your outputs are sourcing/sinking, and stay below the maximum rating of the entire uC as well as below the maximum of each pin.

    125 Ohms is not a standard value. You could use a 130 Ohm and a 3300 Ohm resistor in parallel to get approximately 125 Ohms.
     
  19. CanElec

    Thread Starter Member

    Nov 23, 2008
    24
    0
    Yes I saw a 200mA total current for each port (8 pins total) or something like that. Thanks for all your help! :)
     
Loading...