Motor draws current.

Arduino provides a current of 40mA and 5v on each digital pin if I am not wrong. Then if we directly connect a motor to arduino, while will the Atmega burn up. A device can not draw more current than what is provided to it. In practical world, we cannot take more water from one end of a pipe than the water given by domestic water pump to water the plants. I think I am missing on some concepts. But again....
A motor shield takes power from the arduino Digital pins only. Then how can it run motors. Or if it takes power from the power grid in arduino, does it provide more current than the digital pins.

Arduino provides a current of 40mA and 5v on each digital pin if I am not wrong

You are, of course, very wrong.
Have another look at the datasheet.

A motor shield (or not necessarily a shield, but a standalone chip like a 298, or a breakout like a Pololu 2130) is supplied with external power. That might still be 5V but with a higher current capacity, or 24V or whatever.

The driver chip is controlled by the Arduino i/o pins, and that switches the power to the motor from the external power.

This pic shows how the Pololu 2130 works for example. Only connection to the Arduino is i/o and ground.

2130 wiring.GIF

(Source)

AWOL please give me a complete answer and not an incomplete one. And manor_royal, I am actually a beginner to the world of arduino and I don't have a motor shield either, thank you.

AWOL please give me a complete answer and not an incomplete one

Why?
You're as capable as I am of downloading and reading the datasheet or even referring to the product information page at arduino.cc, and if you invest some time and effort in the endeavour, you're more likely to retain the information.

(I did, in fact, provide a complete answer - you asked if you were not wrong, and I replied that you are)

Your understanding of current is very wrong. This is what happens when you use a hammer to make the water analogy fit electronics.

When a device (motor) sinks more power than a supply can source (digital pins), it acts as a short circuit unless some means of controlling the current is put in the circuit.

I know that tinman13kup :frowning: . But your answer didn't improve my concept. How can drawing more current act as short circuit? Can you provide some link where I can study about these.

A device can not draw more current than what is provided to it.

This question is not correctly answered. Please help me understand these concepts.

Surely I answered you in #2. A motor is never powered by an i/o pin, or for that matter seldom from the 5V pin, but the i/o controls the current to the motor from another source which is capable of supplying the necessary current at the right voltage.

40 mA is the absolute maximim.

In operation you should limit current draw to approx half this.
At least until you have a better understanding of electronics and thermal considerations.

Even if you have a motor which will run at 20 mA at startup the stall current will be several times this which will destroy the IC.

subha26:
Arduino provides a current of 40mA and 5v on each digital pin if I am not wrong. Then if we directly connect a motor to arduino, while will the Atmega burn up. A device can not draw more current than what is provided to it. In practical world, we cannot take more water from one end of a pipe than the water given by domestic water pump to water the plants. I think I am missing on some concepts. But again....
A motor shield takes power from the arduino Digital pins only. Then how can it run motors. Or if it takes power from the power grid in arduino, does it provide more current than the digital pins.

Firstly the Arduino pins can provide a lot more than 40mA, but damage themselves if this happens,
the datasheet says the absolute maximum rating for each pin is 40mA, which in practice means you'd
not exceed 25mA to 30mA or so for a reliable system. There are also limits on the total currents from
groups of pins to watch out for.

Some passive devices cannot draw more current or experience more voltage than what is provided to it,
true, but there are passive devices like inductors that don't obey that constraint (an inductive load can
generate high voltages it the current to it is interrupted).

No shield should be taking power from digital pins - power comes from the power rails, signals are
provided via digital pins. The driver chip on a motor shield switches the heavy currents to the motor
based on the control signals from the Arduino - ie it is an amplifier.

subha26:
Please help me understand these concepts.

Do you understand ohms law ?

Arduino provides a current of 40mA and 5v on each digital pin if I am not wrong.

You are wrong. An Arduino pin should not be wired in such a way that the current from it exceeds 40mA. This is very different from saying an Arduino pin can only provide 40mA, it can provide a lot more if you let it but you should not let it.

subha26:
I know that tinman13kup :frowning: . But your answer didn't improve my concept. How can drawing more current act as short circuit? Can you provide some link where I can study about these.This question is not correctly answered. Please help me understand these concepts.

Electronics theory is more than a 5 minute tutorial. Several of the people on this forum went to college for years, and have decades of hands on experience in electronics. What you ask is very basic stuff, yet you don't seem willing to make any effort on your part to learn. Telling others to just give you the answers you seek will result in answers you don't want to hear.

subha26:
Arduino provides a current of 40mA and 5v on each digital pin if I am not wrong. Then if we directly connect a motor to arduino, while will the Atmega burn up. A device can not draw more current than what is provided to it. In practical world, we cannot take more water from one end of a pipe than the water given by domestic water pump to water the plants. I think I am missing on some concepts. But again....
A motor shield takes power from the arduino Digital pins only. Then how can it run motors. Or if it takes power from the power grid in arduino, does it provide more current than the digital pins.

Another attempt to explain

From a theoretical point, a microcontroller can provide infinite current; meaning of you power it with e.g. a 5V 10A power supply it can supply 10A (minus a little bit) to a single pin. So if you use a motor that draws 10A, the microcontroller will deliver that 10A.

However the internals of a microcontroller are not designed to handle that current and hence the internal electronics will get damaged.

What the datasheet of e.g. a 328 microcontroller states is that 40mA is the safe maximum to sink or source from a pin without without damaging the internal electronics.

An analogy would be an extension lead in your house. Let's assume that you made one up yourself from a telephone wire (don't try it). You use it for a light with a small bulb (e.g. 5W energy saver) and it will work. If you touch the extension lead it might feel slightly warm. Next you use it for a 10A heater; it will get extremely hot and isolation will melt causing a short or the copper cores might melt causing a discontinuity. The same thing will happen in the microcontroller.

Again:
do not try the analogy

Thanks sterretje. Your answer made me understand this thing. And sorry if my words had hurt any body. I am only 14 years old, and I have just started with these things.

subha26:
I have just started with these things.

And welcome to a life-long hobby.

If you dig around you'll find lots of way to control a motor from an Arduino or similar controller. The trick is to use the digital signal to merely control the motor current, not provide it.

This example is typical; there are other transistors which would do the same or better job, but that's a detail.

Thanks manor_royal.

What the datasheet of e.g. a 328 microcontroller states is that 40mA is the safe maximum to sink or source from a pin without without damaging the internal electronics.

I would beg to differ. A current of 40mA is not the safe maximum but a stress rating. The data sheet says:-

Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

subha26:
. And sorry if my words had hurt any body. I am only 14 years old, and I have just started with these things.

Not a problem here.
I suggest that you start by getting use to the basics of current and voltage first though, try to understand ohms law first.
There are lots of references on the internet these days.

You do not have to hijack a pit pony to go to the library like we did in the old days . :slight_smile:

Boardburner2:
go to the library like we did in the old days . :slight_smile:

A real library, with stuff on paper, not this new-fangled ether nonsense.