I have some trouble about the response of the L298N DC motor driver. After some experiments, I have noticed that the output response of the L298N isn't linear.

In particular, if i give a ramp input signal (duty cycle), in the output signal (angular velocity) i obtain a signal like a square root, as show in the follows figures:

duty cycle speed

where the first image is the input signal and the second image is the output signal.

I obtained this data with a PWM frequency of about 50 Hz. If I use a higher PWM frequency, the output response is more fast, and become like a step response. My question is about this behavior, is this normal for this kind of device (L298N), or is it my fault?

I need a driver that give me a linear response, so anyone can give me some advice on some better motor driver with have a linear response? I have saw this component VNH2SP30, but I'm not sure about his linear response. Also i have looked at some cheap brushed esc but i haven't sufficient know-out to be able to take a decision, so any help is really appreciated.

@Dmitry Grigoryev It's a bit difficult to acquire the voltage on the motor pin. I have a multimeter and it not memorize the measured values. However i think that the problem is the driver and not the motor. I have changed the pwm frequency (increasing) and i had obtained a very strange response where the transitory it's very fast and the motor output respone seem to is flat. Also, I measure the current on the sense pin of the L298N. Using a pwm frequency of about 50 Hz i obtain this graph: current

peaks a part, this signals is unusable. You can see some discontinuities in this graph. However if I change the pwm frequency (increasing) the graph haven't any discontinuities, and the current signal is usable and flat.

Based on this behaviors I deduce that the problem is the driver.

I would to do note you, that I acquired this data usign an input voltage of about 11 V. This voltage supply the L298N and a voltage regulator. So, using the max duty cycle, the motor see a input voltage of about 9V. My motor is rated to run at 9V, and it's maximum speed is 11500 rpm. I have measured a speed of about 1200 rad/sec (as you can see from the second image above) that are about 11500 rpm. Also, i have acquired this values using the motor alone, without the gearbox. So there are more thing that bring me to think that the problem is the driver, and non the motor, but i haven't the security of my reasoning, so i asked this question.

@Dmitry Grigoryev I have done other experiments and the result are that the problem is the L298N driver. As can you can see in the next image, the motor speed have a linear trend in according to the theory:

enter image description here

I obtained this data using a potentiometer to vary the input voltage of the motor and measuring the speed of the motor. I haven't an instruments to memorize the input voltage of the motor, so i can't collect this data. However i turned the potentiometer of about one turn at time, from ~1.2V to ~9V collecting the speed of the motor only.

Also, your link and some other that i found on internet show the same trend of the driver controlled by a pwm signal, so i deduce that the non linearity is in the driver.

My doubt was about the cause of the non linearity, now i know that this behavior is normal for this kind of driver, so isn't my fault and now i can find some solution to manage this problem.

PS After read that this answer is closed because isn't unclear what i asked, i have some seriuos problem about the people that act as moderator in this site. In yours opinions what is mean this statement: "My question is about this behavior, is this normal for this kind of device (L298N), or is it my fault?" Or this statement: "My doubt was about the cause of the non linearity, now i know that this behavior is normal for this kind of driver, so isn't my fault and now i can find some solution to manage this problem."

I know that i'm not a genius for write in english language, but what i asked seem clear to me, maybe isn't clear for the moderator or for the persons that need an axis label to give a clear answer... ..without controversy, obviosly...

  • 2
    \$\begingroup\$ Axis labels were sold out today? \$\endgroup\$
    – PlasmaHH
    Oct 17 '18 at 9:26
  • 1
    \$\begingroup\$ Dear PlasmaHH, the axis labels are very expensive today.. However i think that the axis labels are not useful to answer this question. However If you think that the axis labels are so important for this question, then for the two images the X axis represents there are the num of samples, while in the first image the Y axis represent a number (duty cycle value using 16-bit register) while in the second image the Y axis represent the motor speed in rad/sec. I hope that this useful info, help you to answer to my question.... \$\endgroup\$
    – Luca80
    Oct 17 '18 at 9:38
  • \$\begingroup\$ You have to study a little bit more about the motors and their behaviour, to understand why you got nonlinear response, it's quite trivial and can't be differently. \$\endgroup\$ Oct 17 '18 at 9:40
  • 2
    \$\begingroup\$ @Mako Buršič, i don't know if an argument it's quite trivial for someone, if it was trivial for me, then I would not have asked this question .. \$\endgroup\$
    – Luca80
    Oct 17 '18 at 9:54
  • 1
    \$\begingroup\$ I added a few sentences regarding voltage measurement to my answer. Note that if your motor is rated at 11500 rpm, it doesn't surprise me that it stops behaving linearly as you approach that limit. \$\endgroup\$ Oct 18 '18 at 7:37

Measure the actual voltage you apply to the motor and verify that its relation to the duty cycle is linear. If you have a scope, you should see a quasi-triangular signal with DC offset proportional to the duty cycle. Using a multimeter may be problematic: you have to make sure it measures the MEAN voltage, not RMS or envelope or something else. Connecting the voltmeter via a low-pass RC filter may help. Also note that you don't have to measure the voltage at every duty cycle to verify linearity: making a measurement at 25%, 50% and 75% duty cycle should be enough.

If the voltage increases linearly with PWM duty cycle, then the non-linearity originates from the motor, not from the driver. Driving the motor too high voltage saturates the core, and the speed won't increase further despite the increase in voltage. You may want to check the RPM and voltage ratings of your motor and see if you're getting close to the limit.

If the voltage doesn't increase linearly, then you may be overloading either the motor driver or the power supply. As a result, the voltage at the motor stops following the duty cycle after a certain point.

Another reason could be that your motor has highly non-linear friction limiting the RPM. It may happen e.g. if your motor is driving a gearbox.

Also, using a PWM frequency as low as 50 Hz can also introduce some non-linearity because you push a significant AC current though your motor alongside with DC. You seem to say that increasing the frequency doesn't help, so it's probably not the issue in this particular case, but it could be a factor contributing toward non-linearity in general.


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