I have been using one of these cheap eBay modules to drive small 6V motors, in bidirectional mode. The motors draw about 300mA under load, 400mA stalled.
To start, I only had one motor fitted and all seemed to work well. I then added more load to the single motor; it was clearly struggling so I added a further motor and shared the load; I had the two motors connected to the M1 and M2 outputs. The motors still struggled, but what was odd was that after a few seconds (even with no load) they reduced speed to almost nothing.
On checking the voltage output , sure enough it started out at around 4.5V but then dropped after a few seconds to less than 2V. Same with both outputs - and the chip became very warm so I turned it off. This could be repeated.
I then realised that I'd get better results by using the 'other' chip on the board (i.e. M3,M4) so rewired it and changed the code accordingly. Now, with the same PWM control levels, the M1 motor output gives about half the voltage as the M3 output. (At least it appears to stay at that level rather than fading away.) It's not to to with the motors, I swapped them around and get the same results.
I understand that these L293D moudles are an old design and not great, and there are better units to be had (although no stock available anywhere at present). I seem to have permanantly damaged one of the chips on the board , even though I've never knowlingly drawn more than 400mA from each of its two outputs. I'm powering the unit with a 12V LiIon rechargeable battery and the level on that stays perfect throughout, so it's not a power supply problem.
I can order another of these boards, but wondered if anyone had any similar experience and what the 'real' ratings of these are.
I don't think my code is relevant; it's too big to fit all here but I'm 100% certain that all motors are being driven the same: I'm using the motors() function exclusively to control the motors:
// ---------------------------------
// motor
//
// Select the motor (1-4), the command,
// and the speed (0-255).
// The commands are: FORWARD, BACKWARD, BRAKE, RELEASE.
//
void motor(int nMotor, int command, int speed)
{
int motorA, motorB;
if (nMotor >= 1 && nMotor <= 4)
{
switch (nMotor)
{
case 1:
motorA = MOTOR1_A;
motorB = MOTOR1_B;
break;
case 2:
motorA = MOTOR2_A;
motorB = MOTOR2_B;
break;
case 3:
motorA = MOTOR3_A;
motorB = MOTOR3_B;
break;
case 4:
motorA = MOTOR4_A;
motorB = MOTOR4_B;
break;
default:
break;
}
switch (command)
{
case FORWARD:
motor_output (motorA, HIGH, speed);
motor_output (motorB, LOW, -1); // -1: no PWM set
break;
case BACKWARD:
motor_output (motorA, LOW, speed);
motor_output (motorB, HIGH, -1); // -1: no PWM set
break;
case BRAKE:
// The AdaFruit library didn't implement a brake.
// The L293D motor driver ic doesn't have a good
// brake anyway.
// It uses transistors inside, and not mosfets.
// Some use a software break, by using a short
// reverse voltage.
// This brake will try to brake, by enabling
// the output and by pulling both outputs to ground.
// But it isn't a good break.
motor_output (motorA, LOW, 255); // 255: fully on.
motor_output (motorB, LOW, -1); // -1: no PWM set
break;
case RELEASE:
motor_output (motorA, LOW, 0); // 0: output floating.
motor_output (motorB, LOW, -1); // -1: no PWM set
break;
default:
break;
}
}
}
// drive all four outputs the same
void motors(int command, int speed) {
motor(1,command,speed);
motor(2,command,speed);
motor(3,command,speed);
motor(4,command,speed);
}