I am controlling two motors using a double H-bridge controller. I would like to measure the voltage at each motor using ADC's on the microcontroller. The problem is that the motor voltage may be either positive or negative (depending on direction), while the ADC requires only a positive input. What kind of circuitry is required to obtain a positive output from either a positive or negative input? Ideally it would be simple and not require a lot of components.
I saw a similar question answered on this board which I have included below. I built this circuit, but it produces positive readings on one output and negative ones on the other. Does this actually work? If so what am I missing?
Original answer (provided by jippie) follows:
When the motor is driven from a full H-bridge and you want your Arduino at the same ground reference as the rest of the car, then you can use the following:
Both outputs range 0 .. 2V4, and you should set Arduino's internal reference voltage to 2V56. By attaching both outputs to their own analog input, you can calculate the motor voltage by subtracting them. The capacitors are there to average PWM signals so it can be measured by the ADC.