# Why does connecting a high-current device to my digital circuit cause weird behavior?

I have a

• arduino
• microcontroller
• other digital thing

and when I connect a

• motor
• pump
• heater
• other high current thing

I experience

• reboots
• crashes
• errors in digital communication
• other unexpected behavior

My power supply is properly sized to power all these devices. I don't have an oscilloscope so I can't see much what's actually happening in the circuit. What's a likely cause?

-
Show a block diagram of your system, including all the power and ground connections. This is likely where the problem lies, but without a diagram it is hard to guess what you might have messed up. – Olin Lathrop Jan 21 '14 at 19:35

Without details it is impossible to give a specific answer. Look at these things closely:

1. Grounding. This is exactly the symptom you get from a poor overall grounding strategy. Without a block diagram showing power and grounds of everything connected, it's impossible to give specific advice. However, carefully visualize all the ground return currents, and consider that any current on a ground conductor will cause a ground offset.

2. Local decoupling. Make sure there is a 1 µF or so ceramic cap as close as possible between each pair of power and ground pins of each chip. These connections need to be short, because even a little series inductance significantly reduces their effectiveness.

3. Power supply surge capability. Make sure there is enough bulk reservoir capacitance on the power supply to handle transients for whatever time it takes for the power supply itself to catch up and deliver more current.

4. Inductive catch diodes. Make really sure that any possible inductive load, which includes any external load, has a reverse polarity diode across it. For voltages up to 50-100 V or so, these should be Schottky because of their high speed. This applies to loads driven by DC. Since they are always driven with one polarity, the diode can safely short out the other polarity. As Tut pointed out in a comment, for AC loads, more complicated snubber and/or clipping circuits need to be used.

-
Inductive catch diodes when inductive loads driven by DC. For AC you need something like MOVs &/or snubbers. – Tut Jan 21 '14 at 19:37
@Tut: Good point. I have updated my answer accordingly. – Olin Lathrop Jan 21 '14 at 19:48

Consider these two circuits:

simulate this circuit – Schematic created using CircuitLab

Are they the same? In the lumped element model they are. However, our model neglects what may be a relevant fact: real wires have resistance. Let's introduce a couple schematics that model that:

simulate this circuit

Consider in the circuit on the right what happens as the current drawn by the motor changes. One moment it's off and drawing 0A, then it's on, and drawing 1A. This 1A must flow through R1 and R3. By Ohm's law, there must then be a voltage drop across these resistors of $1A\cdot 1\Omega = 1V$. With 1V of the supply voltage lost over each of R1 and R3, from the perspective of the microcontroller, the supply voltage is suddenly 10V, not 12V.

A lot of digital electronics don't like it when their supply voltage rapidly changes. Additional problems occur when there are multiple devices trying to talk to each other over a digital bus, but high currents in the supply rails are giving each device a different idea of what "ground" is. Look at "ground" for the MCU, and the motor in this case. All of the resistors have 1A in them, and thus 1V across them. "Ground" at the MCU is 1V different than "ground" at the motor! If these are digital devices which are signalling a "0" by making a voltage equal to "ground", they are not going to communicate very well when they can't agree on what "ground" is.

A solution to this is to run both of the power supply connections for each device all the way back to the battery or voltage regulator, and make all the power supply connections for each device there. This is the situation modeled in the circuit on the left. Here, when the motor switches on, there will be high current in R5 and R7. There will be some voltage drop here, but the motor won't mind. Meanwhile, the current in R6 and R8 is unchanged, and so too is the voltage. Thus, the supply voltage seen by the microcontroller is constant.

You don't have to do this all the time, for each device, but you do need to give some thought to where high currents will be running when your circuit includes such a device. Remember that all your wires have some resistance, and thus will experience a voltage drop when high currents run through them. Then plan your wires or traces so that the high currents don't flow through the supply for the sensitive components, causing noise issues.

This is but one possible explanation. Other answers will no doubt provide additional possibilities.

-