I'm building a motor driver shield for the Arduino. Here's the schematics (please forgive the messy layout):
And here's the PCB layout:
I'm testing it out by breadboarding it while running a simple 'run for 5 seconds then reverse' procedure on the MCU, and I'm experiencing some odd issues with decoupling capacitors. If I leave them off, the motor stutters rather than moving smoothly, presumably due to the motor's power rail dropping. I put a 100uf electrolytic capacitor across it (shown on the board), and it started running smoothly.
Now, however, the motor reverses seemingly at random, I presume as the MCU is being reset for one reason or another. Following the 'more capacitance is better' mantra, I installed the second electrolytic cap, between the 5v and ground rails. Now, weirdly, we're back to step 1: the motor stutters.
Finally, I added a third, 0.1uf ceramic cap across the motor terminals. Suddenly, everything is fine: The motor runs smoothly, and it reverses when it's supposed to.
Adafruit's shield seems to solve the issue by just throwing lots of caps, both electrolytic and ceramic, at the problem. Unfortunately, as you can see, I have quite limited PCB space, so I can't afford to do that. I could take the cargo-cult approach and say "it's working now, great" and stop, but I'd rather understand what it is that caused each of these symptoms, and what I should do to ensure they don't happen on the real board.
- Is the 100u and 0.1u cap between the 5v (logic) rail and ground that Adafruit's shield has necessary? Removing it on my breadboard seems to have no effect.
- Do I need the 0.1u ceramic caps across both the motor rail on the H-Bridge input and directly across the motor terminals?
Edit: I've updated the schematic and PCB layout with the proposed positions of caps, based on the advice of those kind enough to answer my question.