Problem with pwm and motor voltage

Hi everybody... I am building a robot when i stumbled upon this problem. I am trying to control the voltage input to a brushed dc motor using pwm. The way I understand it is that there is a scale factor between duty cycle and out voltage, so for instance if I have a 10 volt battery and I need 5 volts to be input to the motor, the pwm used is 50%...

This works very well if measured from the output of a pwm pin on an arduino board, however, when I give pwm input to the motor driver and measure the voltage difference across the motor leads, this simple scaling rule doesn't work anymore.

My question is: is this a normal thing to happen? And if yes, is it because the motor driver? Motor's back emf?

I am using that simple dc motor with the yellow plastic gearbox, and L298N as a motor driver. Thanks in advance.

The motor driver drops some voltage as you will surely have seen if you have tried 100% PWM...you won't see 10V at the motor, probably more like 7.5V-8V. If you work out the maximum actual voltage like that then effective voltage at other PWM levels should be reasonably linear. It's just that 50% PWM will give you something line 50% of e.g. 8V not 10V.

Steve

Thanks Steve for your reply. I did some tests that I think confirm what you've said. First, I used a mosfet as a motor driver, and there is about 0.2v drop from the max. However, the relation is not linear for lower values of PWM. I then used a L298N h bridge module which gives a more linear relation, but the voltage drop is higher (when supply is 8 v, max volt seen by motor is about 6.2 v).

I then tried to replace the motor while using the same h bridge, and it almost gave the same linear relation.

This means that the two lines have the same slope. I then tried changing the supply voltage (so we can know how one point on the line in previous plot change, and as we know the slope we can reconstruct the line again) and I got this

which shows two identical lines for two different motors using the same H bridge module. The only thing I am left with is probably changing the h bridge module and redoing the last two tests.

ps: I attached the images in case they don't appear in the reply

mosfet h bridge.PNG

2 motors.PNG

supply.PNG

hassan_ali:
This works very well if measured from the output of a pwm pin on an arduino board, however, when I give pwm input to the motor driver and measure the voltage difference across the motor leads, this simple scaling rule doesn't work anymore.

This probably just means that you just need to do some measurements....... like 100% PWM translates to XX Volts DC for the motor input. So if you need higher DC voltage at 100% PWM, then just need a H-Bridge that can handle more input voltage (which might also provide a higher output voltage).

You should also measure the amperage used by the motors as it will drop voltage when load is applied. If your using normal AA batteries or a 9v battery the recovery time for these is longer than on a Li-Po or a lead-acid battery.

hassan_ali:
Hi everybody... I am building a robot when i stumbled upon this problem. I am trying to control the voltage input to a brushed dc motor using pwm. The way I understand it is that there is a scale factor between duty cycle and out voltage, so for instance if I have a 10 volt battery and I need 5 volts to be input to the motor, the pwm used is 50%...

Nope, that only works for certain modes, such as synchronous rectification - if you use a decay mode the
current is a non-linear function of PWM and load that depends on the motor windings and
magnetic circuit.