Shop OBEX P1 Docs P2 Docs Learn Events
MOSFETs and the Propeller - Page 2 — Parallax Forums

MOSFETs and the Propeller

2

Comments

  • idbruceidbruce Posts: 6,197
    edited 2012-01-05 15:55
    Ron

    That is some very interesting information. Thanks for posting the links.

    Bruce
  • lardomlardom Posts: 1,659
    edited 2012-01-10 07:03
    Because I'm trying to get more power to the wheels of my project I did some research that explained why mosfets are more efficient than BJTs in my case. Even if I buy an IC I want to build a mosfet H-bridge to understand it.

    Advantage of Mosfets
  • RaymanRayman Posts: 14,652
    edited 2012-01-10 08:16
    I'm not sure I'd agree with that page... I think the real advantage of mosfet is that it's easier to turn on and off than BJT.
    Also, it's much faster. I really like IGBTs that have the power handling of BJT with the easy control of a mosfet...

    Still, maybe there's something to that argument when using a very low voltage power supply.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-10 08:30
    High-side drivers for nMOSFETs are plentiful and cheap. They work by using a charge pump to boost the gate voltage above that of the drain supply. Better still are half-bridge MOSFET drivers that drive one low-side and one high-side MOSFET, with logic to prevent shoot-through. With either driver, you never have to resort to pMOSFETs and their relative disadvantages.

    -Phil
  • Mark_TMark_T Posts: 1,981
    edited 2012-01-10 09:18
    If it hasn't been said before I'll just say "protection". MOSFETs can fail and do fail, especially with motor loads (and no current limiting). Typically this puts the gate of the MOSFET at either ground (no problem) or at V+ - this is a big deal for a microcontroller as V+ might be 12, 24 or more volts. Its really annoying if during testing you fry the MOSFET and the rest of the board too (because 24V at 10A was shorted to the 3V3 by molten silicon!) The higher the load voltage and current the more important protection is.

    So include a zener diode/resistor protection circuit that will happily take the maximum supply voltage without overloading then you can be sure any problem with the MOSFET won't damage the microcontroller. For low voltages a better method is a schottky diode to the 3V3 line (and inline resistor) - Schottky diode conducts before the protection diode and allows the gate to drive fully to 3V3.
    [ You have to protect the 3V3 rail from over voltage too, note ]

    The same issue applies with driver chips - MOSFET shorts out, blows up the driver which then, say, puts 12V on its logic input (so protect the pins driving those inputs with 1k series resistor and schottky clamp). Put MOSFET drivers in sockets while testing...

    Oh yes, another common mistake - don't choose a MOSFET on its current rating, work out the power it will dissipate from I^2 R and choose Rds(on) to be small enough for heat dissipation to be manageable. For nearly all devices the max current rating is the current at which the device reaches 175 deg C with infinite heatsink (way beyond normal use). For handling a 10A load a 50A or 100A device is about right, a 15A device will melt.

    If driving the gate directly via a resistor work out the switching time from the gate charge parameter - this should be a negligible fraction of the PWM cycle time if you want to avoid overheating. In practice this means use a driver chip unless running at low kHz rates or less.
  • lyassalyassa Posts: 52
    edited 2012-02-04 20:47
    I couldn't use the Propeller to directly drive neither F3055L nor BS170 mosfets. Not sure if I am doing anything wrong, or is it that the gate voltage need to be higher than 3.3V. The charts in the datasheets seems to say that 3.3V is barely enough to turn the mosfet on, but not all that clear.

    My circuit is as follows:
    12V to 220Ohm resistor to the drain. The source is connected to 3 red LEDs in series, then to ground. Ground is common between the Propeller and the 12V ground. The mosfet gate is connected directly to a propeller pin.

    The LEDs light when I touch the gate to the 12V via a resistor, but not when the gate is connected to the Propeller. I verified that the Propeller pin is high.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-04 21:00
    Connect the source of the MOSFET to ground, and put the LEDs in series with the drain. The circuit you describe is a source follower, and the voltage driven to the LEDs will always be less than the voltage going into the gate. Since the gate voltage is 3.3, you don't have enough voltage left over to light one LED letalone three.
  • lyassalyassa Posts: 52
    edited 2012-02-04 21:31
    Ah ... you are right Circuitsoft. However, I need the LEDs on the source. My setup will be - when I get the RGB LEDs strip with common anode - such that the common 12V anode will connect to the mosfet source, and the cathods of the 3 leds branches will go to the output of a ULN2803. I will have few of these that I was going to multiplex.So I was hoping that the propeller will turn one mosfet on and the other off. This mosfet will power the first strip which I will PWM with the propeller and the ULN2803, then this mosfet turn off, and the second one turn on and power the second strip and so on. With this setup, I will have to have the strips on the source. Appreciate any ideas.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-04 22:15
    Why not just connect the common anode to +12V and use separate MOSFETs or bipolar transistors to PWM the cathodes? Any pin on the Prop can be used to PWM. It's not like other controllers where you're restricted to one or two PWM outputs.

    -Phil
  • lyassalyassa Posts: 52
    edited 2012-02-04 22:45
    Phil, I can do that, but this is 3 pins and 3 transistors for every channel. Doesn't really scales well. I am already using 20 pins to read switches and 2 pins for usb/serial.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-04 23:07
    In that case, could you use a TPIC6C595 instead of the ULN2803? The '595 has an enable input that can be used for PWMing the LED(s) selected by the shift register outputs.

    -Phil
  • Mark_TMark_T Posts: 1,981
    edited 2012-02-05 03:26
    Rayman wrote: »
    It turns out that transistors are often best for driving mosfets. In particular, I've often seen complimentary emitter followers used like the one described here:
    http://www.diodes.com/zetex/_pdfs/3.0/appnotes/apps/an18.pdf

    I've used the ZXGD3003 before and it works quite well...

    Unfortunately that circuit configuration won't work at 3V3, the transistor drops a volt or so and no power MOSFETs work with 2V of gate drive...

    The Micrel MIC442X family of drivers are ideal as they allow a separate V+ for the MOSFET driver (most power devices want 10 to 12V of gate drive, few work on less than 4.5V). You can add a ~ 2k2 resistor in series with the MIC442X input (and protection diodes) to protect the Propeller should the MOSFET and driver fry. You'll get 50ns switching speed too. They are available SMT and thru-hole, very nice little drivers.
  • Mark_TMark_T Posts: 1,981
    edited 2012-02-05 03:29
    Chris,

    Were you using true PWM or DUTY-mode output? Typically, you do not want or need to run a MOSFET in its linear region to control a motor, as it will dissipate too much heat. (A small fan, maybe, not so much.) The key is to use a true PWM output and just drive the gate without a low-pass filter. That way the MOSFET will either be all the way on or all the way off. (With a DUTY mode input, you will not realize this advantage, since it switches too rapidly.)

    In any event, with an inductive load, such as a motor, always be sure to add a protection diode across the load. This will prevent the voltage on the MOSFETs drain from exceeding its spec'd maximum when the MOSFET is switched off.

    -Phil

    But its not a motor, its a computer fan (which is a microcontroller controlled brushless motor - it needs a DC supply and speed is proportional to that supply voltage)
  • cavelambcavelamb Posts: 720
    edited 2012-02-05 10:32
    lyassa wrote: »
    I couldn't use the Propeller to directly drive neither F3055L nor BS170 mosfets. Not sure if I am doing anything wrong, or is it that the gate voltage need to be higher than 3.3V. The charts in the datasheets seems to say that 3.3V is barely enough to turn the mosfet on, but not all that clear.

    My circuit is as follows:
    12V to 220Ohm resistor to the drain. The source is connected to 3 red LEDs in series, then to ground. Ground is common between the Propeller and the 12V ground. The mosfet gate is connected directly to a propeller pin.

    The LEDs light when I touch the gate to the 12V via a resistor, but not when the gate is connected to the Propeller. I verified that the Propeller pin is high.


    Thanks for bumping this thread back to the top.
    I'd not seen it before, and it's important information.

    On the topic of protection, and to provide better gate drive, we probably ought to include optical couplers in the discussion.

    The most important detail with optical isolation is that we don't need to connect logic ground to the power device ground.
    That removes one big source of electrical noise.
    But also they can make it easier to change voltages like 3.3v logic to 6 or 12 volt motor power.

    SparkFun provides a neat little two channel breakout board for the ILD213T optoisolator with discrete transistors to
    correct the logic levels. http://www.sparkfun.com/products/9118

    opto-sf.PNG





    487 x 317 - 454K
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-02-05 12:11
    Bruce,
    I meant to reply before, but here goes. My projects don't usually involvve control ov heavy loads, but they usually do have a lot of power control for things like sensors or displays, to provision for power consumption. For things are are part of the system (that is, things that can't be mucked with by the end user), I do like p-mosfets. For example, here is circuit that controls power from the 3.3V rail to an LCD display.
    FDN304_out.png


    This controls the high side power, ON when p12 is low. A 1MΩ pullup on the gate assures that it stays off so long as p12 is an input. And the 1M resistor at the output (the green square) assures that the capacitors discharge to zero, which is important to avoid a bad reset of the display when power is reapplied.

    Here are the characteristics of the FDN304PZ "power trench p-mosfet" (Fairchild Semi, cost about $0.30).

    FDN304PZ.png


    This is typical of the kind of curve you have to look at in order to determine if a mosfet is going to work or not with the Prop. Find the curve for a gate voltage Vgs=3V. Follow the curve up to where it intersects the vertical line where Vds=0.5V from drain to source. Then look horizontal back to the Y axis to see that the current Id = 8.5 amps. The slope of that line is 0.5V/8.5A = 0.058 Ω. That is, 58 milliohms. The line back to the origin is pretty straight, so if my display with its backlight on draws 20 mA, the drop across the transistor will be only 0.020A * 0.058 Ω = 0.0012 V. That is, The 3.3V power will get through to the display with hardly any drop.

    The FDN304is rated for 2A continuous and 10A surge, despite being in an SOT23 package, although the power dissipation also has to be considered. If you have 2A through a 0.058 ohms, that is 0.24 watt. Design curves are given in the data sheet for "safe operating area" that take power into consideration for both continuous current and pulses of current.

    Like all mosfets, there is a substate diode in reverse from drain to source. This mosfet also has back to back zeners for protection from gate to source, and those clamp the voltage there at about 8V, so they are out of the way for the 3.3V circuit.
    621 x 488 - 70K
    688 x 266 - 30K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-05 13:07
    Mark, Chris,

    If you want to control a fan motor with an analog voltage using a MOSFET, you will want to use an op-amp to maintain proportional control via feedback. Here's a circuit that uses a pMOSFET:

    attachment.php?attachmentid=89315&d=1328475992

    A filtered input voltage of 0-3V will produce an output voltage range of 0-12V. You will want an op-amp whose input common mode range includes ground, whose output is rail-to-rail, and which is stable driving a capacitive load. To decrease the effect of gate capacitance on the op-amp, you could add a series resistor between the op-amp's output and the gate.

    -Phil
    487 x 294 - 3K
  • idbruceidbruce Posts: 6,197
    edited 2012-02-05 19:55
    @To All Spporters And Donaters To This Thread

    I would like to thank you all for the information and assistance that you have provided and/or continue to provide. Like I said before, it will be a handy reference for those of us who are less electronically inclined.

    Thanks

    Bruce
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-06 00:01
    Mark_T wrote: »
    But its not a motor, its a computer fan (which is a microcontroller controlled brushless motor - it needs a DC supply and speed is proportional to that supply voltage)
    If you're not using the tach line, then it doesn't matter. Just PWM it. It's not driven by a microcontroller, but by a high-power hall-effect switch such as the Allegro A1442.

    If you do need the tach feedback, still, pwm the fan, but you'll need to do jitter management on the tach line. Basically, have the PWM also drive the enable on a data latch, and run the tach line through said latch.
  • hinvhinv Posts: 1,255
    edited 2012-02-06 20:47
    Hi Phil,

    If the motor took 3 amps, what parts would you recommend for the op-amp and mosfet?

    Thanks,
    Doug
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-06 20:56
    Doug,

    I would not use that circuit -- or any linear driver -- for a 3-Amp motor. You would be much better off PWMing the motor with a simple nMOSFET common-source driver -- or, if you need to reverse it, an H-bridge.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-02-07 11:03
    The momentum of the motor will smooth-out to an average speed.
    So if you have 12v motor and you give it 12v only 10% of the time and 0v 90%.
    200 hertz is fast enough that you will not see jerky movement but still provide enough torque

    Lucy, Rest in Peace.
  • Andrew E MileskiAndrew E Mileski Posts: 77
    edited 2012-02-17 18:18
    A bump and addition to the knowledgebase...

    Microchip TC4427 is an ideal two channel MOSFET driver. There are related parts with two inverting driver, or one inverting and one non-inverting driver: TC4426, and TC 4428.

    Available in DIP package of course.

    http://ww1.microchip.com/downloads/en/devicedoc/21422d.pdf

    On fan control:

    Go to 100% duty (fully "on") when counting tach pules (2 per rotation, open collector so a pull-up resistor is required), ignore the first tach transition or two (noisy), and start timing from there until you've counted 4 transitions for 2 pulses, then go back to the duty cycle you wish to maintain. Don't need to do this that often (every 100 rotations), and the fan's inertia will prevent it from changing speed significantly in just one rotation.

    If you don't see 2 pulses within the expected time, then the fan is likely dead or stuck, as it won't stall at 100% duty.

    If the fan is buzzing, increase the PWM frequency.

    Four pin PWM fans use 5 Volts TTL on the control signal min 21 kHz (ideal: 25 kHz) to 28 kHz max, which is above hearing unless the fan resonates at a lower frequency.

    Fan noise can also come from beating with another fan, or from the air column meeting interference like a heatsink or case grill causing turbulence.
  • Mark_TMark_T Posts: 1,981
    edited 2012-02-18 04:56
    tonyp12 wrote: »
    The momentum of the motor will smooth-out to an average speed.
    So if you have 12v motor and you give it 12v only 10% of the time and 0v 90%.
    200 hertz is fast enough that you will not see jerky movement but still provide enough torque

    Lucy, Rest in Peace.

    Its not as simple as that... The motor windings are naturally highly inductive (all that iron). So they want to keep the current constant. When you switch the voltage a high voltage starts the current rising, a 0V will start it falling (V dt = L dI). So the actual current flowing can be heavily smoothed by this inductance with PWM. The torque depends directly on the current so a smoothed current means a smoothed torque (less vibration).

    Thus having the PWM frequency high enough to give this smoothing will reduce mechanical vibration which is a good thing.

    Even more important "copper losses" are proportional to I^2 R: the rms value of the winding current is at a minimum if the current is smoothed (for low duty cycles and a lack of smoothing copper losses will dominate and efficiency falls off dramatically - exercise for the reader - remember a smoothly running DC motor has back-EMF nearly balancing the input voltage and most of the electrical power being converted to mechanical work.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-18 05:01
    Turning off the power may disable the drive electronics, preventing current flow outside of the motor, even at 0 volts.
  • idbruceidbruce Posts: 6,197
    edited 2012-02-27 01:28
    Hello To Everyone But Phil/Howdy Phil

    Just kidding Phil! :)

    Anyhow, I have been attempting to follow this thread because I think it is very informative. For those of you that may be interested in MOSFET's, you may want to read and follow this thread as well.

    http://forums.parallax.com/showthread.php?138127-Some-circuit-design-questions

    Bruce
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-02-29 20:22
    Driving a mosfet hard.
    Though a mosfets gate don't hardly use any current while staying in one state.
    For very short time it does use some power when you charge up its capacitance.
    If you can give the gate a large burst of power, the faster you can switch it (in the mhz) and also less power loss.

    So you need push-pull, the props pin is push-pull but at 40ma not much power behind it.
    And with 3.1v it may not fully turn most Mosfets on, so if you use an external push-pull that have a 5v Vcc you're in power-mosfet-haven.

    I just saw this little guy and would do a nice job with its 1A of source/sink.
    sot457.jpg
    http://www.mouser.com/ProductDetail/NXP/PMD3001D115/?qs=LOCUfHb8d9s88Yql4uGcjg%3d%3d
    Prop pins goes to pin 1
    Use a 1k resistor in series and maybe also 100k pullup or pulldown if you want a known state while booting up.

    Pin 4 goes to the mosfet (a resistor in series with a value of 1ohm to 3ohm is good design )
  • Mark_TMark_T Posts: 1,981
    edited 2012-03-01 12:53
    tonyp12 wrote: »
    Driving a mosfet hard.
    Though a mosfets gate don't hardly use any current while staying in one state.
    For very short time it does use some power when you charge up its capacitance.
    If you can give the gate a large burst of power, the faster you can switch it (in the mhz) and also less power loss.

    So you need push-pull, the props pin is push-pull but at 40ma not much power behind it.
    And with 3.1v it may not fully turn most Mosfets on, so if you use an external push-pull that have a 5v Vcc you're in power-mosfet-haven.

    I just saw this little guy and would do a nice job with its 1A of source/sink.
    sot457.jpg
    http://www.mouser.com/ProductDetail/NXP/PMD3001D115/?qs=LOCUfHb8d9s88Yql4uGcjg%3d%3d
    Prop pins goes to pin 1
    Use a 1k resistor in series and maybe also 100k pullup or pulldown if you want a known state while booting up.

    Pin 4 goes to the mosfet (a resistor in series with a value of 1ohm to 3ohm is good design )

    Unfortunately that is an emitter-follower driver, so it will drop 0.7 or so volts, which means for a low-voltage drive MOSFET you might not be guaranteeing it to fully turn off (threshold voltages tend to be 0.5 -- 1.0V or so for low-gate-voltage MOSFETs. I'd tend to favour a MOSFET driver that itself has a MOSFET output stage (like the MIC4422 and family) as they pull down right to ground. But that chip would drive a non-logic level MOSFET rather nicely (where the threshold voltage is usually 2 -- 4 V). And if you are using a MOSFET driver there's no need for a logic-level MOSFET in the first place (though a 12V supply is needed).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-01 13:03
    As an emitter follower, the output high voltage will be 0.7V lower than the input high voltage, too, regardless of the supply voltage. So, with a 3.3V input, say, the output would be a measly 2.6V.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-03-01 14:58
    Bummer.
    If you use this quad buffer that can handle 32mA push/64mA sink at 5v (with 2v inputs)
    Though not hard drive, you would have many mosfet to choose from.
    http://www.mouser.com/ProductDetail/Texas-Instruments/SN74ABT125DR/?qs=sGAEpiMZZMuiiWkaIwCK2UHhUsuHvyUOv9PRFh0cw6s%3d


    If you add a 5v HCT quad buffer 8mA, you could drive four of those 1A push-pull to each gate ( would get 4.3V)
    Good for many mosfets at high switch speed.
    http://www.mouser.com/ProductDetail/NXP-Semiconductors/74AHCT125D118/?qs=sGAEpiMZZMuiiWkaIwCK2RTxPVPWGz6W1pncIEJrkos%3d

    But if your plans are half or full H-bridge
    http://www.mouser.com/ProductDetail/ON-Semiconductor/NCP5359ADR2G/?qs=lYuAOLy5nvY3dizfXs4iRw%3d%3d
    Or go with isolation and driver in one.
    http://www.mouser.com/Search/Refine.aspx?N=1323043&Keyword=Si823&Ns=Pricing%7c0&FS=True
  • Andrew E MileskiAndrew E Mileski Posts: 77
    edited 2012-05-27 19:50
    Bi-directional level shifter:
    3V_5V_mosfet.jpg
    The MOSFET has to conduct when either side goes low, and has to be stop conducting when they go high. Choosing a MOSFET with the correct Vgs threshold or Vgs(th) is critical to make the circuit work as expected.

    The magic is in the substrate diode (not shown in the schematic symbol above for some reason) across the source and drain. The substrate diode's forward voltage drop combined with the logic 0 voltage level on the high voltage side determines Vgs(th).

    Example: Vhi = 5.0 Volts, Vlow = 3.3 Volts, Vfwd = 0.6 Volts, Vhi_logic0 = 0.8 Volts (TTL) , Vhi_logic1 = 2.0 Volts (TTL)
    TTL Logic 0: Vgs = Vlow - Vfwd - Vhi_logic0 = 3.3 - 0.6 - 0.8 = 1.9 Volts, so Vgs(th) < 1.9 Volts

    The Propeller's I/O pins are rated for 0.4 Volts max for a logic 0, and 2.85 Volts minimum for a logic 1.
    Propeller Logic 0: Vgs = 3.3 - 0.4 = 2.9 Volts, well above Vgs(th) so the MOSFET is conducting.
    Propeller Logic 1: Vgs = 3.3 - 2.8 = 0.5 Volts, well below Vgs(th) so the MOSFET is not conducting.

    Using a MOSFET with a Vgs(th) of 1.5 Volts (like the handy ZVNL110A TO-92 style MOSFET available from DigiKey) buys considerable margin, ensuring the circuit will always work as expected.

    The circuit is apparently covered by Pat. 5689196.
Sign In or Register to comment.