Battery for motor controller overheating and switch failing

So i'm building my first robot (2wd with ultrasonic sensor). It consists of:

  • breadboard
  • arduino eleven v2.0
  • 2x DC 5V - 10V motors
  • motor controller L298
  • 6V battery pack (4x 1.5V AA) direct to arduino eleven
  • 9V battery direct to motor controller

I had the robot running fine with only one battery running directly into the arduino eleven, the only problem was it didn't have enough power to run the DC motors.
I purchased another battery pack (4x 1.2V AA) and wired it via an on off switch directly to the motor controller. The battery pack started smouldering and melted within 30 seconds of being attached.
I purchased the 9V and wired it up and it soon had the same issue.
Also, the on off switch (which only has two metal parts to soulder onto) seems to allow current flow in the off position but not in the on position.

I'm not sure what i've done wrong but its obviously some sort of electrical problem.

P.S What program are people using to draw arduino schematics?

IMHO a high-voltage old technology H-bridge, like the L298, is unsuitable for low voltage battery powered devices.
According to the datasheet it already has a dropout voltage of 2.55volt (3.3volt max) at 1Amp motor current.
And 3.7volt (5volt max) at 2Amp motor current.
That means your have to use a 12volt battery for a 9volt motor. ~3volt is lost.
Modern mosfet H-bridges don't have those problems.

You seem to have connected the battery to two poles of the switch, shorting the battery.
Remove the black wires from the switch, and connect them together.
Connect only the red wire and the orange wire to the two contacts of the switch.
Leo..

Close up of the power for the motor controller

As Wawa says, you've wired the switch as a dead short across the supply wires.

You need to connect the switch in series with the positive wire, and leave the negative connected directly to the board. ie. Battery positive wired to one switch terminal, and then the other switch terminal has a wire running to the positive terminal on the board.

As you have it, the motor will run fine until you turn the switch on, then stop due to the dead short across the battery. Exactly the symptoms you describe. :wink:

So the negative wire goes straight from the battery to the motor controller and the positive goes to one side of the switch, then a positive out of the otherside of the switch to the positive on the motor controller. Got it thanks!