Controlling Multiple DC motors with Arduino using PWM

Hey Guys,

I am trying to use Arduino to control multiple DC motors (around 10). As recommended in the book Getting Started with Arduino I am trying to use the IRF520 MOSFET to control the current from a 9V battery source using PWM. Since I am new to electronics and Arduino I was hoping to get some tips or feedback on the feasibility and possible issues I may encounter with my project.

The motors are quite small and need around 70-140mA to operate, so the MOSFET not being at full capacity is ok.

The diagram for the set up showing only 3 motors is attached!

OK, here are some issues:

  1. You have the diodes connected incorrectly. The anodes should be connected to the mosfet drains, and the cathodes to the +9V supply, not to ground. [So the diodes are in parallel with the motors.]

  2. Don't use a 9V battery, it will last hardly any time at all and its voltage will drop substantially when you run the motors. Use a wall wart or a set of six AA cells instead.

  3. You should have resistors of 100 to 220 ohms between the Arduino pins and the mosfet gates. It's kinder to the Arduino that way.

  4. IRF520 is not a suitable mosfet for driving direct from an Arduino, because it's designed for 10V gate voltage and the Arduino only provides 5V. Use a logic level mosfet instead.

But the basic idea is sound.

Thanks a lot for all the advice! I really appreciate it, since I don't know much about electronics!

I shall try with 6AA batteries in series!

At the risk of sounding silly I wanted to ask another question:

From my understanding the PWM should provide 5V pulses (please correct me if I am wrong) which should allow 3Amp current to pass through the MOSFET, but I need only 70-140 mAmp to power my motors, so how do I ensure that not too much current is going through them?

nishant_91:
Thanks a lot for all the advice! I really appreciate it, since I don't know much about electronics!

I shall try with 6AA batteries in series!

At the risk of sounding silly I wanted to ask another question:

From my understanding the PWM should provide 5V pulses (please correct me if I am wrong) which should allow 3Amp current to pass through the MOSFET, but I need only 70-140 mAmp to power my motors, so how do I ensure that not too much current is going through them?

The motors will draw only as much current as they need. The important thing is to give them the correct voltage. I presume your motors are designed for 9V because you are using a 9V battery.

If your motors only need 140mA then you could drive them with NPN transistors (e.g. BC337) instead of mosfets.

Ok, thanks for clearing that up, just realized that all my motors are rated at 3V, I'm not sure how to power them now, should I use the Arduino 3V pin directly? But I dont want to fry my board by mistake!

Or is there some way to use DC power directly from the wall socket to my breadboard?

Sorry for sounding like an idiot, but this is my first electronics project! And thanks again for your help!

nishant_91:
Ok, thanks for clearing that up, just realized that all my motors are rated at 3V, I'm not sure how to power them now, should I use the Arduino 3V pin directly? But I dont want to fry my board by mistake!

Power the motors from two AA cells in series, and the Arduino from a separate 5V or greater supply. The Arduino 3.3V output is only rated at 50mA.

Ok thanks a lot!

What is the advantage of using 2 AA batteries rather than a 9V battery with a voltage regulator?

nishant_91:
What is the advantage of using 2 AA batteries rather than a 9V battery with a voltage regulator?

Huge increase in current capability and charge capacity, for similar cost.