This simple circuit will allow your processor to monitor the current being drawn by a motor or any other device. The circuit shown will monitor currents up to 20A which is ideal for the new "Wild Thumper" 6WD chassis.
The LM358 is a dual opamp that will work on voltages down to 3V. If you only want to monitor 1 motor then tie the inputs of the second op-amp to ground via 1K resistors so it doesn't generate electrical noise.
In the schematic I have not drawn a "H" bridge in detail as this circuit will work with any DC load. The important thing is that resistors R1 and R2 go between your load and ground.
How it works:
I have shown two 0.1Ω 10W resistors wired in parallel to make a 0.05Ω 20W "shunt" resistor. If you are using smaller motors then a single 0.1Ω resistor may be adequate. This resistance must be very small so it does not noticeably limit the power to your motor.
As current flows through your motor it also flows through your shunt creating a small voltage drop across the shunt that is proportional to the current being drawn.
In the circuit shown, with 20A being drawn a voltage of 1V would appear across the shunt (20A x 0.05Ω = 1V). The power disapated by the shunt is 20A x 1V = 20W
As many users will control their motor speed with PWM this means the voltage across your shunt would alternate between high and low values very quickly. Resistor R3 and capacitor C1 form an RC filter that averages the PWM voltage across the shunt.
The opamp is configured as a non inverting amplifier with it's gain being set by resistors R4 and R5 using the formula:
Gain = ( R4 + R5 ) / R4 = ( 4.7 + 15 ) / 4.7 = 4.19
In the circuit shown, the output will be aproximately 4.19V when the current drawn is 20A. If you need to change the gain then it is best to change the value of R5. Capacitor C2 is there simply to filter any electrical noise on the output.
As the opamp runs on the same supply voltage as your processor there is no danger of your processors analog input being damaged if the current draw exceeds the design limits. If you set your gain too high then it will simply not measure the current accurately beyond a certain point.
Shunt resistor alternatives:
As mentioned at the start, the shunt resistor in the circuit shown is rated at 20W and therefore can get quite hot. A cheaper but less accurate alternative is to use an automotive fuse with an appropriate current rating. The fuse is smaller, cheaper, doesn't get as hot and can protect your circuit from dangerous shorts. The down side is that you may need to recalibrate your software every time you replace the fuse. You will also need to increase the gain by changing R5.
If you need to measure more than 20A or you want a lower voltage drop across your shunt then you will need to consider buying a heavy duty current shunt such as the one pictured below.
This shunt is rated at 100A and has a resistance of 1mΩ (1/1000 of an ohm).
There are other methods of measuring current drawn by a motor but for most robot hobbyist the circuit shown is the cheapest and simplest.