Why is my microcontroller and Mosfets failing in this circuit? - Page 1
Forum section: electronics / projects

author: Civilenjuneer
author_rank: Newbie
timestamp: May 29, 2019, 03:33:26 am
content: Hi girls (I hope I'm not the only one) and guys,I'm not an EE by trade, just a hobbyist but I have been dabbling for a while now - yet I am at a loss to know what exactly is going on here.I built a little LED light for my motorcycle... just a couple of strings of LED's that shine through a mask and light up the area around the bike with our club logo. I have a couple of pushbutton switches with 14.4V on one side (with a diode and voltage divider) which, when pressed, input 2.7v into two microcontroller inputs and controls the LED's on/off. The MCU turns on the gate of either of two N-FET's which let power flow through the corresponding group of LED's. I potted the whole thing with thermal potting epoxy (made for electronics) so I also have a hall switch which lets me use a magnet to cycle through various pre-defined flashing patterns stored in the MCU.It has been working fine for a year or two. Some of the other girls and guys in the club asked me to make them one, so I made a batch and gave them away as door prizes at last years big club meet. And about half of them failed. Some failed as soon as they were installed. Some when the motorcycle was started up. Some after a few days or a few weeks. I've gotten several of the failed units back. When I took them apart, it seems the microcontroller is dead most of the time, and also most of the time one of the FET's (or both) are also dead.The LED's are high power Cree X-Lamp LED's rated for 1A and I run them around 400mA at Vin of 14.5. The resistors are 5W and I actually ran 2 in parallel (not shown on schematic). The LED's, resistors and FET's are all attached to a machined heat sink which touches all the parts and is secured with thermal epoxy. I've measured the thing at full power and it definitely isn't overheating... plus I don't think it's a heat problem because sometimes they fail immediately at first turn-on after install, just giving a split-second flash and then dead. I've verified that my voltages and currents are all OK when running from my power supply. I am using a Cypress PSOC4 chip and I have my inputs set to resistive pull down and my outputs set to resistive pull up/down.My hobbyist-shot-in-the-dark theory is that the ground is going below 0V, which makes the 3.3V out from my microcontroller fry the FET, since is has a max Vgs of +/- 12V. Or if ground is going below 0V, then maybe it's exceeding the max Vds on the FET of 20v. The FET I am using is a DMG6968U. I have a TVS on the input (SMAJ16CA) with a 16V standoff and 18V breakdown voltage. I've also had a few people say their unit worked fine until they tried to use the hall switch when the bike was running, and it died immediately. I used the same PSOC4 chip and voltage regulator for the previous year door prize, but that just used a little RGB light off the regulated supply and no fets. I never had any issues with those. Plus, on these failed ones the regulator and TVS still work fine... so that makes me think it's something with the FET's. They do have an internal bi-directional TVS from gate to source, but it seems that wouldn't protect against ground going below 0V (or in fact would actually cause my microcontroller to maybe see a big current from the output pin to Vs on the FET?).Can anyone give me some pointers? I know it's probably something simple I am overlooking but I can't figure it out. The failures were on bikes that aren't local to me, so I can't just hook up a scope to see what happened.

author: Mr.B
author_rank: Unknown
timestamp: May 29, 2019, 04:11:29 am
content: Welcome to the forum.I am by no means an expert, but I would have thought that only a TVS diode was insufficient protection in an automotive application.There are a number of automotive experts on this forum, so hopefully one will chime in for you shortly.

author: TiN
author_rank: Super Contributor
timestamp: May 29, 2019, 04:16:38 am
content: I agree with point, that automotive power is electrically dirty with lot of noise and big spikes (including undervoltage), especially when motor start up. You can search for some automotive-aware DC/DC designs and regulators to get the overall idea how much overengineering might be required to get robust operation of electronic device, without having it release blue smokes. I would also use MOSFET that is at least rated for 60 V in this application, there could be large spikes of voltage over the maximum 20V spec of DMG6968 listed on schematics.Few extra 0.1uF/1uF capacitors right next to Hall sensor, MCU would be helpful too as decoupling. Watchout for LDO regulator capacitor requirements, some of LDOs can be picky and require not too small and not too big capacitance at the input/output.Without seeing layout, it's hard to advice on physical things, but taking care about ground return copper is also a good thing. Those LEDs quite hungry, and you would want to connect ground from FETs directly to power entry point, so crap and noise injected into ground is not going thru sensitive hall sensor/MCU.. Treat ground not as ground which is always zero, but as another voltage rail that return currents to power supply.

author: floobydust
author_rank: Super Contributor
timestamp: May 29, 2019, 04:28:13 am
content: You have to protect against negative voltage transient spikes, say to -200V worst case.So use of a SMAJ16CA bi-directional TVS is wrong, it would clamp to +/-26V. The negative voltage can kill the LDO and LED's.First have a fuse, then series input diode before going to the TVS and Vreg.

author: Civilenjuneer
author_rank: Newbie
timestamp: May 29, 2019, 04:54:09 am
content: Quote from: TiN on May 29, 2019, 04:16:38 amThanks for your reply TiN!I will look for a FET with higher specs. Do you think it's more the Vds rating that would be a problem than the Vgs? I have used the same regulator and regulator caps before in a couple other projects and haven't had any issues (even for things I made for previous give-aways), so it seems the FET are more likely the issue. I did make sure the ground return path from the FET is directly connected to the copper pour on one side of the PCB and is just a few millimeters away from the power entry point. I only have one 0.1uF cap right at the MCU (other than the 2.2uF caps on the 3.3V regulator)... the hall switch is directly next to the MCU though, but I can certainly add decoupling directly to it also.

author: Civilenjuneer
author_rank: Newbie
timestamp: May 29, 2019, 05:01:00 am
content: Quote from: floobydust on May 29, 2019, 04:28:13 amthanks for the info floobydustI forgot to mention I do also have a schottky diode on the power input as well as the input lines to the MCU. I haven't had any issues where the LDO or LED's failed. The LDO is rated to a max Vin of 38V, so I thought the bi-directional TVS would protect it against destructive overvoltage and the input diode would protect against negative voltages on the power input - or am I missing something there?Would adding a reverse biased zener on the source of the FET be a good idea, to limit the maximum Vds voltage in cases of -200v spikes?

author: OM222O
author_rank: Frequent Contributor
timestamp: May 29, 2019, 06:27:02 am
content: +-12V seems a bit low. almost any modern fet can tolerate +-20V on the gate and about 30V drain to source.zeners are horrible for fast, high energy noise sources. they are simply too slow. TVS diodes are fast, but usually rated for really high voltages. your best bet here would be schottky diodes connected to GND and VCC in reverse polarity. that will ensure non of the parts see more than about 0.3V above VCC or below ground. just choose a suitably beefy diode so it won't burn out during high current bursts.another simple insurance would be using an NTC thermistor between the VCC and the actual battery, followed by a decently sized capacitor. this will suppress fast transients and inrush currents if they are causing any issues (I really can't say if they are or not, since you mentioned you can't test with a scope). the NTC initially has high resistance, so it heats up quickly, reducing its resistance, therefore preventing it from heating further.I honestly think better fets (or even BJTs or IGBTs, they are usually a better choice in automotive applications) and having some schottky diodes will solve your issues.

author: Circlotron
author_rank: Super Contributor
timestamp: May 29, 2019, 07:17:30 am
content: I have had good success in an automotive environment with the following setup. +12V comes in through a 10 ohm 2 watt resistor, then 1000uF cap and 27V 1W zener across the line, then on to the voltage reg. In your case a 20V zener might be better. I'm not so sure about a diode in series with the +12V line - a spike will pull up the input caps and the diode will allow the caps to stay at the high voltage level.Done about 8000 boards over the last 20 years and no obvious failures. Protecting the LEDs and mosfets may need an additional approach - 400mA LED current will cause too much voltage drop in the 10 ohms.

author: CJay
author_rank: Super Contributor
timestamp: May 29, 2019, 07:57:49 am
content: Quote from: Civilenjuneer on May 29, 2019, 03:33:26 amYour problem could well be those pushbutton switches, you're connecting them to 14.4V and then dividing it down to the MCU levels, if you get a huge spike on the 14.4V it will reach the MCU.Disconnect them from 14.4V, ditch the voltage divider, connect them to the regulated 5V MCU power, feed the output to the MCU via a *edited, didn't mean pull up* resistor, 1K should be fine, keep the clamp diodes at the MCU inputs.Other suggestions about protecting the rest of the circuit still apply, you need the TVS on the input to the regulator and you need a TVS across the LED/MOSFET chain.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 29, 2019, 08:08:25 am
content: Quote from: CJay on May 29, 2019, 07:57:49 amThat is a good point as well (schematic doesn't include them so it's easy to miss), although any modern mcu should have built in schottky (esd) diodes and if a resistor divider is used with high enough resistor values, then those should be good enough. All in all there are a lot of protection features missing. This would be fine for an isolated / battery powered circuit, but automotive stuff are really noisy with high energy spikes, so they are neccessary.

author: Civilenjuneer
author_rank: Newbie
timestamp: May 29, 2019, 08:31:39 am
content: Quote from: OM222O on May 29, 2019, 06:27:02 amThanks for the reply!I have been looking over datasheets at DigiKey.. I found SSM3K2615R,LF‎ and ‎NVR5198NLT1G‎. They both have much higher Vds ratings and (I think) reasonable input capacitance and Rds values. I think either would be a better choice than my current - if you have a moment to look, I'd appreciate your feedback. On the schottky diodes for protection - I assume you mean putting the anode on ground and the cathode at the +14.5V at the top of the LED's? You mentioned diodeS, multiple, so do you also suggest adding one in the same configuration at points on the board, or is one for the whole circuit likely to be sufficient?

author: Civilenjuneer
author_rank: Newbie
timestamp: May 29, 2019, 08:51:31 am
content: Quote from: Circlotron on May 29, 2019, 07:17:30 amThanks!You mean too much voltage drop meaning too much dissipation? I sized them appropriately and the full current only flows for a short time. On your protection circuit... what is the function of the 1000uF cap - just to absorb the energy from a transient spike? Are you using a high-voltage cap there or just something like a 50V electrolytic? May I ask what you have on the other side of the protection circuit.... digital electronics or something else?

author: floobydust
author_rank: Super Contributor
timestamp: May 29, 2019, 09:25:15 am
content: Quote from: Civilenjuneer on May 29, 2019, 05:01:00 amA partial schematic just makes it too hard to help you.I don't know where your series input diode is. Schottky is not suitable as they are low voltage parts. Are the LED's powered ahead or after it? This is important.Where does the hall sensor go, long cable?

author: OM222O
author_rank: Frequent Contributor
timestamp: May 29, 2019, 10:58:57 am
content: I agree. Please upload a full schematic. I will have a look at replacement fete and post a schematic of a clean supply from the battery tonight when I'm free.

author: Circlotron
author_rank: Super Contributor
timestamp: May 29, 2019, 12:51:46 pm
content: Quote from: Civilenjuneer on May 29, 2019, 08:51:31 amNah, simply too much voltage drop. 400mA means you are going to lose 4V in the 10 ohms. You would have to supply the LEDs via a separate path. Yep, 1000uF just absorbs the spike. 25V caps have been fine. Downstream is a 78M05 5V reg and a couple of 68HC908 micros. Ignition system for race car engine.

author: Etesla
author_rank: Regular Contributor
timestamp: May 29, 2019, 02:26:59 pm
content: I might be wrong, but a couple things jump out at me, and I'm hoping they are all mislabeling issues.First off, the net labeled +5V is actually 3.3V correct?Second, the microcontroller, CY8C4013SXI400 is a 1.8V microcontroller, not a 3.3V one... Might explain the half of the micros being dead thing...Third, driving those n channel mosfets from an IO pin wouldn't work well. The Vgs ON for the DMG6968U-7 mosfets is around 4.5V, so if they turned on at all with a 3.3V microcontroller, they would be acting like resistors and dissipating lots of power (saturation region), meaning they would go over their power dissipation rating and blow up too.To fix these issues, you would need to replace the AP2204K-3.3 with the AP2204K-1.8, and add a gate drive circuit for the mosfets.

author: Psi
author_rank: Super Contributor
timestamp: May 29, 2019, 02:58:41 pm
content: In my automotive products i have to use a TVS diode with 24V working voltage. (ATV50C240JB-HF)The first units had 16V working voltage and most of them blew up.I also use automotive rated 5V vregs (LM2937IMP-5.0). They handle rev polarity and have built in 60v transient protection.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 29, 2019, 10:49:06 pm
content: Quote from: Etesla on May 29, 2019, 02:26:59 pmdid you check the data sheet for the correct part?https://www.cypress.com/part/cy8c4013sxi-400it clearly states max operating voltage to be 5.5, not 1.8 or 3.3!The DMG6869U-7 is also a logic fet, with only 36m\$\Omega\$ Rdsonat just 1.8 volts! clearly not acting like a resistor when driven from 5v!https://www.diodes.com/assets/Datasheets/products_inactive_data/DS31738.pdfplease at least ensure that you're not spreading misinformation by reading the data sheets!Quote from: Civilenjuneer on May 29, 2019, 08:31:39 amI had a look at the datasheets of the replacement fets which you found. both seem to have a bit too high of an Rdsonfor what I'm used to with my own designs. I think the NDS355AN is a suitable choice in the SOT-23 form factor, but the FDS6930B is also a good choice and it's a dual mosfet package which makes your life easier. Psi mentioned some good parts too, use that TVS and 5V reg. you should select "automotive" parts rather than "catalog" when shopping for parts used in a similar projectT.I. often provides "military grade" parts too, in case you want to go overboardto further reduce noise, you can use a pi LC filter (with the L, ideally being a common mode choke between + rail and GND rather than a simple inductor) like so:(the choke is shown as two separate inductors here)the schottky diodes I mentioned were for input protection, not for power lines. if you want something faster than transorbs (TVS diodes), you can use the BJT method which dave showed in this video (I recommend you do not delete the transorb, rather include both of these methods):easiest way to ensure your inputs are protected, is to use a known clean input, like the output of the 5v regulator, instead of using voltage dividers directly from the battery!I wanted to design a schematic to clean up yours, but the one you provided is very lacking. please provide the full schematic and we will clean it up a bit for you.

author: KL27x
author_rank: Super Contributor
timestamp: May 30, 2019, 12:12:58 am
content: Might a regular diode clamping ground to power rail be good for protecting the micro from reverse voltage spikes? The input rectifier might allow enough reverse leakage to cause a problem?

author: OM222O
author_rank: Frequent Contributor
timestamp: May 30, 2019, 01:08:46 pm
content: Quote from: KL27x on May 30, 2019, 12:12:58 amthere is a reason transorbs exist and are used over simple zeners: zenr diodes are far too slow for high energy spikes, esd, etc. in case of ESD you can get away with schottky diodes and they are much faster than zeners, but cheap enough that you don't have to worry about using a lot of them. TVS diodes are usually more expensive and are only used for exactly the type of the problems OP mentioned. they can also be used for things like protection against lightning, in tesla coils, etc where high voltage spikes are common. it has nothing to do with leakage current.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 30, 2019, 01:31:22 pm
content: For power line protection, zener/TVS speed is a nonissue, as capacitors can be used to absorb the quick spike. For high bandwidth signals, adding capacitance would be an issue.An SMD MLCC with its low inductance and low ESR easily absorbs such spikes. Parallel it with a high-ESR capacitance with Chi_esr > 2..3 * Clow_esr to prevent ringing. For example, a 470uF cheap electrolytic paralleled with a 2.2uF 0805 capacitor would do the trick. Then, the clamping can be slow (any zener or TVS).