Help - Arduino + 4 DC Motors

Hello all!

I need some help here... I need to control 4 DC motors with Arduino.
I want them all to do the same thing
I'm using 2x L293D ICs with the following schematic (forget the remaining pins):

http://img80.imageshack.us/img80/3039/imagem1tr.png

But when I power the circuit, I hear a noise and the motors don't rotate at full speed (when "told" to). When I phisically disconnect one of the 4 motors, I see that the other 3 rotate faster.
I must admit I have a doubt if that schematic is correct. Perhaps I'm draining too much current from just 1 pin. Particullary the PWM pin.

Can someone help me with this?

What are you using for power in this circuit? Given that you disconnect 1 and the other 3 run faster suggests your power source doesn't have enough current sourcing capability to move all 4 motors.

The PWM pin isn't going to be the one draining current, it'll be pin 8 (Vs, motor supply voltage) that you have to worry about!

--
Need a custom shield? Let us design and build one for you.

I'm using a 12v / 2A power supply.
Not a battery (yet)

Doesn't seem to me that's the problem...

OK...the obvious next question: how much current are the motors demanding?

A 12V 2A power supply isn't enough if each motor wants 2A for itself at 12V.

Though there should definitely be some turning action even at reduced current.

Maybe show us your sketch?

All of the input pin currents of the L293 are on the order of microamps so I can't see any problem with driving the same signal to multiple devices.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

I haven't measured the current that the motors are demanding (I currently am not able to do it, as I'm not near them). When I'm able to measure, I'll post here.

According to motor suplier, 139mA is the current they consume without friction. This is how they are right now.

In fact they turn, but not as much as when I have just 2 motors connected, for example.

My sketch is 2 digitalWrite's (for direction signals) and 1 PWM at 255... Nothing special.

You generally need one chip for a full H-bridge... And I don't like the PWM going to the chip enable...

Sorry, I didn't understand what you mean by "one chip for a full H-bridge"

The PWM on the Enables work well with 1/2 motors...
I've seen some schematics. In particular, Ladyada Motor Shield uses this configuration:


The difference is that they use separate PWM signals for each port.

And I don't like the PWM going to the chip enable

It's not a good way to control the speed as you don't get any flywheel breaking effect so it is only effective on loaded motors not free spinning ones.

Just a point, have you connected the H-bridge direct to the 12V (you should) and not to the 5V going through the on board arduino regulator (you shouldn't)

Arduino is powered by USB

L293D's are powered the following way:
pin 8 - 12V directly from power supply
pin 16 - 5V from Arduino

GROUND shared between them.

Yes that sounds right, just checking. :wink:

So, no thoughts about what is hapenning?

Well given that:-

When I phisically disconnect one of the 4 motors, I see that the other 3 rotate faster.

Points to lack of current capability from the power source but you have ruled that out.
It could be it is not wired up right or that you need some supply decoupling on the controller chips.

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Thanks Grumpy_Mike.
Before I go for it, I must say I've been doing some tests...

I didn't measure the current in each motor, but I did measure the current being drained from the power supply.
Imagine the following situation:
I got both the ICs powered up and receiving the control signals.

For the first test, I connected 2 motors to the first IC. Current around 330mA (OK)

Then I connected 1 motor to the 2nd IC... Current rises up to more than 2A for some moments and it estabilizes at 1,5A... (NOT OK, because the motors slow down)

I tought: Could it be the 2nd control board? So I did the same test, but the other way around...
I connected 2 motors to the 2nd IC... Everything normal (330mA), but when I plug 1 motor to the first IC, they all slow down, and the same thing happens to the current.

i.e., everything ok if I connect 2 motors on the same IC, because I also tested pluging 2 motors on different ICs and it also slows down.

Based on this test, does someone have a clue of what might be happening?

2nd IC... Current rises up to more than 2A for some moments and it estabilizes at 1,5A... (NOT OK, because the motors slow down)

yep - that is killing your supply. have you measured the supply voltage with the slowed down motor, I bet it is low.

So you have either faulty wiring or a faulty controller chip.

Are you sure?
Does that explain the fact that they do work independently, but when I connect motors to both of the ICs, they raise the current?

If the motors work independently on each controller then my guess is something wrong with your wiring. Please take a few minutes and sketch something out for us to refer to.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Ok, I'll make the full schematic to post here... I think that you can help me with this, and I understand that is not easy to help without something to look into.

When I finish, I'll post here, ok?
I hope you can help me.

Here is the full schematic:
http://img299.imageshack.us/img299/1084/imagem4jn.png

PROBE goes to one analog pin, to measure the aproximate battery voltage. (not being done right now)