2
\$\begingroup\$

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:

enter image description here 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.

\$\endgroup\$
  • \$\begingroup\$ What is the H-bridge drive voltage? \$\endgroup\$ – Mahendra Gunawardena Aug 2 '15 at 3:13
  • \$\begingroup\$ The nominal drive voltage is 12v, but with LIPO 4s battery it could go as high as 16.8. This is one reason for wanting to measure the motor voltage on the h-bridge. \$\endgroup\$ – Bob Sculley Aug 2 '15 at 19:09
  • \$\begingroup\$ So the circuit will need to handle +/-16.8V worst case, +/-12V nominal. Let me know if the circuit topology below will work for you, if so I can do the calculation and post the results. \$\endgroup\$ – Mahendra Gunawardena Aug 2 '15 at 22:23
2
\$\begingroup\$

Use two ADC inputs, one on each side of the motor. The voltage across the motor will be the difference between their values.

\$\endgroup\$
2
\$\begingroup\$

The H bridge doesn't produce negative voltages, with respect to the system ground. Each side of the motor can be connected either to ground or +V. To the motor this looks like a swing from +V to - V.

So if your ADC ground is common with the H-bridge ground, you just need to divide the voltage at each end of the motor down to a suitable range. Then subtract in software. This is what the circuit above will do.

You can decide if you want to smooth out the PWM and get an average voltage, or sample the PWM and see the square waves.

\$\endgroup\$
0
\$\begingroup\$

I worked on project where the a subsystem would output +6V and -6V output to driver a actuators. I need to convert the +6V and -6V to something close to +3.3V and 0V which was an input to an ADC.

I believe you will need 5V supply voltage as describe in the circuit below. You will need to determine the R1, R2 and R3 base on the H-Bridge driver voltage. As mentioned in a previous response, you will need two of these circuits to feed to ADC's

Below is the circuit topology which was inspired by a post from this community.


schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.