# Controlling output from L298 motor driver

I have an L298 dual H-bridge motor driver that I want to drive 2 DC motors.
Input to the L298 is around 8V and the motors have a max voltage of 3V (stall current of 2.1A)

I am using an Arduino to provide PWM input to the controller. I want to measure output from the L298 and use that to adjust the PWM duty cycle so that it operates at the top of its operating spec (without going over).

I thought of measuring L298 output across its output terminals, but there is no common reference with the Arduino (i.e. the "negative" terminal on the driver output is not GND). How would I do about measuring the voltage across the 2 terminals?

As the motor is an inductive load, I am thinking that current is a better measurement of safe operating limit. If that is the case, what limit do I pick? (100% of stall current? 80%? 60%). The L298 has pads I could solder to for measuring current. Even if that is the correct way to go, I would love to know how to measure voltage where I don't have a common reference.

To measure motor current and voltage, use a multimeter. If you don't have one, now is the time to buy!

Note that when delivering over about 1 ampere, the L298 driver will rapidly heat up and shut down. It is an old design and will drop up to 4V internally.

If you want those motors to function at the top of their range, use a modern motor driver, like the ones offered by Pololu.

thanks for the quick response - but I want my Arduino to measure the voltage (and/or current). The problem is that the "negative" terminal of the motor output is not tied to the Arduino ground - so I have no reference to measure against.

You can't use an Arduino ADC input to measure either the motor voltage or the motor current on an H-bridge, because of the ground problem and because the motor voltage could easily exceed 5V on either side.

3V motor with 2A stall = 1.5 ohms

If you use standard decay modes you'll over current the L298 since there's nothing to stop the current
rising to 8V / 1.5 = 5.5A (other than burning out the L298). Synchronous rectification mode is possible
since that limits the effective voltage to the duty-cycle times the supply, but that is tricky to use as you
have to PWM two pins per motor in antiphase.

There is no point trying to measure the voltage and its not interesting information - you need to sense
the current if you want to limit the max current through an inductive load.

Probably your best bet is to figure out the max PWM duty cycle by trial and error using a multimeter
and stick to that. You won't get very good mechanical load regulation though and probably not much
power either.

Its good practice to size your motor driver to be able to handle the stall current of the motor without
damage.