Power issues with 4 geared DC motors and L298Ns?

Context: I have 4 BO motors that I am trying to power but for the life of me, it is not working. Frequently one or two motors will stop working and sometimes all four will work. It is incredibly unreliable and I have just spend the last 3 days (2.5 hrs per day) trying to get it to work. I am not sure why this happening, but I have four primary questions:
1.) is my wiring an issue?
2.) are the 9v batteries enough?
3.) (this is a variant of question 1) should the GND of my arduino mega be connected to the GND of the two L298Ns
4.) Should I remove the female jumper cable for the power regulator here? (On the L298N).
And yes, I know I'm using three 9V batteries but that is for some reason the only way to supply enough current to get the motors to work (idk why).
I have attached an image of the wiring: (Also all the motors/batteries etc... used in the wiring are the same equipment I am using to build the robot)

FYI: I have only added the power wiring in this image. I do of course know that I have to connect jumper cables between the mega and L298N to program it.

Your help and expertise is much appreciated.

Definitely not. Those batteries are intended for low power applications like smoke alarms.

A 6xAA battery pack should supply enough current for two motors, and might even work with four.

NEVER connect batteries in parallel. They could leak toxic fumes and liquids, become hot and explode.
Uno 5V is a voltage output NOT an input.

Hi, @jermito2456

Do you have a DMM? Digital MultiMeter?

Can you post some images of your project?
So we can see your component layout.

A copy of your code will help as well.

Yes...

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

So these will work?

Yes.

I thought connecting batteries in parallel was a common thing to do, like it introduced in circuits so i figured it would be fine. And for the last part, I'm using the 5v port from the arduino to power the logic circuits of the l298n.

Hi Tom,

I have unfortunately disassembled the project in frustration but the diagram is accurate to the T. I do have DMM with me. And no code because that would require pinout connections and I am only asking about the wiring. But if it is important, this is the code:

void setup() {
  // put your setup code here, to run once:

  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  pinMode(14, OUTPUT);
  pinMode(15, OUTPUT);
  pinMode(16, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(2, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(6, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(10, LOW);
  digitalWrite(14, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, LOW);
  digitalWrite(11, HIGH);
  digitalWrite(12, LOW);
  digitalWrite(13, HIGH);

}

Do you mean using a hammer?

When you feel like rebuilding it, here is some advice.

Leave out those L298. They are a very old design and perform poorly, especially at lower voltages.

The reason the modules have those honking-great heatsinks on them is because they are so inefficient, and a large proportion of the battery power gets wasted as heat. With 9V input and both motors running, the motors may receive as little as 6V, the other 3V being lost, or "dropped" by the L298.

So why are L298 modules like these so commonly sold for Arduino projects? Because there is a never-ending supply of inexperienced beginners to buy them.

If you choose your motor drivers wisely, you should be able to use 4x AA packs instead of 6x.

TB6612FNG driver modules will probably be a good choice, but post the specs of your motors for confirmation. These will drop only a fraction of a volt, so your motors get almost all the power from the batteries and the drivers won't get hot and may not need heatsinks at all, or only small ones.

No it is not!

I'm using the 5v port from the arduino to power the logic circuits of the l298n.

If you power the L298 with 6AA then that is not necessary

It's more of a cost-based reason than anything else really.

What about this motor driver? It's an L293D and although it says it's a shield, from the pictures it looks like it can be used separately as well: https://robu.in/product/mini-4-channel-motor-drive-shield-expansion-board-l293d-module-high-voltage-current-module-for-arduino-uno-mega-2560-mega2560/

I'd really like your opinion on it.

And these are the motor specs:
Operating Voltage: 3V~6V DC
Gear Ratio 1:48
No-load speed(5V): about 208RPM
Rated Torque: 0.8 Kg.cm @ 5V
Load current: 170 mA (when it is 4.5V)
Size: 70 x 23 x 18 mm
Weight: 28g
Shaft Length: 10 mm
Shaft Type: 6 mm, Double-D

So, if I connect a 6AA batteries to the l298N then I have no need for the 5v port? Would 6 AA batteries be enough for the motors and logic circuits?

Equally old and inefficient as L298, sorry.

I tried it with 4 and the motors are not moving unfortunately.

Correct. Leave the jumper on and the L298 will generate it's own 5V

Would 6 AA batteries be enough for the motors and logic circuits?

There will be enough voltage and current but how long the batteries last will depend on how much you run the motors.

It is, and is very typical in laptop battery packs, electric vehicles and robots, for example.

That advice is applicable in cases when batteries are very mismatched in capacity, state of charge or age.

Check for a wiring error, or dead batteries.




This is the wiring and the motors are not moving.

Code is:

void setup() {
  // put your setup code here, to run once:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(2, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
}