Quite often, roboticists will design and construct a mobile robot running on batteries, only to discover that there are nasty interactions between the pieces when they are all running together. Most commonly, this shows up as a control processor that crashes when the motors are turned on, but it can also appear as sensors that are overly noisy, or a robot with just plain erratic behavior.
The first thing to remember is that NO component is perfect, not even wire. Unexpected results happen when we forget this rule. The second most important rule is that there is no such thing as ground. This is especially true when either high currents or high frequencies are involved.
Let's go back to the beginning. The basic idea when using wire is to create a complete circuit. You want electrons to flow from a source (like a battery), through a load, and then return to the source. For this reason, I like to refer to a wire as being a "return" rather than a ground. Once you pass current through a wire, it begins to have different voltages at different points along it. This is because the wire has resistance. If the current is AC, the inductance of the wire comes into play also.
Look at figure one, and you'll see how this can cause problems. The high current load (probably a motor in a robot) is being driven with a PWM (Pulse Width Modulation) driver, which switches the motor on and off very fast. This switching current causes a varying voltage in the return wire at the lower end of the motor. Because the controller and the motor share a return wire to the battery, this varying "ground" voltage is also seen by the controller. If this were just a DC problem, you might fix it by using heavier wire. But since it is an AC problem (because of the PWM), it is actually the inductance of the wire which matters, and bigger wire won't help, since the inductance is a factor of the LENGTH of the wire.
The right way to fix this problem is to run a separate return wire from the controller back to the battery. The same is true for the supply voltage. Obviously, the example above is a bit trivial. What happens when your robot gets really complex? You can't have hundreds of supply and return wires running around inside your robot - there wouldn't be room for anything else. In that case, you should group your loads into a few types - High Current, Medium Current, and Low Current, and then any really sensitive circuits can get their own supplies. What I generally do is group my fuses and my returns together - if a particular subsystem has its own fuse, I give it a separate return also.
A related problem is caused by the magnetic field generated around each wire. If the supply and return wires are separated by a large distance, you've just created an electromagnet. Now the noisy currents flowing in this circuit can also upset other circuits nearby by inducing noise in them indirectly. The way to solve this is to keep each supply wire and its associated return wire right next to each other. This minimizes the area of the magnetic loop. I actually use twisted pair wire whenever I can. I'll go over this in more detail in another article, but I wanted to mention it here just to be complete.
Next let's talk about batteries and how their limitations can affect robot behavior.
Remember rule number one from above: There is no such thing as an ideal component. Batteries are wonderful things in mobile robots, but they all have one problem - internal resistance. They also have output voltages that vary over time. For these two reasons, I never run critical circuits off of raw, unregulated battery voltage. Even though it is tempting to run your 'HC11 from a six volt battery directly, DON'T DO IT!. The robot might behave all right at first, but eventually you will find a combination of battery charge and loads that makes the whole thing lose its mind.
Take a look at figure two. I've shown a typical power wiring scheme for a mobile robot using the ideas from above about separate return wires for each group of circuits. I've also shown the internal resistance of the battery as a separate resistor. Now, as you turn loads (motors, etc.) on and off, the power distributed to the robot will go up and down by a factor related to the current drawn by the load multiplied by the internal resistance of the battery and the main fuse. If you are doing rapid switching of a few loads, and throw in some PWM control on top of it all, you can imagine that the power will begin to look pretty ugly.
We can improve the AC situation quite a bit by adding some capacitors across the battery. As a rule of thumb, I use a few thousand microfarads of capacitance for each amp of load current. Of course, capacitors aren't perfect either - they have internal resistance and inductance as well. For this reason, it is often better to use a few smaller capacitors in parallel instead of one large unit. Also, large capacitors become ineffective at high frequencies, so you should also add a 0.1uF ceramic cap across the power lines.
I begin to think of these capacitors as my power source, because right across their terminals is where the AC impedance is lowest. As much as possible, all loads are supplied from and return to these caps.
If the robot gets really complex, I step up to the next level of noise control, and add L-C filters to each major branch circuit - corresponding to the fuses, etc. I put about 100uH inductors in series with each supply line. On the load side of the inductor, I add another electrolytic cap in parallel with a 0.1uF ceramic cap. This really keeps any noise generated in a branch circuit from getting through to any of the others. Figure three shows an "ultimate" power distribution scheme for a 12 volt battery system. It has a main fuse and power switch, three branch circuits with their own fuses, switches, and filters, and bulk capacitors across the battery terminals. If this scheme won't do it, you just need separate batteries!
The general idea here is to think about how the current flows from the supply to the load and back, and think about which currents are sharing which wires. If you stick to those simple rules, you will be a long way toward solving or avoiding noise problems in your robot. The bottom line is, if your robot begins to act crazy, take a look at its power supply.