N-MOSFET as external switch - Page 1
Forum section: electronics / beginners

author: gregallenwarner
author_rank: Regular Contributor
timestamp: November 26, 2014, 04:27:22 pm
content: I've got a piece of music equipment that takes an external footswitch, interfaced via a 1/4" TRS jack. (The device pulls the line high, and the switch shorts it to ground.) I'd like to instead control this function with a microcontroller, using a MOSFET to close the switch rather than a physical switch. I've breadboarded the following circuit, and, while it certainly works, I'm unsure if I've done all the ESD protection correctly. I know MOSFET's are sensitive to ESD, and since this device will have an externally accessible net directly connected to the MOSFET, I'm wondering what the best practices are here in this particular case. Let me know if anything in my schematic isn't done quite right, or if it's just silly.Thanks!

author: DanielS
author_rank: Frequent Contributor
timestamp: November 26, 2014, 05:03:25 pm
content: The ESD protection would need to be on the externally accessible part of the thing to do anything useful.If rise/fall time and capacitive loading on your "output" are not important (your circuit is a foot switch replacement so I presume millisecond-scale rise/fall is a non-issue), you can simply put a 100nF cap directly across the output and ground: ESD has only ~1nF worth of capacitance behind it, most of the energy is lost in the arc and whatever is left will not charge the ESD protection cap to more than a few volts. If you want to overkill it, then you can use a TVSS and a smaller cap.

author: SeanB
author_rank: Super Contributor
timestamp: November 26, 2014, 05:05:35 pm
content: You can lose R3, and put the diodes across the jack instead, along with a solder in 1A fuse ( or whatever is a lot larger than the current through the switch if it is 1A) in series with the lead from the jack for protection against being connected to power.As you are likely using a logic level mosfet driven from the MCU directly R2 is also not needed.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: November 26, 2014, 05:28:22 pm
content: Ok, all this makes sense. Thanks. I always see example circuits with the zeners and/or 1M resistors placed across the gate and ground, and so I just instinctually did the same here. I think I'll go with a cap and zeners across the drain and ground.What about the ground? The shielding on the jack will be directly connected to my circuit's ground, as well as the metal enclosure. What happens when someone with a few dozen kilovolts of static on their bodies touches one of these points? (Since the source of the MOSFET is directly connected to ground.) I'm presuming the device is powered off and unplugged, so "ground" doesn't mean a connection to earth ground. Does the sheer mass of the enclosure provide enough capacitance to make this a non-issue?

author: SeanB
author_rank: Super Contributor
timestamp: November 26, 2014, 05:58:18 pm
content: Metal enclosure will provide all the screening you need, just make sure all parts are electrically connected, preferably by more than relying on the screws to provide the connection.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: November 26, 2014, 06:04:41 pm
content: Good deal. About that ground connection: I'm going to use one of those extruded aluminium enclosures that are so readily available. If I leave the solder mask off of the very edges of the board, exposing the ground plane, will this be a reliable enough connection to the case once those exposed strips are slid into the PCB slots in the extrusion profile? My front and back face plates are going to be laser cut acrylic, so the ground connection will have to be made in the extruded piece.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 26, 2014, 08:21:40 pm
content: Biggest hazard would be cable discharge, i.e., the cable gets charged somehow (handling?) then gets plugged in and *zap*. That goes to the MOSFET drain, so put the diode there. I'd suggest an SMAJxxA type diode (or P6KE if you prefer through-hole) rated for at least the maximum voltage needed (i.e., what open circuit voltage it needs to switch -- probably not much, you didn't say), and the MOSFET rated for 150% of that. You could further add a ferrite bead on the signal pin, or a series resistor between drain and TVS diode (30-100 ohms?), which may or may not make any difference assuming you had the equipment to test these things, but a little feel-goodiness isn't a problem, just don't overdo it and make things more complicated than is useful.Tim

author: langwadt
author_rank: Super Contributor
timestamp: November 26, 2014, 09:05:38 pm
content: Quote from: T3sl4co1l on November 26, 2014, 08:21:40 pmIt is the gate that is sensitive, the drain source not so much. Many FETs have diode and avalance rating similar to the FET itself

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 26, 2014, 09:17:44 pm
content: Yeah, but the gate isn't exposed, so the diode isn't going to be protecting the FET from nasty discharges there.The drain is often rated for avalanche and all that, but avalanche is a tricky thing for MOSFETs. Unlike avalanche diodes, MOSFETs suffer from the same hot-spotting failure mode that causes 2nd breakdown in BJTs and FETs. I would expect the ESD performance is excellent in the reverse direction (the body diode handles it just fine), but may be unreliable or insufficient in the forward direction (the channel avalanches and..??).For a small device, like, you might use a 2N7002 here, it's probably prudent to add the (drain to source) TVS.For a power device (not that you'd need to use one here), it's probably not necessary.For a power device in a power switching circuit... now you're on equal footing again, and you may need a snubber or diode clamp to protect the MOSFET. In my Electric Fuse project, testing revealed that MOSFETs will consistently fail when opening the circuit within rated drain current, on mildly inductive loads: for example, a 20A fault current through a 80V, 40A device. The drain voltage spikes up to ~100V (breakdown is typically 20% above the guaranteed maximum ratings) as it opens, then falls back down as the device shorts. Placing a 48V TVS across the MOSFET extended reliable operation into the thousands or millions of cycles under very difficult conditions (low inductance, high current, high supply voltage, externally switched fault).Tim

author: Seekonk
author_rank: Super Contributor
timestamp: November 27, 2014, 10:24:00 pm
content: I would make R1 10K and eliminate the other stuff. This forms a RC network with the gate capacitance, several thousand pf with a power device which I assume you are using just to incorporate the internal zener. It will be more than fast enough and also protect the micro from an outside surge.Frankly, from my experience I would use an opto isolator instead of a FET and use a 1/4 inch jack with an isolated ground to prevent ground loops between equipment.