problems with arduino controlling fet

Discussion in 'The Projects Forum' started by magnet18, May 15, 2012.

  1. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    Alright, been a bit since i asked for help, but here goes
    Im working on a project in which i have 12 strands of 3 ultrabright led's each, with resistor
    These are powered by a 12 volt lead acid battery
    Im trying to controll these leds with a pwm pin on an arduino to achieve a fading effect
    Currently, i have the arduino powered off the 12 volt battery, with pwm pin 9 going to the gate of an irfs654b mosfet, which has its drain on the 12v+ and source at the positive end of all the led strands
    it works, in that if i connect the gate of the mosfet directly to 12v or ground the lights turn on or off, and ive scoped the waveform at pin 9 and it behaves as expected, and when connected directly to an led it works fine, but when i hook the gate to pin 9, nothing happens. I cant figure out why.
    Is the 5v output not enough to trigger the fet?
    Does the fet need to be between the led strings and ground?
    Any help appreciated, thanks guys
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    You have two problems:

    First, you are connecting the MOSFET as a source follower so the output voltage is equal to the gate voltage minus the Vgs ON voltage of the transistor. With 12V on the gate you get enough source voltage to light the LEDs, but 5V is not enough to turn on the MOSFET and also give significant voltage at the source for the LEDs.

    Since that MOSFET requires 10V Vgs to fully turn on (see Rds(on) in the data sheet) it won't work with 5V. You need a logic-level type MOSFET which can fully turn on with a 5V Vgs such as this.

    Second, you also need to connect the MOSFET in a grounded source configuration with the LED plus lead connected to 12V and the minus lead connected to the transistor drain (with series resistor, of course). That way the 5V will fully turn on the transistor and apply 12V across the LED string.
     
  3. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    You're using a N-channel mosfet as a high side switch. Normally they are used as a low side switch. You can use it as a high side swich, but the catch is that the voltage on the gate must be at least 2V referenced to source. I don't know what voltage your LEDs are, but I'll use 2.2V as an example. You have 3 leds in series, so that's 6.6V, and an additional drop across the resistor. Your arduino only puts out 5V, when it needs to put out at least 8.6 min (LED drop + resistor drop + Vgs spec) to turn on. I recommend using it as a low side switch.
     
  4. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    I see that, but I'm confused, down under the ON characteristics it list Vgs min 2V and Vgs max 4V. What gives?
     
  5. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    Thanks guys
    would moving the FET to the low side and/or driving it with a logic level BJT work?
    I don't have any logic FETs on hand
     
  6. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Sure, see figure 10 Bipolar Totem Pole MOSFET Driver. I've also do it with a single NPN (actually it was a TIP120 darlington) open collector output from arduino output. It works, but will invert your duty cycle.
     
  7. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    Open collector?
    Won't that pull the FET gate to ground?
    How does that help when my problem is lack of voltage at the gate?
    EDIT
    waaaiiiittt... im guessing you used a LARGE pull up resistor on the collector... gotcha
     
    Last edited: May 15, 2012
  8. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    hang on, (I hate BJT's :p)
    if I have a large resistor between the collector/FET gate and the +12V, then the arduino output pin is just going to short to ground through the bd junction and fry the pin :p
    (glad I thought of that before I tried wiring it up :p)

    Where do I need the resistors?
    collector/base, or just 1 on the drain?
     
  9. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    OR, I could do this the easy way, and rummage through my stack of IC tubes, find the one labeled MOSFET driver, and use that to buffer the signal:p
    or an AND/NAND gate with the inputs tied together :p
     
  10. jwilk13

    Member

    Jun 15, 2011
    228
    12
    I've used these drivers with N-Channel FETs as high side switches with success. It sounds like you're opposed to purchasing stuff though.
     
  11. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Yes, that will pull the FET to ground, when the BJT is ON, and when the BJT is OFF, the gate will be pulled high via the pullup resistor and will be ON. that's what I was saying about inverting the PWM duty cycle.
    What? I don't think we'r on the same page.
    [​IMG]
     
  12. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    What gives is that you didn't fully read what that parameter is. ;) It is the Gate Threshold Voltage where the transistor just starts to turn on (note that it's measured at a drain current (Id) of 250μA. If that's all the current you need then you can just apply that low voltage to the gate.

    However, if you want to turn the transistor fully on as a switch then you need to look at the next parameter which is the Rds(on). That shows you need a Vgs of 10V for the minimum ON resistance.
     
    strantor likes this.
  13. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    Yep, got the inversion part, its just that in my mind there was no limiting resistor between the arduino and the transistor, thanks :)

    approximately what value should that resistor be?
     
  14. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    I would size it to limit the current drawn from the micro to 40mA (125Ω) or to limit the base current of the chosen npn to whatever it's spec is, whichever is higher. As for the pullup resistor, I would size it as low as possible (max collector current of NPN) to reduce turn on time of the MOSFET, or if efficiency is the goal, then a little higher.

    When I switch things with my arduino I almost always use a TIP120 darlington with 1.2kΩ base resistor.
     
    magnet18 likes this.
  15. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    Thanks, always good to learn something :)
    Took the slightly easier route though and used a TC429CPA I had laying around
    even still worked as a high side switch :)
     
Loading...