USB Power supply

Hi Guys. :slight_smile:

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

You have to distinguish between powering the Arduino (the logic unit) and the devices around the Arduino - in your case let's call it the motor unit and a sensor unit.

Arduino, once powered via USB or external power supply through the Japan jacket, is only able to deliver very very limited power through its own pins. Have a look at this link.

So you need to power your logic unit, your motor unit and your sensor unit.
The motors (via the shield) draw way too much current which cannot delivered neither by the Mega pins nor via the USB cable!

You will need a power supply which is able to deliver enough current to get your motors move. If that power unit doesn't have more than 12V, you might be able to use the same power supply to feed your Arduino and sensor.

You have to connect all GND's together, connect all logic (control) I/O of Mega, shield and sensor, but you must not connect the shield's power to any Arduino pin. The shield's Vcc is to be connected directly to the power supply.

There are dozens of circuits/wiring schematics available when you use the search of Google including the search function of this forum.

I'm confused about its curent. How can i know how much current a motor or a servo is drawing, so i could finally say its too much for my arduino board? And how does my motor shield realy works does it regulate voltages for me?

Thanks a lot

In 99% the motors draw way too much current.
If you had read the information coming with the posted link, you would have noticed, that an Arduino pin is only capable of delivering 40mA max!

A 2" PC ventilator already draws 80 -100mA when it's starting (the starting of a DC motor requires ca. 2x the operation current).

To prove that your motor draws more than an Arduino pin can deliver directly, pls post a link to the datasheet of your DC motor and I will have a look into it.

reycreator17:
I'm confused about its curent. How can i know how much current a motor or a servo is drawing, so i could finally say its too much for my arduino board? And how does my motor shield realy works does it regulate voltages for me?

Thanks a lot

You should never be sharing power between digital logic and motors/servos - logic
cheaps require clean power to function, motors put out spikes and typically crow-bar
the supply voltage down on starting (unless the supply can fully provide the stall current).

Hey guys thanks a lot

My operating voltage for each dc motor is 3-6v while for servo is 4.8-7.2v, how much input voltage should i use to the motor shield? Is it okay to have 12v ?, or will it still run using 3v ?

Pls tell us exactly what components you are going to use.
Without that information we will only guessing around and I am not willing to waste my time here. Electronic stuff has to fit together and until now we only have information on headline level.

So again: we need to know exactly the types of motors, L293D shield, sensor with all relevant information about current draw, voltage range etc. -> so datasheets or links will be welcome for EACH device.

http://www.servodatabase.com/servo/towerpro/mg995

http://playground.arduino.cc/Main/AdafruitMotorShield

https://www.arduino.cc/en/Main/ArduinoBoardMega2560

I’ll be using 2 motors 1 servo and 1 sensor.

Ok, thank you - now we can make a current/ power supply calculation.

All information based on datasheet/retail specs of the devices:

Item Voltage Current Draw

  1. Servo 4.8V 100 - 350mA (dependend on datasheet source, we calculate with 350mA)
  2. DC Motor Wheels 3 - 6V 150 - 200mA (you need 2 wheels = 400mA, to be on the safe side)
  3. Ultrasonic Sensor 5.0V 15mA (can be connected directly to an I/O pin of the Mega)
  4. Motorshield L293D 5.0V 50mA (just an estimate for the internal devices of the shield)
  5. Arduino Mega 5.0V 50mA (max. estimate including the supply for the US sensor)

Summary:
Your devices will draw about 900mA at 5V in total.

The Adafruit manual shows on page 38 how to connect an external 9V power unit (battery pack or wall adapter) to the Japan Jack socket. The power supply has to deliver at least 900mA - not to be mixed up with a battery pack's capacity which is in mAh
(i.e. a 9V / 4500mAh pack can deliver current for 5h for your project: 4500mAh/900mA = 5h)

Unfortunately you have apparently got the ancient version 1.x of Adafruit's motorshield. The draw back of that shield is that it powers the servo(s) via the Arduino 5V regulator and thus this regulator might get hot - although if you go with the 9V power pack and only one servo it should work. The newest v2.3 comes with a better motor driver and has the opportunity to use the external power source directly so not heating up the Arduino's regulator.

Coming back to your initial question to power your configuration through USB:
I cannot recommend that. A computer's USB normally comes with 500mA max current. Using an externally powered USB hub might work, but I would go with either a 9V/2000mA wall adapter to power the Mega or with a 9V / 5000mAh battery pack.

http://www.electrodragon.com/product/arduino-official-motor-drive-shield-l293d/

This is actually my motor shield looks like, i just want to clarify, if the 2 terminal EXT_PWR is for the external source? I certainly don't know how to determine if it is v1 or v2.

So if ever it is an external. What voltage should i feed?. Will the 5v coming from the board will not add up to the external source?

This would be the last question for this thread. Thanks a lot :relaxed:

The external supply is for the motor drivers and there is a jumper to allow it to connect to the Arduino
Vin. If you are powering the Arduino via USB disconnect the jumper. Disconnecting the jumper allows
you to use more than 12V supply for the motors too.

The external supply must be 5V or more, and should be present whenever the Arduino is powered up
or the Arduino 5V will back-feed the drivers which isn't good.

Note that DC motors pull a lot more stall current than their running current, and this means its
not uncommon for the motor supply to drop out briefly as the motor starts from rest, unless the supply
and driver can cope.

I figure it out,

I can remove the jumper to have power isolation for my motors. But my shield dont have the two pins right under the servo pins. How am i going to power my servo separately from the board ?

But my shield dont have the two pins right under the servo pins

Sorry, but I don't understand that.

Could you pls describe what you mean by that.

My shield is v1.2. It does not have the male header pin right under the 3 terminal pin for servos

Here is what I’m missing.

Can I use the +5V and GND rail at the lower right?

Unfortunately I can't read what the two pins are meant for.
Are those +5V and GND from Arduino (guess based on your question)?

BTW: Now I know why your shield was sooo cheap:

  1. Ancient version v1.2 AND
  2. a very bad counterfeit of the Adafruit original shield

So on top of that you are using a very old version of this motor shield based on non optimal driver chips your shield is a bad clone. So remote advices are very difficult ...

Okay sir. Very helpful thanks a lot