However, when I supplied the robot with power from both a 12V DC adapter (logic) and a 6V AA battery pack (actuators) I made the amateur (though very easy to commit) mistake of simply plugging the servo power and ground to the positive and negative terminals of the 6V pack, and plugging the logic power and ground to the positive and negative terminals of the 12V source. The problem, which I later discovered after extensive net-searching and messing around, is that I did not connect the logic and actuator power source grounds (see in image above: the black jumper joining the negative power strip to the GND pin on the Arduino).
The reason for why this connection is necessary is somewhat theoretical, and perhaps not necessarily obvious. As Reddit user sinembarg0 succinctly explained:
"Let's represent voltage by the level of water in a glass. If there's no water in the glass, it's at 0v. If there's 5 cm of water in the glass, it's at 5v. When we have two separate power supplies, we have two separate glasses. Since they're both 5v supplies, we should have 5cm in each glass, but the problem is that we're not measuring the amount of water in the glass. We're measuring the difference between the bottom of the glass and the top of the glass. However, when there are two glasses, we're measuring the difference between the bottom of one glass to the top of the other (the bottom being the ground connected to the servo, the top being the logic high the Arduino is sending). That works great when the glasses are on the same table, but what if I set one glass on the floor? Then you could be reading something completely different, even though both glasses only have 5cm of water in them. By connecting the grounds together, we are ensuring we have the glasses on the same table." -- Source
Having spent considerable time hacking and making projects with Arduinos, I'm surprised I hadn't encountered this issue before. This was one of the trickiest issues to track down, because the problems and behaviors it causes make absolutely no sense. Here are some of the symptoms I encountered when neglecting to connect the grounds:
- One of two servos would hum and jerk wildly, when both were meant to be active
- One would randomly start working, while the other would be completely inactive
- Both would randomly start working, then stop after a short while
- Neither servo would move, BUT (very strangely) when I would pinch a signal wire with my finger, they would start jerking
- Swapping out the servos, some would work, some would move erratically, some would simply hum, and others wouldn't make any indication of being powered at all
In other words, there was no easily observable rhyme or reason to the behavior I was witnessing in the servos.
Of course, once the grounds were connected, all the odd behavior went away, and everything now works as it should. :) This is certainly something to remember for future applications, not just with Arduino, but with any instance of dual power sources contributing to a single output device (e.g. servo, light, motor etc.).