Go Down

Topic: How much current can I drain to an Uno digital I/O pin? (Read 2131 times) previous topic - next topic

168gr


I'm powering a tiny DC motor with an external power supply. I control the speed of it with PWM and am draining into digital I/O pin 11 on an Arduino Uno.

Using PWM I vary the voltage between about 1.3 and 2.5 V, and control the speed of the tiny motor. Project works fine, exactly as expected.

I've measured the current draw with this tiny motor simply wired to a battery, and it's about 30 mA.

I thought I'd swap the tiny DC motor out for one that is slightly larger. This one draws about 150 mA (again measured with it wired directly to a battery).

But when I wire it into the actual project, the motor doesn't turn, and the Arduino makes a non-reassuring humming sound, so I turned it off.

Is 150 mA (again, from an external power supply) too much to drain into an I/O pin?

Robin2

The absolute MAX for an I/O pin is 40mA but 20mA would be more sensible. Read the Atmel datasheet.

Do not try to power any motor from an I/O pin - you risk damaging your Arduino.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

CrossRoads

150mA, yes way too much!
Add in a N-Channel MOSFET, let the Arduino drive PWM into its gate thru a 250 ohm resistor.
AOI514 would be great, almost the same as having a relay to connect the motor '-' to Gnd.
http://www.digikey.com/product-search/en?keywords=aoi514
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

168gr

Wait, I'm not powering the motor from the Arduino. I know I can't pull much off an Arduino powered by USB.

I have an external power supply. 5V --> motor --> Arduino. Common ground. Am I still really limited to 20 mA?


I'm using the digital I/O pin as a drain. When it's PWM'ing to 5 V, there's no potential and nothing happens; when it's 3 V, there's a 2 V potential and the motor moves.

Unless I'm fundamentally misunderstanding something here.

jack wp

"I'm using the digital I/O pin as a drain. When it's PWM'ing to 5 V,"
There is not a yes/no answer here.
Whether source or drain, it's not much difference. When PWM comes into the calculation, it adds more.
In general terms, a pin can produce ABOUT 40 ma. If you push the limits, you should have a backup/spare arduino available.

168gr

OK, thanks. It appears I have fundamentally misunderstood this subject. I thought that since I was using an external power source, I could control motors with larger current demands this way.


What is the proper, safe way to use an Arduino to vary the voltage applied to a motor that needs more than 20 mA? If I want to be able to drive the 150 mA motor with 1.5 V one moment, 2.3 V the next, 3.9 V the next, etc to vary its speed. I'm looking for smooth, precise, fine control.

I'm sure there's a simple howto explanation, but my previous searches led me to what apparently was the wrong answer.  :)

jack wp

You need more current than the arduino pin can supply. There are several ways to do that. Transistors, FET, etc.
 I  prefer to use  KISS, SSR (solid state relay). Maybe a bit more expensive, but KISS.

Robin2

I'm using the digital I/O pin as a drain.
Without seeing a wiring schematic it is impossible to know what you are doing.

However the 40mA limit and 20mA guidance values apply whether the current is flowing into or out of an I/O pin.

Just think about it - how tiny are the circuits inside the Atmega328 chip?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

168gr

Without seeing a wiring schematic it is impossible to know what you are doing.

However the 40mA limit and 20mA guidance values apply whether the current is flowing into or out of an I/O pin.

Just think about it - how tiny are the circuits inside the Atmega328 chip?

...R
Pretty tiny. Guess I can't expect to send a lot of current through it in either direction.

Attached are a couple of pictures of the actual project, and my crude attempt at a wiring diagram schematic.

The project uses the Arduino to control two motors:
1) A servo that moves from position A to B. This needs lots of torque so I'm using a fairly strong servo that's running at 7 V. It's spec sheet says 4.8 A at 6 V but I haven't measured what it uses at 7. Whatever it is, it's getting it and it's working fine.
2) A much smaller DC vibratory motor, like what makes cell phones vibrate. This requires very fine control that varies from moment to moment. One second it may need 1.05 V, the next it might need 2.3 V.

This project, as shown, works exactly as intended. I've been using it for the better part of a year now. Using digital I/O pin 11, the Arduino has been able to vary the voltage applied to the little 3V, 30 mA motor from 0-3 V with very fine control. No problem.

My objective at this point is to replace the little 3V, 30 mA motor with one that's rated for 1.5 - 6 V, 150 mA, and continue to use the Arduino to vary the voltage applied to the slightly bigger motor from 0-5 V with similarly fine control.

I had thought I could just swap one motor for the other, but apparently the Arduino won't sink 150 mA into digital I/O pin 11 without frying ...

Thank you for your help.

168gr

Here, I'll try to inline the circuit schematic:


Robin2

Your diagram in Reply #9 does not show where the Arduino gets its power.

I would never connect a motor directly to an Arduino I/O pin because, in addition to too much current, motors can generate very high voltage spikes - far in excess of 5v.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

168gr

Your diagram in Reply #9 does not show where the Arduino gets its power.
It's plugged into a USB port on a computer, where the control software runs and communicates with the Arduino.


I would never connect a motor directly to an Arduino I/O pin because, in addition to too much current, motors can generate very high voltage spikes - far in excess of 5v.
What's the correct way to do this?

Robin2

What's the correct way to do this?
There are several circuit ideas on this website if you cannot follow the advice already given in earlier replies.

(Circuits are not my strong point so I will not give advice myself).

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

168gr

Thank you -

I guess I just got lucky that my original functioning project didn't cook the Arduino, because the motor happened to be such a low current device. This circuit diagram was on pighixxx.com:



Would this design, which shows how to turn a motor off/on by setting an IO pin low/high, allow variable speed control of a motor by using PWM on that same IO pin?

It says "recommended only for switch or low frequency applications" which makes me question that.


Thanks for your patience. I started off with some misconceptions and it's hard to overcome errors you thought you were getting right all along ... after all, the project worked for months with the little motor. :)

Robin2

Just so you know I have seen your Reply #13, I am not competent to answer your question.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up