MOSFET Current

Discussion in 'General Electronics Chat' started by Chiliyago, Feb 18, 2011.

  1. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    I am trying to build a small circuit that turns on/off an array of LEDs. I am using an IRF510 MOSFET.

    Here is how I have it hooked up:
    • Gate: PWM
    • Source: Negative lead of the LEDs
    • Drain: Ground
    • Positive lead of LED's to 4.5V

    Is this correct?
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No, that is not correct.
    Source goes to ground, LED cathodes connect to drain, current limiting resistors between +4.5v and LED anodes.

    You really should post a schematic of your circuit. If you did not use current limiting resistors, your LEDs may already be fried.

    You also need to indicate what you are using for PWM, as the IRF510 requires a Vgs (voltage on the gate referenced to the source terminal) of 10v to turn fully ON.
     
  3. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    10 Volt for the Gate!? Wow. I need something else then. My PWM volts are not that much for sure.
    I am using this FEZ Domino device for the PWM.

    What other type of MOSFET can I use instead of the IRF510?

    There is a photo of my breadboard
     
    Last edited: Feb 18, 2011
  4. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    My Voltage from the PWM pin is 3.3 volts. I believe the RFP30N06LE using a 1V Threshold Gate Will work. Do you agree?
     
  5. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    The threshold voltage of a Mosfet is when it is almost turned off with a current of only 0.25mA. You need to know and provide enough gate-source voltage for it to be completely turned on with a very low spec'd on-resistance.

    The on-resistance of most Mosfets is spec'd when the Vgs is 10V. Logic Level Mosfets have their on-resistance spec'd with a Vgs of 4.5V to 5V.
     
  6. Jaguarjoe

    Active Member

    Apr 7, 2010
    770
    90
    This may help:

    http://focus.ti.com/general/docs/gencontent.tsp?contentId=67201

    There are tons of gate drivers available. Look for 3.3v input compatible, a supply voltage you can provide, the correct output level to mate with your MOSFET, and if you want a straight thru non-inverting device, or an inverting job that flips yor signal upside down. Make sure it is available in a package you can work with.

    If you have problems driving a 10 volt gate, like AG says, there are logic level MOSFETs readily available. Most, like IR's units, have an "L" in their part number- like IRL530, a commonly used device.

    If you're lucky, you may even get free samples.
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I don't see a schematic yet. You're going to need one in any event. Schematics are the "language" of electronics; the image is worth a thousand words and eliminates many questions.

    What is the base frequency of your PWM? If you're beyond a kHz or so, a gate driver will be a must.

    How much is the current load when the MOSFET is on? A proper schematic with the typical Vf and If of the LEDs documented will tell that tale.

    The RFP30N06LE should conduct with a Vgs of 3.3v, but it has a rather large gate charge at 36nC, and your current requirement is unknown. There are many logic-level MOSFETs with a far lower gate charge that might be used, depending on your situation.

    Right now, there are too many unknowns to make a recommendation.
     
  8. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    What is the best (errr simple?) tool for making a schematic? I can set PWM frequency to most frequencies. Currently set to 60hrz
     
  9. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    Here is the schematic of my meager project.
    Thanks for looking.
    [​IMG]
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, your NPN shown is a bjt (bipolar junction transistor) instead of an N-channel MOSFET, which symbol in LTSpice is referred to as "nmos". Also, you're using the bjt as a voltage follower; about the highest output you'd get from the emitter is 3.3v less the be junction of around 0.63v, so 2.67v max.

    To get you going, see the attached schematic and simulation. I've used a 2N2222 transistor with a 270 Ohm base resistor to limit base current - and more importantly, limiting current from your microcontroller output to < 10mA. If you load your uC's output too heavily, you'll damage it.

    The transistor Q1 is commonly available, your local Radio Shack stores sell them. You can get a 15-pack assortment of NPN transistors for a couple of bucks. Generally, this assortment contains:
    5 - 2N2222 transistors, good for sinking up to around 500mA current (requires 50mA base current)
    5 - 2N2904 transistors, good for about 100mA (10mA base current)
    5 - 2N4401 transistors, around 200mA (20mA base current)

    For now, just concentrate on getting a single LED working, and controlling it's brightness successfully.

    Note that the simulation is using 200Hz for the base PWM frequency. This is a good place for you to start. If your PWM base frequency is too low, you'll start to notice the flickering, and it will be tiresome to look at.

    By the way, a note of safety and caution - many of the new super-bright LEDs can cause permanent vision damage if you look at them directly for a period of time. You won't even notice the damage occurring. It's a good idea to use a diffuser to spread the light out. This can be as simple as a white plastic spray paint can top, a plastic frozen food entree' container, or even a plain sheet of white paper between your eyes and the LED(s). You only get one set of eyes, so protect them.

    Calculating LED current limiting resistors:
    Rlimit >= (Vsupply - Vf_LED) / DesiredCurrent
    In my simulation, I used a blue LED that has a Vf of 3.73v @ 20mA current. So:
    Rlimit >= (4.5v - 3.73v) / 20mA
    Rlimit >= 0.77v / 0.02A
    Rlimit >= 38.5 Ohms.
    39 Ohms is the closest standard value of resistance.
    There is a table of standard resistance values here: http://www.logwell.com/tech/components/resistor_values.html
    Use the E12 or E24 columns; the E48 and higher are a good bit more expensive than E12/E24 values.

    When using transistors as a saturated switch, you need to calculate the base resistors.
    To calculate base current limiting resistors, you first need to know how much current you expect to sink from the collector. I've previously defined this as 20mA current from the LED.
    The base requires 1/10 of that amount of current in order to saturate the transistor. By saturation, it's meant that increasing the base current will not result in a corresponding reduction of the collector-emitter voltage.

    Rbase = (Vin - Vbe) / (Ic / 10)
    where:
    Vin = the voltage on the side of the resistor that is on the opposite side of the transistors' base connection, referenced to the transistors' emitter. In your case, it's pretty easy because the emitter is connected to ground, and your uC's Vout is 3.3v.
    Vbe = typically 0.7v up to around 1/3 of the transistors' maximum collector current rating.
    Ic = desired collector current, in this case 20mA

    So, let's substitute and calculate:
    Rbase = (3.3v - 0.7v) / ( 20mA / 10)
    Rbase = 2.6v / 0.002a
    Rbase = 1,300 Ohms. From the table link, you can see that 1.3k is a standard E24 value, shown as 130.

    However, I've used 270 Ohms in the simulation, just to give you more current sinking capability - as I'm sure you will want to add on a few more LEDs after you get this single LED working.

    Each LED will require their own current limiting resistor.
     
    wes likes this.
  11. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    Wow. Lots of information. Can you send me you LTSpice file? I can use it for learning that tool better. I have not been able to create a nice model with LTSpice on account of my lack of understanding the LED components it provides. I Still not understanding the purpose of the resistor on the base. Why is that required ?
     
    Last edited: Feb 20, 2011
  12. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    The resistor in series with the base of the transistor limits the current so that the base-emitter doesn't blow up and so that the output of the microcontroller doesn't blow up.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, you seemed to be just a bit confused about MOSFETs vs BJTs, and you used a BJT in your simulation (which will be easier to deal with due to the low logic level output voltage from your uC), so I tried to give you some fairly easy-to-understand formulas to show you how I arrived at the values that I used, how/why I chose them, and the order in which you need to perform the calculations to arrive at a viable solution.

    It might seem a bit intimidating at first, but read it through a few times, do the math yourself, experiment with it in LTSpice, and once you feel you're "getting the hang of it", try it out with real parts.

    Note that SPICE simulations are not 100% accurate. They merely provide a starting place. SPICE components are "ideal"; you cannot buy such ideal parts.

    I'm attaching it as "PWM LED transistor.asc".

    However, in order to get it to run, you will need to add my modified standard.dio library, which is attached as "standard.dio.txt". It is a plain text file that contains a number of additional diodes (including some typical LEDs) over the standard LTSpice library.

    Download "PWM LED transistor.asc" to your:
    C:\Program Files\LTC\LTSpiceIV\SwitcherCad directory (your mileage may vary on the path)
    Download "standard.dio.txt" to:
    C:\Program Files\LTC\LTSpiceIV\SwitcherCad\lib\cmp
    Rename standard.dio to standard.dio.bak - this way you can always revert to the original if you mess things up.
    Rename standard.dio.txt to standard.dio

    If LTSpice is open, close it and re-start it. You'll then see a bunch more diodes in the library when you place a diode, and right-click on it.

    Absolutely. :)

    It will help you a lot to look up the datasheets for any components that you are using. It'll help you even more once you start adding components to the libraries.

    Perhaps you are still uncertain about differences between enhanced MOSFETs and bjt's (bipolar junction transistors).

    They have a number of similarities, in that both have three terminals, and the difference between what I'll call for the moment a "control terminal" and a "common terminal" controls current flow through a third terminal.

    A bjt collector is roughly equivalent to a MOSFET drain terminal.
    A bjt base is roughly equivalent to a MOSFET gate terminal.
    A bjt emitter is roughly equivalent to a MOSFET source terminal.

    However, BJTs are current-controlled devices, where MOSFETs are voltage controlled devices.

    A MOSFET gate acts more or less like a capacitor. When charge it up until Vgs=10v (N-ch MOSFET), the MOSFET is turned on, and current can flow between the drain and source terminals. When you discharge the gate until Vgs is below the threshold voltage (specified in the datasheet) the MOSFET is considered turned off, and the resistance between the drain and source terminals is very high; so high that only very small amounts of current can flow, if at all.

    A bjt's collector current is controlled by a smaller current flowing from the base to the emitter (conventional current flow, NPN transistor). The base-emitter junction "looks" electrically like a forward-biased diode. If you connected a voltage source across the base-emitter junction that is not current limited, very high current would flow through the base-emitter junction, and the transistor would be destroyed.

    However, in your case, the voltage source is the output from your microcontroller, which has limited ability to source or sink current. Many microcontrollers have a +/-20mA limit, but I've cut that in half for some margin for safety.

    You really need to look at the datasheet for your controller and check the electrical properties section to determine what the maximum ratings are for I/O current, both for individual pins, and the package limit. If you ignore these details, you risk destroying your microcontroller.
     
  14. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    A PIC microcontroller is made with high speed Cmos parts (like 74HCxxxx) which have a max allowed output current of 25mA but Texas Instruments shows max currents of 60mA. With a 5V supply then the direct current into the base of a transistor will be about 58mA and the heating in the output of the PIC is 58mA x 4V= 232mW which will melt the output device.

    The max allowed base current of many small transistors is only 20mA.
     
  15. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    SgtWookie,

    I created a model using the files you posted and have a question I am hoping you can help with.

    When I run the simulation in LT Spice the voltage on the source side of the transistor remains at 3V even though I upped the Volts on V1 to 12. Why is that? I thought the Volts would be the same on both sides.

    See attached image.

    Thanks
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You completely changed the circuit.
    I used the transistor as a common emitter saturated switch.
    You're using them as a common collector voltage follower.
    As such, the voltage on the emitter will never reach the voltage on the base.

    You have far too many LEDs in a series string. Each will drop from 1.2v to 3.8v, depending on the particular LEDs you are using. Refer to the datasheet or specifications for each type of LED.

    Perhaps someone else will help you with this; I'm completely out of time.
     
    Last edited: Mar 8, 2011
  17. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    Well I am not actually making your circuit. I was trying to expand the concepts in your circuit to my own. Sorry your out of time.
     
    Last edited: Mar 8, 2011
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    To use an NPN transistor as a saturated switch in your circuit, you need to ground the transistors' emitter, and place the load (the LEDs) between the collector and +12v. The current limiting resistor for each string should be between +12v and the anode of the top LED. Each string requires its' own current limiting resistor.

    The LEDs in the library will differ somewhat from the LEDs you get.

    You need to calculate how many LEDs you can run in a series string.
    Subtract 1v or 10% from the +V, and then divide that by the typical Vf specification of your LED, and take the integer result.
    For example: a hypothetical red LED, Vf=2.1v @ 20mA, +V=12v
    MaxLEDs = INT((12V-1)/2.1v)
    MaxLEDs = INT(11/.02)
    MaxLEDs = INT(5.2381)
    MaxLEDs = 5
    Then you need to calculate the limiting resistor
    Rlimit >= ((+V-(VfLED*LEDsInString)/DesiredCurrent)
    Rlimit >= ((12v-(2.1*5))/20mA
    Rlimit >= (12v-10.5)/.02
    Rlimit >= 1.5/.02
    Rlimit >= 75 Ohms
    A table of standard resistance values is here:
    http://www.logwell.com/tech/components/resistor_values.html
    You can see that 75 Ohms is a standard value in the E24 series (green columns).
     
  19. Chiliyago

    Thread Starter New Member

    Jan 5, 2011
    11
    0
    Thank you so much for this. I know your pressed for time but I sincerely appreciate you knowledge.

    What is the syntax for altering the LED specifications in the standard.dio file?

    for instance the specification
    .MODEL REDLED D(IS=93.2P RS=42M N=3.73 BV=4 IBV=10U CJO=2.97P VJ=.75 M=.333 TT=4.32U Iave=30mA Vpk=1.7 mfg=RED type=LED)

    Is there a reference that defines the IS, RS,N,BV,IBV,CJO,VJ,M,TT,Iave,Vpk,mfg,type parameters?
     
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, look in the LTSpice help, under "D DIODE".

    But, the models that are already in that file will work OK as-is for a number of low-power LEDs; you might just try using different LEDs until you get results close to what you're expecting.

    Right now, you need to re-configure your circuit to closer to what I had.

    Note that when I last posted, I said take off 1v or 10%; that is for a well-regulated 12v supply. You can't use those same numbers for an unregulated supply, or you'll not get good results.

    Someone else will have to explain it.
     
Loading...