USB Power supply

Hi Guys. :)

I'm really new to Arduino, and I'm planning to make an obstacle avoidance robot. So I'm using Arduino Mega 2560, 2 X DC motors (They yellow colored), 1 X Tower pro mg996r (Violet Sticker on it), L293D motor shield, and A sonar sensor.

I'm really confused whether I should put external source to the Arduino itself or to the Motor Shield or both. So I'm planning to buy a really long usb cable and plug everything. Is it a good idea?

I think you should supply power to both, mainly because its takes much power.

Also check that any traces or jumpers on the motor board are cut or jumpered correctly as is often the case with many.

The servo might draw as much as 1000 mA and each of the drive motors are similar. The Arduino running on USB power has only bout 450 mA to spare! If you try to power motors from the Arduino's 5V pin you are likely to cause a power glitch that resets the Arduino.

Typically you would power the servo and drive motors with a four-cell (6V) AA battery holder. You can also connect that to to power jack on the Arduino (or the Vin pin) but be warned that the voltage regulator might not be able to give you a full 5V wen it has less than 7V on the input.