Does anyone know why my project blew up? - Page 1
Forum section: electronics / projects

author: Josh
author_rank: Contributor
timestamp: May 08, 2018, 03:21:10 am
content: Amateur here… So, I created this Arduino Nano based controller to fill up a pond when the level is low, and dose chemicals once a day. It uses a high-level switch to know what level to fill to and a peristaltic pump to dose. Attached is the schematic.When I was testing the dosing today (5mL every 10 seconds), it worked for a few cycles then stopped. The enclosure smelt burn (dammit!) and then nothing worked. The LED on the Arduino wasn’t lit when powered by the power supply. It did light up when I unplugged the unit and just connected a USB cable – but Windows said it couldn’t recognize the device because it malfunctioned.I probably made a silly mistake! Any ideas on what went wrong are much appreciated!Pump (12V, 0.3A):https://www.aliexpress.com/item/1Pcs-DC-12v-D2-Small-Dosing-Pump-Water-Pump-2mm-DIY-Peristaltic-Tube-Head-For-Aquarium/32797820282.htmlCalculation for transistor:Code:Beta = 150 @ 25C / 300mA Ic / approx. 12V (10V)Ib = Ic / beta = 300 / 150 = 2 mARb = ( Vin – Vbe ) / Ib = (5 – 0.7) / 2 = 2.15k ohmsPick a resistor lower so we have enough current to fully switch it -> 1k ohmsIb = (5 – 0.7) / 1 = 4.3 mAMax current per pin is 40 mA so should be totally fine, no need for a relay or Darlington?Rated input voltage is 7-12 V and measured voltage from the supply is 12.14V no load. Ok?

author: DaJMasta
author_rank: Super Contributor
timestamp: May 08, 2018, 03:54:21 am
content: Do you know what burned up? 12.1V on the input probably won't kill the arduino, but it is at the top of the rating, so maybe some issues from driving the solenoid or motor.Basically, both are big inductors, and while you have a flyback diode, you don't seem to have any bulk capacitance on the output of the power supply, so you could be momentarily drawing a huge amount when either tries to activate or getting a big voltage spike on that line when they shut down.Are you driving the solenoid with PWM? That wouldn't cook it, but it would be important. Do you have the power supply ground tied to the USB ground?

author: Josh
author_rank: Contributor
timestamp: May 08, 2018, 04:17:53 am
content: Thanks for the reply! Not sure what burned up.0VDC (V- and "GND" in the schematic) is not connected to ground... What's the consequence? (USB was not connected when running)Is a cap needed? Looks like there's one built into the power supply:https://www.mouser.com/datasheet/2/260/S-25-spec-770094.pdfI'm not using PWM. Don't understand why... Teach meBut the solenoid was working fine and was turned off for a long time before it burnt up. Don't think it cause the failure but would like to learn.

author: iMo
author_rank: Super Contributor
timestamp: May 08, 2018, 05:08:32 am
content: The calculation above is using small signal beta, for switching of the 0.3A (it could be more in reality) with such a tiny transistor you have to saturate it fully, so always use beta/10 for large collector currents and full saturation (the transistor is fully opened).Otherwise the transistor may work in an linear mode, not fully opened, and the P=Ice*Vce may smoke.The 40mA off an atmega328 pin is a myth, afaik, 20mA is the max.I would use a 3 Ampere darlington for a reliable operation, 1k-10k in the base will be ok then.Also always use a 1k-10k from the transistor's base to emitter to close the transistor fully when the mcu's pin is floating.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 08, 2018, 07:06:48 am
content: For unknown motors, 10x is a good approximation for the rotor stall current (which always happens shortly at startup at 0 rpm).Can your transistor handle 3A for at least some 100-200 ms, preferably for unlimited time?Do you have the freewheeling diode, i.e., a half bridge? How about DC link decoupling?You are creating a motor driver, which is much more complicated than just using a transistor as a switch. You need to control the reactive energy.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 08, 2018, 07:12:02 am
content: Quote from: imo on May 08, 2018, 05:08:32 amWhen in doubt, look at the datasheet:"Absolute Maximum Ratings: DC Current per I/O Pin 40.0 mA"While running at absolute maximum ratings is not indeed wise, always derating down to 20mA is not strictly required, especially if it's just a single pin, so that we are far away from the total 200mA absolute maximum rating of Vcc/GND pins.In case of intermittent usage a single pin of the package, running at 40mA would be just fine.

author: frozenfrogz
author_rank: Frequent Contributor
timestamp: May 08, 2018, 08:04:21 am
content: Can you determine what part / parts were killed in the process?I would suspect the voltage regulator on the Nano to have been smoked. That Meanwell S-25-12 can be 'tuned' to 10.8 V to 13.2 V output.The Nano reference design utilizes aTI UA78M05CDCYRthat is quite beefy, however a lot of clones get away withAMS1117for example. 12 V is already the maximum nominal input for that LDO, while the TI part can handle more.Mind you: The higher the difference between input voltage and the 5 V output voltage, the more energy has to be dissipated from the LDO.

author: abraxa
author_rank: Frequent Contributor
timestamp: May 08, 2018, 10:10:01 am
content: Also, this is a brushed motor and I see no external bypass cap. While it is possible that the cap is inside the motor, I don't see this very often, so my assumption is that the cap is missing. This leads to huge voltage spikes on the motor terminals when the brushes move along the commutator. I don't claim to know which cap would be best to use in this case but a 10nF (or 100nF if you don't have one) ceramic cap connected to the motor terminals should be better than none at all.

author: David Hess
author_rank: Super Contributor
timestamp: May 08, 2018, 09:25:57 pm
content: A forced beta of 10 or 20 is typically used instead of derating the typical beta by 50%. So the base current should be 15 to 30 milliamps. And at that level, I would use a Darlington configuration or more likely just two separate transistors with one driving the other to reduce the drive current requirements from the Arduino.The output transistor should be current derated to handle the surge current of the pump. A 2 amp transistor operating at 300 milliamps is more reasonable.Suitable Darlington transistors would be something like the MJE80G or TIP122. For a bipolar output transistor, I might use a TIP31.

author: wholder
author_rank: Regular Contributor
timestamp: May 08, 2018, 09:26:30 pm
content: I would strongly recommend using a "logic level" MOSFET, such as the IRF540ZLPBF (https://www.mouser.com/ProductDetail/Infineon-Technologies/IRF540ZLPBF) instead of a junction transistor. This places minimal load on the Arduino output pin and eliminates the base resistor (although connecting a 1 meg, or so resistor from gate to ground is good practice, see:https://jeelabs.org/2012/11/11/low-side-switching/)The IRF540ZLPBF is overkill for what you're doing, but it's first logic level MOSFET I found with a quick search. There are numerous other cheaper options, but you need to make sure to choose a MOSFET with a Vgs value that allows it to be fully switched on by a logic level applied to it gate input. It can be a bit tricky to figure this out from some data sheets, so look for the words "logic level" in the description.Or, you can use an opt isolator to drive the gate. See:https://electronics360.globalspec.com/images/assets/160/6160/Figure_4.JPGThis completely isolates the Arduino from any possible inductive switching transients (assuming the switch load is driven by a separate power supply.)I's also 2nd the idea that driving the linear regulator on an Arduino with 12 volts is a bit much, as it needs to drop 7 volts to get a regulated 5 volts. 9 volts, is better, if possible.Wayne

author: David Hess
author_rank: Super Contributor
timestamp: May 08, 2018, 09:47:17 pm
content: My only complaint about MOSFETs is that they are more expensive than a bipolar transistor solution. On the other hand though, the difference is not significant and they make things simpler.https://www.mouser.com/Semiconductors/Discrete-Semiconductors/Transistors/MOSFET/_/N-ax1sf?P=1z0z63xZ1yzxnagZ1z0y3zr&Keyword=logic&FS=True&Ns=Pricing|0

author: wholder
author_rank: Regular Contributor
timestamp: May 09, 2018, 01:34:37 am
content: If you can handle surface mount devices, there are many other options, too. For example, the TI TPS22810DBVR is a complete "high side" switch with configurable rise time, a thermal cutoff, handles up to 18 volts and is controlled by a logic signal.See:https://www.mouser.com/ProductDetail/Texas-Instruments/TPS22810DBVRIt costs 56 cents (USA) at quantity 1.Wayne

author: Josh
author_rank: Contributor
timestamp: May 13, 2018, 06:07:50 pm
content: Here are a few more clues:Arduino PSU is dead - does not produce any voltage on outputMCU is dead - does not function, does not properly enumerate via USBBoth transistors seem okFlywheel diodes seem okMotor runs fineQuote from: imo on May 08, 2018, 05:08:32 amI don't think it's needed because the high impedance microcontroller output will not allow any current flow and the transistor is current (not voltage) controlled - i.e.this answer- I was thinking of adding it anyway, but because I'm not doing a PCB for this I want to keep it as simple as possible to make it fit nicely on a perfboard.Quote from: Siwastaja on May 08, 2018, 07:06:48 amThanks for the rules of thumb. The 2N2222A is rated for 800mA continuous and that's all that is published. I tested the motor, the steady state current draw is 0.23A and stalled rotor is 1.35A.I pulled the transistors to test them and they seem to work fine. I like the suggestion to use 2 in a darlington arrangement (thanks David Hess), but since I have some mechanical relays on hand I will just use those. For those that suggested a FET or opt-isolator - good ideas but I'm just trying to use what I have on hand.Yes, freewheeling diode. No to half bridge - don't need the extra control.Quote from: frozenfrogz on May 08, 2018, 08:04:21 amThe LDO is dead. I bet you're right about it being the AMS. I know it's not great to disspate all that voltage as heat (12V-5V) but the total current shouldn't be more than 4.5 mA (31 mW) (and even less now with a relay). Thats only a 2.5 deg C juction to ambient increase in temperature on the AMS (assume 80C/W with 700mm2 ground plane, rated to 130C)I'm not sure how to drop the voltage practically. I think I'll tune down the PSU as the solenoid and motor should easily run off less than 12V (wait, they were cheap and didnt even populate the pot...), and maybe get a genuine Arduino... the AMS is rated to 15VDC and was running fine for long periods of time (without the motor switching on/off), so my plan is to keep it as is - and hopefully the other changes fix the issue.Quote from: abraxa on May 08, 2018, 10:10:01 amTrue. I read that a bypass cap is really only needed to suppress noise, which I don't think would cause this issue?But I did hook it up to the scope and there are some large voltage transients. The scope did not trigger when I connected the probes across the supply and started/ran/stopped the motor so I think the LDO wouldn't see higher than 15V and burn out... Nonetheless the voltage across the motor when stopping doesn't look great - just like you said. Didn't think we would see them since I have the diode on there - maybe the 1N4007 is just slow for forward recovery (i.e. slow is around a microsecond). I added a 10nF cap across the motor and it seems to have elimiated them though.Also, it takes about 70ms for the inductive motor stopping current to dissipate through the resistor - seems a bit long, any comments?So TLDR, going to add a cap across the motor, connect 0VDC to AC GND, and use a relay instead of the 2N2222A. I'll let you guys know what happens when I try again.

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2018, 07:13:52 pm
content: I assume you are replacing the Arduino. The easiest option would be to use a LM7809 regulator to pre-regulate the Arduino supply down to 9V. Dropping 3V at not more than 150mA, it shouldn't need a heatsink. Otherwise a string of diodes would drop 0.6V to 0.7V each, so four or five would get you down to around 9V. Due to its power LED an Arduino Nano draws a minimum of a couple of mA, which is enough to keep the diodes biassed at a Vf high enough to drop enough voltage to protect the Nano's regulator.A 2N2222A doesn't have a pulsed Ic rating. That 800mA Abs. Max is all its rated for. If you exceed that, its strictly at your own risk of bad things happening. The Siemens 2N2222A datasheet is the most informative as it has pulsed power ratings:http://www.alldatasheet.com/datasheet-pdf/pdf/44079/SIEMENS/2N2222A.htmlN.B. placstic TO-92 packaged 2N2222A 'equivalents' typically have lower current and power ratings compared to metal can TO-18 ones.A Darlington is a poor choice for driving a motor from a MCU due to the excessive voltage drop when on. If you don't want to have to increase the supply voltage to compensate, and provide significant heatsinking, use a small signal NPN as an emitter follower to increase the current capability of the MCU pin, and drive the base of a power NPN from its emitter, via the usual resistor. As the MCU cant directly pull the power transistor base low, a pull-down resistor sufficient to deal with the worst case leakage current, from the small signal NPN emitter to ground should be used. The power transistor *MUST* be rated for the motor's stall current, and the min. hFEof the emitter follower must be sufficient to provide enough base current for it to be fully saturated. It gets more complicated if you need a high side switch.If you are using a relay, it needs to be rated for the full stall current of the motor with an adequate margin or its life will be short.

author: Josh
author_rank: Contributor
timestamp: May 13, 2018, 08:45:31 pm
content: Thanks Ian for the reply - and to everyone else too. It's pretty amazing how I can post a question like this and get 10+ replies in a day from smart people all over the world. You guys rock.Quote from: Ian.M on May 13, 2018, 07:13:52 pmYes it needs replacing. The solution was right in-front of my eyes... another regulator!Thanks for the datasheet. Based on the chart there and some assumptions, it should be able to handle 1ms of the startup current... Feeling gutsy? I'm not, I put in a relay.Quote from: Ian.M on May 13, 2018, 07:13:52 pmWon't it be fine since the IO pin is 5V and Vbe x 2 = 1.3V? Lots of margin left or am just going the wrong way with this.Either way I think I see another problem with a darlington setup in that after the first NPN turns on, the second's Vbe = 12V and it is rated to only 6V. Emitter follower seems like a great idea, just need a bigger power transistor to do it.Quote from: Ian.M on May 13, 2018, 07:13:52 pm20A (SRA-12VDC-CL)

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2018, 09:28:33 pm
content: The problem with a Darlington is that, because the driver's collector is fed from the power transistor's collector, its Vce_sat as a combo can never be less than the Vce_sat of the driver transistor + the Vbe of the power transistor. This typically leads to three times more power dissipated in it than would be the case if the same transistors were used in the configuration I described.

author: David Hess
author_rank: Super Contributor
timestamp: May 13, 2018, 11:40:35 pm
content: In this particular case, there is no reason that the collector of the drive transistor needs to be connected to the collector of the output transistor. Two bipolar transistors can be used without being in a Darlington configuration.