I know all the motors work. I've directly tested them by connecting them to the battery, one at a time. I've even connected all of them to the shield (while they are not in the robot chassis), and they all run as they are programmed to do: fwd, back, turn left, turn right, etc.
However, when I place the motors in the chassis, and then connect the battery (7.5V, 5x 1.5AA or even 9V, using 6x 1.5AA or a 9V battery), not all of the motors run. Some stutter, some spin for less than the req. time, but regardless, it is not fluid. Seems to short circuit itself.
However, when I replace the battery with a USB cable, and power everything off the computer (using the exact same code), the robot runs perfectly (with less power of course).
I should note that I've replaced all 4 motors with different ones, a different battery, and even resoldered the entire thing, and came right back to the same issue. I'm using the Arduino Leonard as the main board.
So what I've determined is that the robot runs just fine on AC power (the USB cable) but not so with the batteries (DC power). Any ideas what's doing on?
You see that jumper there between the cap and the ext pwr connector ?
DID YOU REMOVE IT ?
(That jumper connects the arduino +5V to the L293 VCC1. If you have ext motor power connected to the motor shield ext.pwr, that jumper allow the L293 to run off arduino +5V (for VCC1) If you want to run without the USB connection you need to also plug ext pwr into arduino ext dc pwr jack. Without the jumper and without ext dc power into arduino, you need the USB to provide 5V.
Well as I said, all of the motors DO work properly when the motors are not yet placed in the robot's chassis. That is, they are just on the table connected to the motor shield & Leonard. I've never touched the jumper - it's always been on the motor shield.
The problem occurs when I put the motors into the chassis. That's it. It's like putting them in there makes everything begin to malfunction off of the same DC power that I used when they were outside of it, but when I use USB, it all works fine.
If I didn't know any better, I'd say that placing the motors in the chassis short circuits them, but the fact that they will run on AC power, seems to negate this.
You need a battery pack capable of delivering the current required by the motors. Ordinary AA cells normally won't cut it, except (possibly) when brand new.
The stall current for the motors used on that platform is 2.8 amperes, TT Geared Motor with Back Shaft (180rpm 6v L Shape) - DFRobot and each motor will briefly draw that when it starts up. I'm surprised that it works on USB, as the current draw is far higher than allowed. You risk damaging the computer providing the power.
I've never touched the jumper - it's always been on the motor shield.
That's what I meant.
If you want to run without the USB connection you need to also plug ext pwr into arduino ext dc pwr jack. Without the jumper and without ext dc power into arduino, you need the USB to provide 5V.
The little jumper on the motor shield connects the USB +5V to the Motor shield +5V. If you don't have the USB connected the L293 has only one other source for that +5V and that is the arduino onboard regulator (which is a different +5V source than the USB) which receives power from the arduino ext. dc power jack.
Option A: USB plugged in and jumper installed.
Option B USB DISCONNECTED, jumper installed, Motor ext. pwr connected (greater than 7Vdc)
Option C USB DISCONNECTED, jumper installed, arduino ext. dc power jack supplied by 9V dc.
Option D USB DISCONNECTED, jumper NOT installed,Motor ext. pwr connected (greater than 7Vdc) AND arduino ext. dc power jack supplied by 9V dc.
If you remove the jumper and only supply pwr to the motor shield ext pwr terminals, you will see there is no voltage on the Arduino Vin, hence no +5V to either the arduino or the L293 VCC1 (pin-16). The jumper connects the ext motor pwr terminals to the arduino Vin allowing you to run everything off that power , if and only if it is high enough voltage to supply the arduino +5V and the L298 +5V. If the jumper is removed and you supply motor power and then supply power to the arduino ext dc power jack , you will see that the ext dc power jack supplies the arduino Vin and hence the L298 VCC1.
Those are your options.
Hope that's not too hard to follow.
The problem occurs when I put the motors into the chassis. That's it. It's like putting them in there makes everything begin to malfunction off of the same DC power that I used when they were outside of it, but when I use USB, it all works fine.
However, when I place the motors in the chassis, and then connect the battery (7.5V, 5x 1.5AA or even 9V, using 6x 1.5AA or a 9V battery), not all of the motors run. Some stutter, some spin for less than the req. time, but regardless, it is not fluid. Seems to short circuit itself.
You need to clarify this statement . How many dc power sources do you have plugged in when it is in the chassis and where ?
Ok, I think I'm getting closer to an answer here. What is the "L" on the Leonardo mean? I ask because I have noticed the following:
Two 9V batteries were used. 1 was plugged into the ext_pwr slot on the motor shield (jumper on), and 1 was plugged into the Leonardo board (using a barrel plug).
At first, nothing happened, and it was stuttering, as usual. But then I noticed the "L" was blinking on the Leonardo. As soon it stopped blinking, the wheels began to move as programmed. And it did so for about 95% of the time fluidly, until the "L" started blinking again, and everything basically stopped. Then, the "L" went off, and all functioning returned.
I've tried this with various options, using the two 9V batteries, or just a 7.5V (5 AA) plugged into ext_pwr jack (but results aren't as good, as 1 tire will sometimes spin wildly fast).
When I only use the USB, the "L" blinks at the beginning, and then never does again, as the program runs fluidly.
So it seems that something is happening making the "L" light up at the beginning using the 9V batteries, and then again after maybe 2 minutes in, which stops the wheels from rotating. Then, after the "L" disappears, all is functioning again.
Pin 13 flashes some number (never counted them) on reset but the blink sequences is like blip,blip,blip,blip,blip. in about 1 second.
Maybe it's reseting because the power is dropping. In case you haven't figured it out, the purpose of the jumper is if your motors need 12V and arduino dc ext pwr jack is best run on 7 to 9V, you can remove the jumper, run the arduino on 9v walwart or battery pack and run the motors on 12V.
Well, great news. I fixed up some code on the remote controller part which I built, and then on the robot itself. I hooked up a 9V (1.5V x 6) battery pack to the ext pwr jack on the motor shield, with the jumper on. Any it works! Not sure what was going on when I was using hte power suplly within the robot's chassis, but when I used an independent one external to it, it works.
I should say that I originally tried it with a 9V battery also plugged into the Leonardo's barrel jack while the (1.5V x 6) battery pack was plugged into the ext pwr, and saw no performance difference at all. In fact, I then removed the jumper, and again, no difference in performance. So, that's when I tried only leaving the (1.5V x 6) battery pack plugged in, with the barrel jack on, and it works!
Thanks everyone for your help! Had to just keep working at it, and it works!