Help with driving a couple of motors

Hi there. I have one of those BTS 7960 modules (https://www.handsontec.com/dataspecs/module/BTS7960%20Motor%20Driver.pdf) and am having some issues with the power output of it. It's rated for 43A, etc...

I'm using an arduino leonardo and am wanting to drive a pair of 12v DC motors (RS 550) connected in parallel for a kids power wheels that I have. I am using an 18v battery to drive them. I know... before you ask - it's over driving them but for now I plan to drive them at 50% duty cycle.

So the issue I'm having is that when I hook it all up and set PWM to 100%, it's really weak and not drawing nearly enough power. Eg - the car barely goes up a small hill, and it's only drawing about 4 amp (checked with multimeter).

If I plug the motors directly to the battery, bypassing the driver and arduino, it's super powerful. I can't stop it at all with force. But when it's connected through the driver, it's way too weak. So that indicates it's not a battery or motor issue. I'm using thick cables (12awg) between the motors, battery and driver. I have hooked it up exactly as shown in the document I linked above (minus the pot - for testing I'm just setting PWM to 100%). The arduino is powered by just the standard 9v battery. Voltage is 18v across the driver terminals. I've got four of these drivers as spares and they all do the same thing. I've seen other people use these exact same drivers for their power wheels and I'm pretty sure they wouldn't be as weak as this, so I must be doing something wrong.

Here is my super basic code:

int pwmForwardsPin = 5;
int pwmBackwardsPin = 6;

void setup() {

    pinMode(pwmForwardsPin, OUTPUT);
    Serial.begin(9600);
}

void loop()
{
 
        analogWrite(pwmForwardsPin, 255);   // 255 = 100% duty cycle
        analogWrite(pwmBackwardsPin, 0);
}

and that's it. Pretty simple really. It does make a whinning noise but I'm pretty sure that's to do with the timers and because it's being driven at a lower frequency, but I don't think that's relevant here. I think increasing the frequency will remove the noise but if anything make it even slightly less powerful.

Any ideas? I could have sworn it was working at some stage... when I first did this, I burnt the motors out which indicated it worked fine. Since then though I'm not having much luck. I've changed motors/battery/arduino/drivers - nothing has made a difference. Thanks for any advice.

the car barely goes up a small hill, and it's only drawing about 4 amp (checked with multimeter).

Give us the voltages on the battery in operation and on the motors too.

Also, check that...
analogWriteResolution() - Arduino Reference)

Try checking the following statements from Arduino Reference.

You do not need to call pinMode() to set the pin as an output before calling analogWrite().

The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs.

Although the second statement should have the opposite effect.

How is the wiring done? I hope there is no breadboard involved for the motor power circuit.

Those details are in my original post... there is 18v on the output of the driver to the motors.

That analogWriteResolution is not applicable to Leonardos.

I have tried pins 9 and 10 as well but didn't seem to make a difference.

Nope no breadboard at all in between. The exact wiring is:

Positive of two motors => motor positive in on the driver (12awg wire)
Negative of two motors => motor negative in on the driver (12awg wire)
Battery positive => battery positive in on the driver (12awg wire)
Battery negative => battery negative in on the driver (12awg wire)
Arduino ground => ground on driver
Arduino 5v => split in three wires to go to driver VCC/L_EN/R_EN
Arduion pins 5 & 6 => driver LPWM and RPWM

and that's it. The only thing I find strange is that if I disconnect for example the R_EN pin on the driver, then RPWM doesn't work (as expected) but neither does LPWM. I thought that's a bit strange as I would have thought the R_EN would only affect RPWM, but it seems to affect both.

Please post it as a wiring. The ink level is very low in my skull.

??????

No worries, here is the diagram:

Google Photos

Not sure what that second line is doing there. I've removed that now.

Thanks.
There must be a cable between controller and motor driver connecting their GNDs.
I don't se any in the wiring.
The rest looks good.

Bottom right in the picture.

Yes, there it is. The picture is cut off in forum but expanding it in Google it shows up.
The second line is +5 volt, likely needed!
So, back on square one. I'll check again when comung home to the Pc.

Sorry ignore that post of mine. Didn't read your last comment (am on mobile).

You have not declared pwmBackwardsPin as output, in setup.
Also, use the link You supplied! Get down some 5-6 pages! The driver pins are explained and even code examples are given.

Hmmm yes you are right... actually I'm not defining pwmBackwardsPin as output, only because I was just getting a minimal code project happening, so I was only using pwmForwardsPin for now. But I suppose that could cause issues, as I'm setting pwmBackwardsPin to 0 however that's probably having no effect, as pwmBackwardsPin is not defined as OUTPUT.

Hopefully that's all the issue is... I'll test it tomorrow morning when I wake up. Thanks for you replies.

Let's see if that changes anything. Have You rechecked the use of the driver pins, that enables are active etc?

Hi,
@apersonoverhere
Circuit;

Can you please post a picture of your project so we can see your component layout?

Have you got a DMM?

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

Hi,
Because you have not defined pwmBackwardsPin as anything, it is an open circuit pin, it does not output a 0 or LOW or 1 or HIGH.
You need to define it.

pinMode(pwmBackwardsPin, OUTPUT);
~~~

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