3
\$\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\$
3
  • \$\begingroup\$ What is the H-bridge drive voltage? \$\endgroup\$ Commented Aug 2, 2015 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\$ Commented Aug 2, 2015 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\$ Commented Aug 2, 2015 at 22:23

3 Answers 3

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\$
2
  • \$\begingroup\$ The problem is you connected one phase lead to the ground. This could work if the grounds were independent, e.g. MCU was powered from a separate battery. \$\endgroup\$
    – Radzor
    Commented Jun 18, 2023 at 1:53
  • \$\begingroup\$ @Radzor, Thank you for the feedback. It has been a while since I worked on this project. If my memory serves well, what we did was scaled the +6V to -6V to +5V to 0V. Our use case was slightly different, but I thought this might work well for OP. \$\endgroup\$ Commented Jun 19, 2023 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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