• The bit about COM - if you're driving an inductive load (like a motor), you should connect the positive side of the supply (for whatever you're powering) to that. That way, when you turn off the load the voltage spike won't exceed the supply voltage.

    There are no doubt many tutorials about using mosfets in various contexts. I don't think there's one specific for the Espruino.

    I just took that pic of one sitting on an Espruino

    Wiring:
    Source of MOSFET to ground.
    Drain of MOSFET to the negative side of the load.
    Gate of MOSFET to whatever pin you're using to control it.
    10k resistor between gate and ground
    Positive side of power source to positive side of the load (through a diode or 1 or 2 ohm resistor - I read the datasheet, and it says 3.5v max on the motor).
    For good measure, I'd put a diode across the motor terminals (with the band towards the positive side) for same purpose as the diode in the ULN2003 above. Might not need it, but diodes are cheap.

About

Avatar for DrAzzy @DrAzzy started