Using Mosfet I/O drivers for Microchip PIC suggestions?

Discussion in 'Embedded Systems and Microcontrollers' started by howdoesthatworkguy, Aug 6, 2007.

  1. howdoesthatworkguy

    Thread Starter Active Member

    Jul 23, 2007
    39
    0
    I will be driving a few lamps, just a small 12v 30 to 100milli-amp max. I had thought of using the same Logic level fets I am using for my H-Bridge as the drivers, they are IRLML2502 N Channel. If I use a 10K resistor on the drian tied to the plus rail I should be ok right ?

    My thinking behind using Fets is once again like the H-Bridge, don't need to use any pull-up/down resistors on the gate so it makes everything simple.

    the PIC is 16F seriers running at 5V. the Drian of the Fet connects to a 12v rail that also supplies the H-Bridge. Everything has a common ground.
     
  2. lightingman

    Senior Member

    Apr 19, 2007
    374
    22
    Hi....If you are using the FET's as source followers I.E. drain to +ve, I think you will need P chan FET's....Also if using MOSFET's driven by a PIC, you it is a good idea to use a pull-down resistor 22K to 100K from the gate to ground..... The reason for this is that whilst the PIC is booting up, the outputs will be in a high Z state and this would leave the gates floating, during this time the FET's could do all sorts of things......Daniel.
     
  3. spar59

    Active Member

    Aug 4, 2007
    51
    0
    You could consider a ULN2003A - 18 pin IC containing 8 darlington buffers with input resistors built in so it can be connected directly to the PIC.

    Output capabilty is 50V max, 500mA per channel max, 2.5A total max, hence 8 lamps of 100mA should be no problem.

    Very little wiring / soldering required and they are nice and cheap.

    They also have built-in freewheeling diodes to allow them to drive inductive loads!

    If you need details you can look it up on the texas instruments web site:-
    http://focus.ti.com/docs/prod/folders/print/uln2003a.html

    Steve.
     
  4. howdoesthatworkguy

    Thread Starter Active Member

    Jul 23, 2007
    39
    0
    Thanks, OK I will look at P Channel, yes I had the drain connected though a 10K resistor going to V+. So how do I work out weather to use 10k or 100k for the pull down resistors. I guess I should also put these on the gates of my Mosfets for the H-bridge as well since the PIC does funny things on startup. I don't really want a high and low side fet on the same side of the bridge turning on and creating a short to ground.
     
  5. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    I agree with Steve about the darlington array. I have used them before to drive some relays. It is simple and your part count stays low. If all 8 are driving 100mA it might get a bit warm unless you have plenty of copper plane connected to the ground pin. I am assuming you want the smd version.
     
  6. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    The P-ch will have pull-ups on the gate while the N-Ch will have pull-downs-- assuming you want them to be off when power is applied.

    How are you preventing this "shoot-through"? Are you using software to generate some dead time?

    John
     
  7. chris101

    New Member

    Aug 8, 2007
    1
    0
    I don't mean to hijack this post but the problem I am experiencing is being discussed here so I hope its okay.

    I am using a pic controller powered by a 9v battery via a 5volt regulator, it controls a solenoid which is switched with a MOSFET. When the system powers up it momentarily fires the solenoid, but only if the circuit has been powered down for a little while. If I turn it off then on right away its fine. I started out with a 10k pull down resistor to ground on the gate and it seemed to be worse so I changed it to a 1k resistor and it helped. Does anyone have any ideas that could stop this, is it more of a power supply issue maybe?
     
  8. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    @chris101
    Could you post a schematic of your circuit and set-up?
     
  9. spar59

    Active Member

    Aug 4, 2007
    51
    0
    Just a few thoughts since I have also experienced apparently inconsistent operation before.

    Presumably you are powering the system down for long enough to force a cold restart by the PIC, it is amazing just how long a decoupling or reservoir capacitor can keep the processor powered up for.

    If the processor is not resetting properly on subsrequent occasions, it could be a software glitch that pulses the output port during your initialisation code but then resets it later on during the startup sequence.

    e.g. as far as I know the PORTB register value is undefined at boot so if you set a bit to output mode by setting its corresponding bit to 0 in TRISB before clearing its bit (or setting if your output circuit uses inverse logic) in PORTB you could get a glitch at the output.

    If not done already you could clear the Power-up Timer Enable bit in the configuration register to enable the timer and allow power to stabilise before the PIC starts executing code.

    Steve.
     
  10. howdoesthatworkguy

    Thread Starter Active Member

    Jul 23, 2007
    39
    0
    OK, I will explain what I have done so far. I don't have a schmatic. I have been doing everything on a bread board.

    OK, so far i have a H-bridge, it uses IRLML6402 P Channel Fets for the high side, and IRLML2502 N Channel for the low side. (These are logic level Fets so I thought I could drive them directly from the PIC I/O). I was also using some other N Channel FET's as drivers to power some small 12v lamps, (lamps draw about 50milli amps on average). I was going to connect the gate of the N channel to the PCI I/O, the Source directly to ground, the drian to 12+ via a 10K resistor, and the lamp between the Drian and resistor. But someone suggest I use some BCR108 transistors to drive the lamps as the are cheaper and also easy to use.

    So far the H-bridge has no pullup pulldown resistors at all. How do I work out the vaule for them, the H-Bridge is 12v, the PIC is 5v. You suggest in this post to use between 10k and 100k, how does one workout the correct value?
     
  11. howdoesthatworkguy

    Thread Starter Active Member

    Jul 23, 2007
    39
    0
    What is SHOOT THOUGH NanoVate ?
     
  12. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    Shoot through is the condition when both the MOSFETs on the same side are on so there is a "short-circuit" from the supply straight to ground instead of through the motor.
     
  13. howdoesthatworkguy

    Thread Starter Active Member

    Jul 23, 2007
    39
    0
    Nanovate, I am using hte PIC16F685. This is one of the ECCP verions, it has PWM on 4 of its I/O, and it will not allow shot though. It can also brake the motor. I would say its somehow hardcoded into the PIC to not allow this condition. Also, Lighting man or Nanovate I tested my circuit with the H-bridge, using Lightingmans suggestion (between 10k and 100K) and putting in 10k pullup and pulldown resistors. Everything worked correctly. BUT, I would like to know what is the MATH to work this out properly. I feel there is a big difference between 10K and 100K. If the PIC is set at 5V, the I/O will be 5V. The PIC has a rating of up to 25milli-amps per I/O. (I think it stated 90milli-amp for one I/O port. Anyhow, if the bridge is 12v what is the MATH to work out the correct resistor vaule.
     
  14. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    It will allow shoot through if you do not make sure your software doesn't turn on both MOSFETs at the same time. N-CH and P-CH MOSFETs have different turn-on and turn off times -- N-CH are usually faster. Also if you look at the datasheet you'll notice that an individual MOSFET will have different turn-on and turn-off times -- turn-off being slower in most cases.
     
Loading...