I was working on a robot which had to follow a black line as part of its work , but I noticed among countless other problems , my L298N was producing different voltages on two motors with the same pwm input.
So I added a part to my code just to confirm , and it was confirmed. My pwm output value was 100 , which meant around 1.9 volts . I checked with a multimeter and both L298 pins were receiving 1.9 volts.
Then I checked the motor outputs , and they had a difference of about 2 volts , which explained the visible and audible difference in the motors' RPM.
I checked a similar thread on this forum but OP has't mentioned what finally solved the problem.
But he was told to make sure he was using pwm pins with the same frequency , but I believe that is not my problem since I am using D4 and D7 on Mega for my pwm values and 2,3,5,6 for the digital controlling pins on the L298 (Im not using pwm on 2,3,5,6)
the same user had also posted on stackexchange and he was told that L298 itself is "old and unreliable" and this issue could actually be because of that.
after all this I am wondering which one could be the case in my situation as this seems uncommon to me , I have used L298 previously in similar projects and Ive never had such an issue (the very same L298 in some cases) , which makes me dubious on the L298 being the very issue.
On the other hand , everything seems fine before and after the L298 - pwm input is 1.9 volts and somehow output voltage is 2V different which is not minor .