The Power Supply Question
Now that you have a basic h-bridge, you’re probably itching to hook it up to your micro controller and motor and test it out. Not yet.
We need to look at power supplies, and isolation. It is possible to use the same power supply to power both the motors and your micro controller, but this is generally a bad idea. A very bad idea.
When a motor is drawing large amounts of current, it will cause battery terminal voltage to droop, which can make a micro controller reset. Not a good thing. If you are building a small robot, and have very small and efficient motors this may not cause a problem. I have successfully run a mini-sumo with this power scheme, though I would not recommend it if you can fit in separate power supplies.
The best thing to do is to use 2 power supplies, one for the micro controller, one for the H-Bridge and motors. The two power supplies need to be connected somehow. A popular way to do this is by having a common ground, where the ground (-‘ve) terminals of both power supplies are connected together. If the motor draws large amounts of currents, the motor supply may still droop, but the logic supply will be unaffected. However, there are still problems with this common ground. Electrical noise produced by the motor, especially through back EMF, will cause a noisy ground rail, which is often the cause of the ‘phantom reset’ so dreaded in robot sumo.
The best solution is to completely isolate the motor and it’s driver from the micro controller, with opto-isolators. Putting opto-isolators in right before the mosfet drivers (i.e. TC4427) is the best bet. This will allow the interface circuit and micro controller to run off a voltage of 5v (or 3.6v, or whatever you chose), while the mosfet drivers, the H-Bridge and the motors run off another supply, without having to worry about noise being introduced in the ground line of the micro controller circuit.
An optical isolator will also solve the problem of translating signal levels from logical 5v (or whatever you are using) to the motor supply voltage.
Motor Noise and You
Motors will always produce noise, and not just the audible kind. They will produce electrical and RF noise. Some motors are so bad that if you connect a motor to it’s power supply, and hold it near enough to a TV, you can see the effects of RF noise on the picture.
How to avoid this? One of the simplest solutions is to put snubbing capacitors on to your motor. Connect a small capacitor (something around 1 micro-farad) across the motor leads. This will get rid of some of your high frequency noise. If the case of your motor is metallic, place another one micro-farad capacitor from each lead to the case.
You may also find it helps to put a sheet of metal in between your motors and your controller circuit, in order to shield any excess RF noise produced by the motor. Generally steel is a good solution, and other metals may work too. Connect this RF shield to the ground of the motor supply.
In order to maintain peak performance, and to reduce the chances of freeing trapped smoke, you need to cool your mosfets. Simple heat sinks work well. I personally like using CPU heat sink and fan combinations, as they fit nicely over the 8 mosfets in TO-220 packages required to control two motors. The fan not only helps get rid of excess heat in the heat sink, but also adds to the LCF (Look Cool Factor). Special heat sink grease should also be applied between the mosfets and heat sink to maximize heat transfer.
When using heat sinks, it is important that you do not inadvertently short out the mosfets. The metal heat sink on a TO-220 package may be connected to one of the mosfets pins.