L298N output voltage is always way too high (UNO)

Hey everyone :slight_smile:

I used this module L298N so many times and it was always so easy, and worked just fine.
However, this time it doesn't want to work with me :frowning:

I wired the Vcc and GND to a power supply (12V, and kept the 12V jumper in place) and common ground with the Arduino. (Arduino UNO)
I then wired the two signal cables from the Arduino to the H-bridge (IN1, IN2)
And then the PWM cable from a pin on Arduino (digital pins, with the "-" mark) to the pin on the H-bridge. (Removed the jumper and connected)

But the problem is, the voltage to the motor is always too high - when I use 12V power supply, and PWM value of 10 (analogWrite(10) ) I get a reading of 8V (using a multimeter)

The H-bridge is new, unused - just opened it a few weeks ago (don't think I even used it), but just in case, I also tried another H-bridge, brand new straight from the box - same result. I also tried to use the second motor output, and same result - so the hardware is all good, I believe.

The code is nothing special, I set all 3 pins to OUTPUT in the setup(), and digitalWrite(HIGH) and LOW to the pins, and analogWrite(..) for the PWM value.

I thought maybe it has something to do with the PWM frequency (not that it should), and indeed it acts differently when the PWM is provided via pin5 (980Hz) or pin11 (490Hz) - but it shouldn't happen, it's just a simple PWM signal : but at least I tried and learnt something new.

Here are some more values I tried:
Using pin11:
12V, PWM10 -> 6.43V
12V, PWM128 -> 10.14
8V, PWM10 -> 4.47V
8V, PWM128 -> 6.84V

Using pin5:
12V, PWM10 -> 8.54:
12V, PWM128 -> 11.05
8V, PWM10 -> 6.04V
8V, PWM128 -> 7.44V

Is there something I'm missing? I know I barely sleep recently, but I always thought I'm still capable of wiring a simple L298N H-bridge :man_facepalming:

Thank you so much in advance! :smiley:

This may seem a stupid suggestion, have you got the I.C. connected the right way round?

Rather than delete this reply, apologies, I thought the I.C. was DIL. dual inline.

Good luck............

How are you measuring the voltage of the PWM output and what voltage do you expect it to output ?

I assume you know that the voltage of a PWM output will be one of two values and nothing in between ?

Hi @ranch12 .
It is not very clear whether the motor connected to this H-bridge works or not.

On the PWM output of the arduino are you reading 8V?

Despite your description of the connections, I suggest posting a schematic showing all the connections.
A drawing speaks more than 1,000 words.

RV mineirin

What voltage is the motor designed for?

When you are using PWM to turn the 12V on and off very quickly, how are you reading the average voltage? Do you have a capacitor/resistor low-pass filter to turn the 12V pulses into a DC voltage? Are you using a DC meter and hope the meter filters the input? Are you using an AC meter and hoping treating the pulsed DC as a sine wave gives a reasonable average?

I'm measuring the voltage using a multimeter. And I expect the voltage to be pretty much proportional to the PWM signal (sorry, I forgot to mention my final goal :sweat_smile:.
For example, if I run the H-bridge using 12V, and I give a PWM signal of 128 (half of 255) then I expect it to be around 6V. (Of course there is also the 1.5-2V lose of the H-bridge itself, but something around 6V)

And when I send a PWM signal of 10, I definitely not expect it to be 6V, something just doesn't seem right to me. Or is it just me?

Hi, thanks for your reply!

Sorry if I didn't explain myself quite good, and that I didn't explain my goal - I'm pretty new to forums. (Usually I just try to figure out things by myself) But the more you ask, the better you become in asking questions :wink:

Anyways, there isn't any motor connected to the H-bridge yet - because I wanted to first check the output voltage, before I connect a motor - to not damage the motor, or get unwanted result.

And what's the best way to create and upload a schematic? I never really did one :sweat_smile:

Sorry for not explaining myself so well.

The motor I'm planning to use is designed for 6V, but I use 12V for the testing (to have a bigger range of values to test). And I'm using a power supply, not a battery. (If it matters)

As I mentioned in the previous comments I posted now, I'm using a multimeter (without a motor connected) to check the output voltage - as a step before actually connecting the motor, in order to make sure everything works as expected, and to not have bad surprises when connecting the motor.

I am not using any low-pass filter, or any extra component's - just power supply 6V connected to the H-bridge and Arduino (common ground of course). The simplest configuration. I worked with it many times in this configuration at school, and it always worked just as expected.

Am I missing something that can cause the output voltage be not proportional to the PWM signal? Something that I need to check? It's just odd to me how something so basic, that I've done so many times before, just doesn't work (as expected) this time :man_facepalming:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.