# Output voltage problems with L298n

Nello everyone i got a problemi with my first project, i give 5 volts to l298n and regulated by pwm, but out1-2 and out3-4 have different voltage, I made a video to show
https://vid.me/eUWe
Is the module defective or am I doing something wrong?
Thank you

Ok that video is an hour of something other than Arduino....

5V to an L298, you mean for the motors? You lose at least 2V in a 298, more under current....

The L298 drops 2 to 2.5V on the output, its not meant for low voltage systems like 5V, for low voltages a MOSFET H-bridges makes much more sense. With 12V or 24V the 2V drop is less of an issue, but its still an issue (heat dissipation).

Sorry I edited the video link, anyway, motors voltage range max is 6V, so if I give like 7v to module is okay? I'll add the schematics as soon as I can, the program is a simply 10second of one pwm value and 10 second of another and nothing else.. I have to use this module with 2A for channel because the peak current is about 1.5A

so if I give like 7v to module is okay?

At 2A through a 298, you can drop almost 5V according to the second last line on page 3 of the datasheet.

But the voltage drop shouldn't have to be the same for each motors? Motor 1(out1-2) and motor 2(out 3-4) have different voltage.. I mean, if I give 7 and the drop is 3, I should have 4v each motor but it isn't..

Maybe they draw different current: the drop depends on the current.

On the other hand I don't know what the internal tolerances are in the 298; maybe it's possible that both circuits differ, I wouldn't know. The datasheet does have Min / Typ / Max columns so maybe it can differ between the channels.

The point is, as made above, you can't afford to lose 2-3V in a low voltage system since that's a far more noticable proportion than on a say 24V system.

You should look to using a more modern technology like these offerings from Pololu.

is it possible to draw different current even if they are the same motor? The problem is that i need it like asap and in Italy i don't have much options, and shipping from USA isn't really fast

SZanni: is it possible to draw different current even if they are the same motor?

Well I guess 2 "nominally" identical motors are not necessarily "really" identical. Take the motors off and see what the voltage is, and /or swap the motors across to the opposite channels.

But I think you need to look at putting higher voltage in, to get enough out.

but another question, is it right to measure the voltage with pwm? I tried swapping motors and the problem is always in OUT1-2, because OUT3-4 have always higher voltage, i'm gonna try without PWM, but i'm worried to burn the motors, i have like 8V battery and motor range limit is 6

Post your code. (if you want to find the problem)

This was the code for that i video

``````int enA = 10;
int in1 = 9;
int in2 = 8;
int in3 = 7;
int in4 = 6;
int enB = 5;

void setup() {
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(enB, OUTPUT);
}

void loop() {
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
analogWrite(enA, 50);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
analogWrite(enB, 50);

delay(10000);

analogWrite(enA, 100);
analogWrite(enB, 100);

delay(10000);
}
``````

and this is how i wired

http://s3.postimg.org/4y4t5bgcx/L298_N.png

One of your Enables (10) is 490 hz and the other (5) is 980 hz. See Ardu!no analogWrite details.

That would result in one motor (B) turning at twice. the speed of the other (A). Get it?

(You must use EITHER 5 & 6 OR 9 & 10 for Enables (PWM). You CANNOT mix the two pairs)

(duh)

Just tried with 5&6 and nothing, 9&10 and still nothing, they receive different voltage, i tried without pwm and they receive the same voltage

ps after a while in pin 9&10 now they seems that they receive the same voltage, just a bit different, thank you a lot to everyone!

What was the voltage difference compared to initial code.?

( I assumed you changed the wiring to correspond to the change in code)

Clearly the initial. configuration/ code was wrong. If you read the analogWrite details you would have to agree. As to why it didn't work correctly after the change I have no idea.

I changed the code and the wiring and only after a while the 2 wheels went at the same speed, don't know why, but now seems to work! Tomorrow i'll test more, anyway thank you a lot!