Control of 4 DC motors with arduino uno

Hi,

I have to control four dc motors whose movement and speed is controlled by two potentiometers, connected to the analog input of the arduino uno/duemilanove board.
I’m using two L293D motor driver ICs, whose enable pins are connected to PWM o/p of uno board to control speed.

Basically it has a tank like operation in which the two motors on the right side of chassis and two on the left.
i have designed a code for different movements of the chassis
eg:- forward, backward, right, left clockwise, anticlockwise …

The problem is the code isn’t giving the desired output when uploaded on arduino uno/duemilanove, with four motors interfaced.
Also i have implemented the setup on proteus. There too the code is not working as desired.

One more thing which i would like to bring to notice is that the same code when used for normal motor operaton worked properely
(ie:- constant speed & the enable pins of the two motor driver ics were connected to 5V instead of the pwm pin).

I am attaching the sketch and the circuit which i have implemented in proteus as well as on the breadboard
Thanks in advance. :slight_smile:

PN:- I am new to arduino platform and have assembled the sketch with the help of Arduino forums and Google. So apologies for any silly mistake.

motorcontrol.zip (63.6 KB)

Simplify your code: Do left- and right side independently. This will allow vehicle follow an arc. - in addition to reducing the volume of your code.

added: It looks like motors are controlled in pairs. One set of outputs is enough pr. pair.

It may also be a problem that two motors are driven from different PWM-signals when the motors are forced to work in the same drive-chain

Thanks very much. Your suggestions worked. I removed the unnecessary connection to motors and used a single enable to run two motors together.

Once again Thanks very much