Motor shield driver not providing power

Hi!

I'm building an omniwheel robot platform.
The components are:

Arduino Uno
Wireshare Motor Control Shield (https://www.waveshare.com/wiki/Motor_Control_Shield)
12V 1.2A lead acid battery
Four 1:48 6V DC Motors

I have connected the motors to the shield. Using a simple test code:

int motor1_dir1 = 12;
int motor1_dir2 = 13;
int motor1_pwm  = 11;

int motor2_dir1 = 8;
int motor2_dir2 = 7;
int motor2_pwm  = 10;

int motor3_dir1 = 5;
int motor3_dir2 = 4;
int motor3_pwm  = 9;

int motor4_dir1 = 3;
int motor4_dir2 = 2;
int motor4_pwm  = 6;


void setup()
{
    pinMode(motor1_dir1,OUTPUT);
    pinMode(motor1_dir2,OUTPUT);
    pinMode(motor1_pwm,OUTPUT);
    
    pinMode(motor2_dir1,OUTPUT);
    pinMode(motor2_dir2,OUTPUT);
    pinMode(motor2_pwm,OUTPUT);
    
    pinMode(motor3_dir1,OUTPUT);
    pinMode(motor3_dir2,OUTPUT);
    pinMode(motor3_pwm,OUTPUT);
    
    pinMode(motor4_dir1,OUTPUT);
    pinMode(motor4_dir2,OUTPUT);
    pinMode(motor4_pwm,OUTPUT);
    
    digitalWrite(motor1_dir1,0);
    digitalWrite(motor1_dir2,1);
    digitalWrite(motor1_pwm,1);
    
    digitalWrite(motor2_dir1,0);
    digitalWrite(motor2_dir2,1);
    digitalWrite(motor2_pwm,1);
  
    digitalWrite(motor3_dir1,0);
    digitalWrite(motor3_dir2,1);
    digitalWrite(motor3_pwm,1);
  
    digitalWrite(motor4_dir1,0);
    digitalWrite(motor4_dir2,1);
    digitalWrite(motor4_pwm,1);
}

void motor_control(int motor_number, int speed, bool fwd){
  if (motor_number == 1){
    if (fwd == true){
      digitalWrite(motor1_dir1,0);
      digitalWrite(motor1_dir2,1);
    } else {
      digitalWrite(motor1_dir1,1);
      digitalWrite(motor1_dir2,0);
    }
    analogWrite(motor1_pwm, speed);
  }
  if (motor_number == 2){
    if (fwd == true){
      digitalWrite(motor2_dir1,0);
      digitalWrite(motor2_dir2,1);
    } else {
      digitalWrite(motor2_dir1,1);
      digitalWrite(motor2_dir2,0);
    }
    analogWrite(motor2_pwm, speed);
  }
  if (motor_number == 3){
    if (fwd == true){
      digitalWrite(motor3_dir1,0);
      digitalWrite(motor3_dir2,1);
    } else {
      digitalWrite(motor3_dir1,1);
      digitalWrite(motor3_dir2,0);
    }
    analogWrite(motor3_pwm, speed);
  }
  if (motor_number == 4){
    if (fwd == true){
      digitalWrite(motor4_dir1,0);
      digitalWrite(motor4_dir2,1);
    } else {
      digitalWrite(motor4_dir1,1);
      digitalWrite(motor4_dir2,0);
    }
    analogWrite(motor4_pwm, speed);
  }
}

void motor_fwd(int motor_number, int speed){
  motor_control(motor_number, speed, true);
}

void robot_fwd(){
  motor_fwd(1, 255);
  motor_fwd(2, 255);
  motor_fwd(3, 255);
  motor_fwd(4, 255);
}

void loop(){
  robot_fwd();
  delay(500);
}

The code is dirty but should do the trick. The problem is the wheels are starting and running for some time. They are getting around 5V (used the multimeter for measurement). Suddenly one or several motors stop turning and if I measure the input voltage I see a zero value there. Sometimes it starts to turn after that, sometimes it stops until I remove the battery and then plug it back.

Any help appreciated. I'm new to Arduino and electronics stuff maybe I'm just missing something?
Kind of odd that it works like this. I'm almost ready to buy a new shield and Arduino but not really sure this will help.

Yes, a wiring diagram or schematic.

1 Like

If this would help

Please post a link to the motors.

That motor driver uses the ancient, extremely inefficient L293D chips, which can handle only very small toy motors (about 700 mA per channel), and will waste about 1/3 of the battery power as heat.

Suddenly one or several motors stop turning

That is usually due to the motor driver chip overheating and shutting down.

Do yourself a favor and buy a modern motor driver. Pololu has an excellent selection.

1 Like

It helps, but it is not sufficient in order to know how it is wired. Imagine, if you will, if you had opened the assembly manual and all that was there, was this photo.

Would it be enough?

Don't have the link, but here are the specs

Specification for RKP-GMP048R1-90D gearmotor:
Supply voltage: 3 - 12 Volts
Rated voltage: 6 Volts
Gear ratio: 1:48
No load speed: Approximately 200 rpm (6V)
No load current: not less than 70mA (6V)
Current under load: not less than 200mA (6V)
Torque: 0.8kgf*cm (6V)
Shaft diameter for wheel fit: 5.4 mm.
Geared motor dimensions without protruding shafts: 64.2 x 22.3 x 18.7 mm
Weight: 32 grams
Gear Material: Plastic

Did you try to Google the part number?

You need to know the stall current of the motors. You can estimate it by measuring the winding resistance with your multimeter on the resistance range. Disconnect the motor from the driver and measure the resistance while turning the shaft very slowly.

Take the lowest reading in Ohms and divide that into 12V to get the stall current. It is probably well over 1 Ampere, which is too high for the driver.

But you already have the answer to your problem.

1 Like

Yep, looks like I need a modern shield. Will try thx.

If I touch the L239D it is warm so probably the case. On the manufacturer site they say it is okay...

Not sure if you really want to help :slight_smile:

You can click on my avatar and see my track record.

Yes, @anon57585045 does. He is asking you to provide useful information, and suggesting that if you can't, to do an internet search for better information. You have the part in hand, and presumably know where you bought it.

From the forum guidelines:

We need to know exactly what hardware you have. We need to know what Arduino board (or other brand, such as ESP32) you are using and exactly what other hardware you are connecting it to. The more details we have, the easier it is to help.

If you are using something that is a non-Arduino product then it helps to have a link to its technical data sheet or a link to where you bought it.

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966

Not much. You want help and we need Your help providing documentation to post anything better then harassments.

K, just not sure if wiring is useful here as there just a shield that is installed on top of the Arduino. The full spec of the shield is on the site that I mentioned in the post. The specs of the motors are also found. Just not a link to them. BTW it is a simple yellow plastic toy motor. Got it in a robot kit. I'm not sure what other info.

Thank you both (@jremington and @anon57585045) I suppose :slight_smile:

Thx haven't seen'em so maybe you should've send me this firsthand so I could provide the info:)
Will know, thx

Not sure where I posted harasments... But okay didn't mean it, sorry.

Know that we ask You for the help we need to understand Your build and the trouble. Helpers usually don't have magic crystal balls. I've exercised reading a crystal ball and it's really difficult even for much easier tasks.
Your mother might know Your deepest needs bit we don't.

I already posted the link. It's also permanently attached to the top of the thread list.

And I already said "thanks" for this.

Then, why are you asking for it again? I'm just a little confused.

Not asking, just saying that instead of asking every single thingy you could've sent me the link here:

No offence, really, but it would've been easier to understand each other:)

BTW I really don't know what Arduino Uno I have cause all that is written on top of it is capital UNO. So just provided all I had :smile: