Trouble using motor shield L298N

Hi guys, I'm kinda new to this. So, I'm working on a project of a bluetooth controlled car. I'm using four 5v DC motors and two motor shields L298N to control it using a 11v lipo battery to supply them (using arduino mega to manage it all). My problem is, every tutorial I find about how to use theese shields they work either on arduino supplying the electricity for 2 motors only or a 12v supply for 12v DC motors.
When I try to supply the shields using its +5V it works for just some motors (I checked the arduino's programming). When I try to use its +12v pin it doesn't even light. What am I doing wrong? What is the correct way to connect theese things?

The correct way is to show us your circuit and your code.

Take note that all motors are 5V and all IN ports are connected from port 2 of arduino to 9.

prog.png

eojones_:
My problem is, every tutorial I find about how to use these shields they work either on arduino supplying the electricity for 2 motors only or a 12v supply for 12v DC motors.

Check out this link....just in case.......click here.....

The 'personality' changing feature of the L298 (depending on jumper setting) can certainly be confusing. It's not because us users do not know how it should work. It's all about the people (makers) that wrote the instructions (or lack of clear instructions) about how it works. For example, the very first line of any L298 instruction should be made to say something like 'beware - the 5V pin can change personality, ie. output can become an input, and vice versa - depending on the jumper setting'.

Also, to ensure that the arduino is outputting the correct signals (voltages)....... use a multimeter or something to do some measurements. Then you can work towards finding out where the problem(s) lie.

When I check the voltage that's what I get:

Trying to use +5V as input pin:

  • +5v & GND : 11,2V
  • Only one motor works, and it gets 1,4V out of 5v its supposed to work with

Checking with +12v as input pin:

  • 12v & GND: 11,2V
  • No motor works neither the shield lights up

I got a suggestion to try some voltage regulator, but I've got none in hands.

All shield's capacitors seem to be working just fine. I'm afraid to fry them out :confused:

Plus, about the post u suggested to me: I don't think those will work for me because my circuit has different parameters.

Thanks, in advance for your time. I really appreciate it!

eojones_:
When I check the voltage that's what I get:

Trying to use +5V as input pin:

  • +5v & GND : 11,2V
  • Only one motor works, and it gets 1,4V out of 5v its supposed to work with

Checking with +12v as input pin:

  • 12v & GND: 11,2V
  • No motor works neither the shield lights up

I got a suggestion to try some voltage regulator, but I've got none in hands.

All shield's capacitors seem to be working just fine. I'm afraid to fry them out :confused:

Plus, about the post u suggested to me: I don't think those will work for me because my circuit has different parameters.

Thanks, in advance for your time. I really appreciate it!

When you say "Trying to use +5V as input pin:

  • +5v & GND : 11,2V
  • Only one motor works, and it gets 1,4V out of 5v its supposed to work with"

When you say 'trying to use +5V as input pin' ...... what does that mean exactly? Are you saying that you can see a pin on the L298 that is labelled as '+5V'? And you are using a +5V DC source to apply 5 Volt to that particular pin? If that is the case, then the jumper might need to be considered. There is a jumper .... when it is connected, the L298 will then use a pre-connected 12 Volt DC supply (connected to the L298) to generate 5 Volt at the "5V" pin. It does this by using the onboard regulator. So '5V enable' means enabling that onboard regulator. The logic circuits of the L298 becomes powered by the 5 Volt regulator when the '5V enable' jumper is inserted (connected).

But....when the jumper is disconnected, the pin that says "5V" on the L298 changes its personality.....and it then becomes an input pin (instead of an output pin). Also, for this condition, the onboard regulator becomes de-activated, so the only way that the L298 logic circuit can be powered is to apply your own 5V DC to the "5V" pin. But.....for this condition, the L298 instructions indicate that removing the jumper is meant to be for cases where your raw DC supply is greater than 12 V DC.

So...... using a 5V raw DC supply supply may or may not work here.

I mean that I'm connecting my 11V power source to it (+5v). I've also tried to remove the jumper to check if it worked and it didn't. I bought new shields just in case... I am to check if they work as its supposed to.

eojones_:
I mean that I'm connecting my 11V power source to it (+5v). I've also tried to remove the jumper to check if it worked and it didn't. I bought new shields just in case... I am to check if they work as its supposed to.

I see. Ok..... yeah.... don't connect 11 V DC to the "5V" pin. That's because ......the only time where +5V DC voltage should be connected to that "5V" pin of the L298 is when the "5V enable" jumper is removed from the L298 board.

So.....whether the "5V" pin of the L298 is being used as an input or an output pin...... the only voltage level it is going to be associated with is .... 5V DC.

This means...... better not apply 11V DC to that '5V' pin of the L298.

If you are going to try anything..... then remove the "5V enable" jumper from the L298, and then apply a regulated +5V DC supply voltage to the "5V" pin of the L298 (which is to power up the logic circuit of the L298). And then use a different raw +5V power supply and apply that +5V raw voltage across the "+12V DC" and "GND" of your L298. And make sure that the ground of your arduino and and ground of your L298 are connected together.

It's time those 298-based shields and boards were put to pasture. Those power connections and jumpers and stuff are way too complicated for my taste.

So much simpler to use a more modern module like those of Pololu such as this 2130 for example.

That 2130 is so simple: only one voltage to supply- it takes the logic supply from the motor supply, and no separate enable. No huge heatsink. And the whole thing's smaller than 1" square.

How simple is this:

pololu connect.GIF

pololu connect.GIF

I tried removing 5V enable jumper... Guess what? Didn't work! The board is powered by the supply but motors won't move.

About trying another board: unfortunately, I can't! It's one of this project's rules. :frowning:

eojones_:
I tried removing 5V enable jumper... Guess what? Didn't work! The board is powered by the supply but motors won't move.

About trying another board: unfortunately, I can't! It's one of this project's rules. :frowning:

Ok..... first..... state what voltage your DC motors need to operate at 5V? 12V?

If they are 5V motors..... then I would try removing the "5V enable" jumper, then apply 5V DC across the "5V" pin and gnd of L298. And then apply a different 5V supply across the "12V" pin and gnd of L298.

And then temporarily forget about using the arduino.... and just apply appropriate voltages to the L298 control input pins to test the output terminal voltages of the L298. If you get 5V coming out....then connect 1 motor ....and see if it goes. Then connect the other motor to the other output terminals...and test that as well.

But....first thing you need to do is to state the specifications of your motors. And specs of your 5V supply.

Ok, turns out one of the boards were not working when i applied +12V & GND supply to it. I put another one in its place, now its working properly!

My only concern is: they're working with the 5V enable jumper put on, and my motors are getting 10v each, but they're 5v motors, is that fine?

Probably not ok to apply 10V DC to 5V DC motors. Could burn them out. And maybe damage the L298. On the other hand… if pulse width modulation is used… then you can maybe limit the time-averaged DC voltage … so that your motors can still run wirhout getting stressed out. This just means limiting the dc voltage by means if PWM.

My motors are 5V DC ones. (LINK

Hm... You mean i'd need 2 5v supplies?

My new circuit is now like this:

  • 11.1v boards (l298) supply (for both boards, same supply);
  • This supply is conneted to both +12v and GND pins on either boards with 5V enable pin put on;

I just measured the voltage my motors are getting and i got 10V, but they're supposed to work with five. Is that ok? (i mean, it doesn't sound like ok). I'm afraid to cause any further damage removing the enable pin, is that also right?

Oh my gosh... They can operate beteween 3v and 12v. 5v is the nominal voltage for them x.x. So it's working just fine now... Thanks for your patience and time to answer me!!! :smiley:

eojones_:
My motors are 5V DC ones. (LINK

Hm... You mean i'd need 2 5v supplies?

My new circuit is now like this:

  • 11.1v boards (l298) supply (for both boards, same supply);
  • This supply is conneted to both +12v and GND pins on either boards with 5V enable pin put on;

I just measured the voltage my motors are getting and i got 10V, but they're supposed to work with five. Is that ok? (i mean, it doesn't sound like ok). I'm afraid to cause any further damage removing the enable pin, is that also right?

You can use your 11V DC supply. And you can keep the "5V enable jumper" connected. This means no need to connect anything to the "5V" pin of L298. BUT......... there is a DC motor driving method --- based on "PWM" .... where the 'raw' DC signal (in your case....11V or 12V) can be continually switched on and off in a particular pattern (and at a particular frequency) .... so that the time-averaged 'DC' voltage applied to the DC motors stays at 5V or below. This PWM control method is a common DC motor driving method. In your case, you can probably limit your PWM signal to 50 percent duty cycle (or less), and your motors should be ok.