Problem with L293D (runs my motor "slow")

Hi,
I have a problem with a HBridge L293D.
I’m using a Lego motor and feeding the motor and the HBridge with diferent power supplyes. To feed the motor I’m using an original Lego battery box (to the pin 8 on my HBridge) and to feed the HBridge +5 from Arduino (to the pin 16) . I’ve connected the ground of both power supplies, of course.
With this setup I’m able to control the motor in both directions as well as the speed using PWM. The problem is that I’ve noticed that when I plug the battery box directly to the motor (without HBridge, arduino…) it turns fastly than when I use th HBridge at maximum speed (sending an analogWrite(255) or even a digitalWrite(HIGH) to the enable pin)
Is this behaviour normal? Am I doing something wrong?
Thanks for your help.

Might be due to the voltage drop across the H-bridge.

Vambo is probably correct: the L293D spec sheet says that the voltage drop is about 1.2V in the Sink direction and 1.4V in the Source direction, which means the motor will get about 2.6V less than the batteries. If it's a typical 6V motor, that's pretty significant!

If it's a typical 6V motor, that's pretty significant!

Dang, you must be as old as I am :)

Lego hasn't done 6V motors for decades: the modern ones are 9V.

It's 99% certain that the problem is the voltage drop. Ideally, the motor supply (pin 8 on the L293) should be about 11.5V to overcome that, but it should be okay to use 12V if you don't run it at full speed for hours at a time. Just make sure it's a regulated 12V: many plug-in "wall wart" supplies (especially the cheap ones) are not, and might be supplying 14 or 15V under the relatively light load of a Lego motor.

Ran

Thanks for your replys. I'm happy because I didn't do anything bad (I'm a noob in electronics) but sad because I realize I have a problem... The solution posted by Ran is not good for me because I want to use Lego parts that fit perfectly in my Lego structures... I would have to hack the battery box in order to fit inside some kind of rechargeable battery...

Finally I have another question. The Lego battery box has a typical small led that lights when you turn the switch on. I've noticed that if I turn the switch off and the hbridge is receiving power from the Arduino, the led in the battery box shines. Do I have to worry about that? Is it dangerous for the batteries or any component? If I place a diode in the ground wire of the battery box this don't happens, but I have an additional voltage drop...

I want to use Lego parts that fit perfectly in my Lego structures

Now he tells us he's a Lego purist ;)

A couple of alternatives for you: build a battery container out of Lego, or replace the L293D.

If you check ebay or Bricklink, you can probably find something like a dead RCX or Scout that you can modify into a Lithium pack holder while maintaining the aesthetics.

There are motor driver chips out there that use MOSFETs, instead of the bipolar transistors in the L293D, and have a much lower voltage loss. I don't have any experience with them, myself, but I know there are other forum members who have. Sparkfun and Pololu sell motor controller boards based on some of them.

Ran

Well, if I were a Lego purist, I wouldn't use Arduino... :) I think I'm going to modify my current lego battery box to fit a lithium battery as you suggested. I don't want to buy a motor contoller board; a L293D is cheaper!! But I'll investigate this drivers based on MOSFET's to see if I can make something interesting... Thanks!