5
\$\begingroup\$

Another "Arduino & MOSFET" question. I can't figure this one out. I've blown through 4 Nanos in the past week. The circuit works fine for several motor cycles, then the uC just completely dies.

I've checked every single point with my oscilloscope, and I can't find any voltages that would damage the Arduino. The 5 V power supply remains steady with the motor on/off, the GPIO pin never exceeds 5 V. Motor voltage spikes are eliminated with the flywheel diode.

I've rebuilt the circuit entirely three times, taking painstaking care each time to connect it properly. I've tried this circuit with an IRLZ44N and a DMN3023L-7. With both setups, after a few motor cycles, the Nano is completely fried.

I'm just driving one of these simple geared DC motors. I'm at a complete loss, I don't even know what to check.

Gate resistor - check. Soft start - check. Flyback diode - check. TTL FET - check. WTF!? Here's the circuit:

Edit #1: C1 is not the root problem. The first two circuits blew up, so I added C1 hoping a soft start might help, which it clearly didn't. The FET still works perfectly fine. I can turn the motor on/off by connecting the gate to 5 V. I quickly switched 5 V to the gate from my PSU with the oscope attached to the gate, and monitored the voltage. It never strayed from 0-5 V.

My 5 V reg & Nano are connected to ground. It was wrong of me to assume this was known. R2 is 100 kΩ

enter image description here

Edit #2 You can now see the circuit. 12 V comes in from a Amazon nameless adapter. The 12 V stays constant, no spikes, dips, or crazy Vpps. In the shown circuit, I'm using the Nano's built-in vreg, but in the upper left hand of the last photo, you can see my older circuit where I was using a dedicated 5 V reg, so that's not the problem. Note the kapton tape on both the circuit board and drain tab #4 of the TO-220, it's not shorted to anything.

enter image description here

enter image description here

enter image description here

Edit #3! The CULPRIT! So as it turns out, I bought a new oscilloscope the other day and was misusing it, as well as my power supply is quite good and the circuit is significantly more stable on the power supply than the power brick. Scoped properly, and using the crappy power brick, enjoy the lovely waveforms:

enter image description here

From about half hour of testing, I was able to measure:

  • Up to 12V on the MCU pin (BLU)
  • Up to 20V on the 12V line (YEL)
  • Up to 10V on the 5V (PRP)

Thanks everybody for the suggestions so far, we now empirical data regarding the problem. Thus far suggestions have been:

  • Soft start with PWM rather than a boring RC circuit
  • Twisted motor wire pairs
  • Flyback diode as close to the motor as possible
  • Extra (bulk?) capacitance on the 12V input.
  • Zener to the gate/mcu pin to clamp it at 5V
  • Lowpass filter before the Vreg (not a fan because of inline R)

Other than getting to work, having fun, and testing for myself, which area should my focus be on? How important is soft start? Are there other standard boiler plate methods to involve?

Edit #4: It works?

3 simple changes were added to the circuit. I added a 0.1uF bypass cap on the 12 & 5V lines, as well as a 150uF (the largest I had in the shop atm) on the 12V. The motor is switching happily away. I also spent a while probing with a far away GND vs a very close one and noticed the huge difference on the scope. With a far away GND, I saw voltages up to +12V on my GPIO, but with a close ground, that was reduced to +7V and less noisey. I also learned that most of the noise I was seeing was occurring 20ms after the switching event, and with my previous trigger options, I was completely missing it. With a good ground, I removed each component at a time testing along the way, hoping to see which part made the biggest difference. Nothing changed, and I got back down to the original circuit, and now it's magically working with no issues. Literally everything is exactly the same as yesterday when I posted this, out of desperation I even coiled the motor wires like in the photo I posted - still works. My only logical conclusion is that the motor when brand new was causing tons of noise due to new brushes, and now that it has been running for several minutes, the brushes wore in creating a better contact, less sparks, EMI etc. Am I crazy for thinking this? Either way, I'm completely pissed I didn't get see differences as I added in the capacitors.

Thank you for al the comments! I learned a lot, and the most valuable takeaway had nothing to do with a motor or mosfet, it was my oscope and probe. Sorry for the terrible ending to this story.

Cheers,

\$\endgroup\$
26
  • 3
    \$\begingroup\$ No ground connections to the uC or 5V regulator? \$\endgroup\$
    – Finbarr
    Feb 13 at 16:02
  • 1
    \$\begingroup\$ Is the MOSFET dead? Anyway for this kind of stuff, it could be anything, so the more information you give the more likely someone will have an idea. Especially information you don't think could be useful! And that means... you're going to have to show pictures of the whole setup. \$\endgroup\$
    – bobflux
    Feb 13 at 16:13
  • 3
    \$\begingroup\$ I don't see anything wrong in the pictures, it's very well made. I checked arduino nano schematics and I notice there is no capacitor on VIN. There is no capacitor on the board either. So there's the possibility of voltage spike on VIN frying the regulator. Does replacing the LDO on dead arduinos fix them? Simpler test: on the dead arduinos, is the LDO still working and providing adequate voltage to the mcu? Also, no capacitor on VIN means the LDO could get unstable... \$\endgroup\$
    – bobflux
    Feb 13 at 20:22
  • 2
    \$\begingroup\$ I agree with bobflux. Everything you've shown us looks fine. The only thing we don't see is the regulator and its periphery, and that's where I'd focus my attention. Extra capacitance across the regulator input might be in order, for regulator stability and to prevent high frequency components of motor noise passing right through it. \$\endgroup\$ Feb 13 at 22:06
  • 2
    \$\begingroup\$ Aha! Nice scope shot. Note when the whole screen takes 1µs, then you really don't know if what you are measuring is real or induction into the scope's alligator ground clip wire. Especially, if you measure a huge dV/dT on a power supply which is decoupled by ceramic caps (mcu vcc) it is suspicious, because huge dV/dt in a low ESR/ESL cap implies huge current which is not there. So I would recommend using the short ground spring to be sure. But your voltage spike issue should be solved by adding a lowish ESR high value capacitor on your board, for example 470-1000µF 16V. \$\endgroup\$
    – bobflux
    Feb 14 at 15:13

6 Answers 6

9
\$\begingroup\$

C1 in your circuit will cause more problems than it solves. It's a good idea, but if switching or motor transients are being coupled to the gate, an electrolytic capacitor there is unlikely to help, especially such a large value one. It will have to be much smaller, and ceramic.

You presumably have PWM driving the gate, say 1kHz, and so whatever RC filter is formed by R1 and C1 should have a cutoff frequency of at least ten times that:

$$ C_1 = \frac{1}{2\pi fR_1} \approx 15nF $$

schematic

simulate this circuit – Schematic created using CircuitLab

If the killer signal is indeed coming from the MOSFET gate, then the brute force solution is always going to be a zener diode:

schematic

simulate this circuit

Another thing that can kill the Arduino is fast power supply transients traversing the regulator unimpeded. Linear regulators do well at low frequency, but supply noise in the kilohertz or more (such as motor noise) tends to pass right through them. I recommend trying to filter this noise before it gets to the regulator:

schematic

simulate this circuit

R10 will drop a small voltage, but unless the Arduino draws more than 100mA, that shouldn't exceed 1V.

Lastly, keep those motor cables twisted together. You want the physical area formed by the entire motor/MOSFET current loop as small as possible, to keep its inductance low, and confine the magnetic fields as much as possible. Route them as far as you can from everything else. Magnetically induced currents in high impedance loops elsewhere (such as unused Arduino inputs) can produce large voltages.

\$\endgroup\$
4
  • \$\begingroup\$ +1 for suggesting minimizing magnetic loops by twisting high current pairs. \$\endgroup\$ Feb 13 at 23:40
  • \$\begingroup\$ This is great for making the circuit better, but it doesn't solve my problems of blowing up uCs, which is what I'm here to solve. I don't want to brute force "try" something, I need to be able to measure and quantify the problem so I can solve it the next time it happens. Also, I've been monitoring the gate, it never reaches above 5V or dips below. How would a zener help? Clamp it to what it's already at? \$\endgroup\$ Feb 14 at 12:13
  • 2
    \$\begingroup\$ @AJ_Smoothie, I get your frustration. I don't see any other way for death to arrive at the MCU from any other path, though. Unless you measured Vdd and IO potential at the instant of failure, you can't really claim that all is well there, and doesn't need protection or improvement. I'm sorry that my answer isn't better news. \$\endgroup\$ Feb 14 at 12:30
  • \$\begingroup\$ @SimonFitch I'm marking this as the correct answer. Thanks for taking the time to explain the "why" behind each of your suggestions. \$\endgroup\$ Feb 14 at 13:16
3
\$\begingroup\$

Not sure why C1 is in the circuit, but it shouldn't be there. It causes Q1 to turn on and off very slowly. This will cause Q1 to heat up. If Q1 fails, it may fail in such a way that the drain and gate become shorted. This will cause 12V to be applied to your micro-controller, causing it to die as well.

\$\endgroup\$
4
  • \$\begingroup\$ Soft start with a MOSFET connected to a microcontroller is well implemented with ramped PWM, not with an RC delay on the gate signal, which will damage your pass element and could possibly cause the failure mode described above. \$\endgroup\$
    – vir
    Feb 13 at 18:19
  • \$\begingroup\$ The soft start was added as a an attempt to solve the problem. The first two circuits did not have C1, and they also died. So I added the soft start because I had no idea what else to try, as this circuit should be really simple. \$\endgroup\$ Feb 13 at 18:26
  • \$\begingroup\$ @AJ_Smoothie Are the MOSFETs shorting out as well as the microcontroller being killed? \$\endgroup\$ Feb 13 at 18:57
  • \$\begingroup\$ No the fets are perfectly fine \$\endgroup\$ Feb 13 at 19:43
2
\$\begingroup\$

The biggest problem is a lack of a ground plane or of a star ground, and lack of decoupling capacitors in sight for the motor power circuit.

I'll edit this answer later with details, but generally speaking such circuits will work on the first try, without any problems or damage, if done right, and there are just a few very simple rules to follow. I'm sorry I don't have the time this very minute to expand on that. Just please know that your overall idea is salvageable if done right, and you won't, in the end, have any problems whatsoever on the hardware side.

\$\endgroup\$
1
  • \$\begingroup\$ I'll be interested to read the follow up! \$\endgroup\$ Feb 14 at 16:35
1
\$\begingroup\$

Thanks for the update. I now want to see inside the motor to compare new brush vs old brush. Your conclusion seems logical, but the same as all the comments here. Brush motors generate noise from the commutation of the brushes.

I have seen motors with capacitors soldered between the motor case (chassis) and the positive lead of the motor and the same thing on the negative side. The capacitor acts as a short at high frequencies, so when the motor generates noise it will be clamped (shorted) to ground (case) before travelling on the motor wires that go to the MOSFET.

\$\endgroup\$
0
\$\begingroup\$

Eliminate C1. This is detrimental as a capacitor here doesn't allow the MOSFET to switch rapidly as it is designed - the MOSFET sweeps through its linear region during turn on and turn off creating heat. R2 should be more like 100k (100k >> 1k) to ensure the gate is driven all the way on. This is less important than removing the capacitor.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ ...the sweep is the entire point of soft start.....this TO-220 package and this 40A (TA) FET is not going to overheat entertaining a piddly 130mA because of this soft start. \$\endgroup\$ Feb 13 at 20:29
  • \$\begingroup\$ What's the point of a soft start for a piddy 130mA load? Normally, you include a soft-start for high-inrush loads that would over-amp. Not a 40A MOSFET. Besides, the proper (controlled) way to soft-start the motor would be to ramp the PWM output. Your actual problem that you are having is EMI getting coupled onto the unused pins of the MCU. Try shielding the MCU from the motor. Also, solder the diode across the motor. You have a ship load of inductance in your flyback loop that compromises what the rectifier is trying to mitigate. \$\endgroup\$
    – MOSFET
    Feb 13 at 21:28
  • \$\begingroup\$ As a further enhancement, you can solder capacitors/snubbers across the motor leads and one from each motor terminal to the motor case to provide high-frequency low-impedance return to close EMI loops. \$\endgroup\$
    – MOSFET
    Feb 13 at 21:34
0
\$\begingroup\$

I'd add bypass capacitors (~0.1 μF) to the regulator input to ground and output to ground to allow fast switching transients a path to ground instead of through the regulator.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.