You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • My god, the comments section, right at the top of that mosfet page is just... wow... this discussion about using an N-channel mosfet as a high-side driver (with drain connected to +5V and source connected to the positive side of the load), and how that didn't work when they tried it (no shit, it didn't, because as soon as they turned on the fet, the voltage on the source rose (since the voltage drop across the load is - hopefully - higher than that across the FET), so Vgs shrank and the fet turned part-way off - naturally nobody explained that in the discussion over there), and then someone suggests a charge pump to generate high voltage for the gate.... rather than moving the mosfet to the other side of the load or using an appropriate part.
    If you must switch the high side, you use a P-channel mosfet, a pullup from gate to source, and drive it low to open the gate (or, if the positive voltage is too high to expose your io pins to, drive it with an NPN transistor or N-channel mosfet) - or you switch the low side with an N-channel mosfet (generally, you want to switch the low side if you can, since n-channel mosfets are easier to drive and have better specs for the same price)

    As for that part (https://www.sparkfun.com/products/10213) - it looks like it would work kinda for loads of a few amps on a 3.3v microcontroller like the Espruino; the performance won't be great, but it may be fine for what lavamantis is doing (also, apparently sparkfun ships two different parts there, and they don't perform the same at low gate voltages) Driving it by putting a pullup on the gate, and driving with a 5v-tolerant pin in open-drain mode (and driving pin low to turn fet off) will make sure you get the mosfet completely on, and you'd want to do that if switching a larger load.

    Of course, there's a world of mosfets that have spectacular performance at very low drive voltages... in SOT-23 and other inconvenient (for most people here) surface mount packages.

    MOSFETs are simple to wire... if you're using a part that will do what you want it to at 3.3v, just put source to ground (for an N-channel), drain on the negative side of the load, a 10k resistor between gate and source (so it turns off if the pin is allowed to float), and connect the gate to an output pin. If you're using something that needs 5v on the gate, put a 10k resistor between gate and +5v instead, and make sure the pin you use is 5v tolerant and in open-drain mode. (this will be on if you aren't driving the pin low, though, so be aware of that)

    I'm going to search more aggressively for an acceptable MOSFET in throughhole package that'll provide decent performance with 3.3v on the gate.

    Edit: This looks like a good candidate: IRF3708PBF http://www.irf.com/product-info/datashee­ts/data/irf3708pbf.pdf

    Edit2: I'm working on a mosfets tutorial for the espruino docs.

About

Avatar for DrAzzy @DrAzzy started