Correct way to connect a DC motor with an Arduino

Hey guys,

I have a quite simple question: As the Arduino could be fried when powering my motor directly from the board, I'd like to know what's the correct way to connect my motor to control it with my Arduino?

So I think I should NOT connect Arduino-5V to Motor-PinA and Arduino-GND to Motor-PinB (with a condensator between), right? What would you suggest? Should I control it only with a relay?

Greetings!

Hi,

You should check modules based on L298 H bridges they are cheap and easy to use.
Here is a link http://tinyurl.com/yd5c423c
There are many tutorials on the net to control DC motors with arduino

Foufi:
You should check modules based on L298 H bridges they are cheap and easy to use.

But inefficient having huge voltage drops necessitating huge heatsinks for any appreciable current, and are decades old.

Rather have a look for something newer and more efficient, and even easier to use because huge heatsinks are unlikely, such as these offered by Pololu.

I have had good results with this one, which has fewer connections than an L298:

alve89:
Hey guys,

I have a quite simple question: As the Arduino could be fried when powering my motor directly from the board, I'd like to know what's the correct way to connect my motor to control it with my Arduino?

So I think I should NOT connect Arduino-5V to Motor-PinA and Arduino-GND to Motor-PinB (with a condensator between), right? What would you suggest? Should I control it only with a relay?

Greetings!

You need to identify your motor, specifically operating voltage, stall current.

An H-bridge is what you need if you need to control a motor in both directions. If it only needs to run in one direction then a MOSFET or other transistor is what you need.

But "my motor" is not a sufficiently detailed specification to say much more about it.

Steve

MarkT:
You need to identify your motor, specifically operating voltage, stall current.

Actually this was a general question, so I don't think of a specific motor.

neiklot:
Rather have a look for something newer and more efficient, and even easier to use because huge heatsinks are unlikely, such as these offered by Pololu.

I have had good results with this one, which has fewer connections than an L298:

Thank you for these product hints. As far as I understand I need an H-bridge to control the motor and its rotation speed / direction, right? I didn't think so far, I just thought of how connect it - perfect solution, thank you!

Have a nice weekend all together, my question is answered.

Just make sure you scan the Pololu list (or similar list from elsewhere) to check that the one you choose handles the voltage and current of your actual motor when you have one. I just gave that pic as an example of connections; the details will differ.

slipstick:
An H-bridge is what you need if you need to control a motor in both directions. If it only needs to run in one direction then a MOSFET or other transistor is what you need.

But "my motor" is not a sufficiently detailed specification to say much more about it.

Steve

Could you please explain in a very simple way why I need a transistor? Why can't I use my Arduino to switch the motor?

neiklot:
Just make sure you scan the Pololu list (or similar list from elsewhere) to check that the one you choose handles the voltage and current of your actual motor when you have one. I just gave that pic as an example of connections; the details will differ.

Yes, of course, I got this. When I start my motor project - presumably next week - I will use this to get the right "controller". Thanks!

alve89:
Could you please explain in a very simple way why I need a transistor? Why can't I use my Arduino to switch the motor?

Because for an almost certainty an Arduino digital pin cannot supply enough current, and even if it could, that would only be at 5V. So while an Arduino digital pin can provide up to say 20mA at 5V for an LED, and switch it off and on, even tiny vibrator motors are beyond that capability. This one, for example, is 70mA: almost 4x too much for an i/o pin.

So you need to provide the right voltage (which might be 5V but just as likely not) with the right current capability, and use the Arduino digital pin to in turn control a transistor to switch that other supply.

It would look something like this:

Problem is, when you do that, you can only have the polarity one way; to switch the polarity to get the motor changing direction requires a so-called h-bridge. It's quite complex to roll your own h-bridge, hence the availability of those like in the Pololu list.

alve89:
Actually this was a general question, so I don't think of a specific motor.

Then the general answer is "with a correctly sized motor driver".

Is your motor somewhere in this range?

littleDCmotor.jpgbig_DC_Motor.png

Ha! Yes, but I guess the important point is that even the sort of electric motor for a small project might
be anywhere from a watt or so upto many hundreds of watts (electric drill motor or RC brushless).
No generalization covers them all.