r/microcontrollers • u/No_Assistance967 • Nov 30 '25
Can a microcontroller drive DC motors directly?
I'm looking to connect 4 mini dc brushless motors (5v, 0.12w) to a seeed studio microcontroler by simply using the io pins to power them.
However, after doing some research, the consensus seems to be that you need a seperate motor controller since even tiny motors require too much power. If I'm okay with the motors running very weakly, will it work or is that not how electricity works?
0
Upvotes
15
u/Kamilon Nov 30 '25
Motors are very rough on power lines. They instantly turn from consuming energy to producing energy when the power is no longer applied. If something moves the motors manually they act as little generators too. The spikes in power can be way above what your microcontroller pins can handle. It’s possible to protect the pins with diodes and resisters but before you know it you’ve built a basic motor controller anyway.
Brushless motors are more complicated to drive than brushed motors. It makes even more sense to use a motor controller when driving brushless motors.
What’s the reason you are trying to avoid a motor controller?
2
u/Outrageous-Visit-993 Nov 30 '25
Motors directly to pins of microcontroller is a no !, brushed motors would just need some transistors/mosfets/h bridge drives.
Brushless (bldc) as mentioned absolutely needs a dedicated controller, that incidentally has the above mentioned components to drive motors, plus monitor BEMF for rotor position and phase control.
Your motors, although low current, are still looking at around 24ma, that’s before any variations of many factors come in to play that could affect that number one way or another and put the pin at risk of damage.
The pins on most microcontrollers generally have a limited current capability that varies from chip to chip, mostly driving LEDs with current limiting resistors or switching a fet/transitor but motors are always done using external components of varying descriptions, circuit dependant.
Are the tiny motors actually brushless or “coreless”, which is a kinda hybrid of BDC/BLDC, if coreless then a few transistors driven from the pins is simpler than BLDC controller from scratch or cheaper than pre-made.
4
u/theNbomr Nov 30 '25
Microcontrollers are to supply the logic. Motive energy needs to be supplied separately. That is, after all, why motor drivers exist at all.
3
u/Unable-School6717 Nov 30 '25
.12 watts divided by five volts is 20-25 milliamps which is more than most gpio pins can source on most chips. Much better to send variable width pulses to a 47uF capacitor gating a n-channel mosfet which has 3.3 volt gate saturation characteristic, and yes, a flyback diode such as 1n4006 across the motor. Put the mosfet source to ground and ...
Here is a random tutorial: https://deepbluembedded.com/arduino-mosfet-switch-n-channel-irf520-pwm-tutorial/
2
u/[deleted] Nov 30 '25
Been there… tried running a couple tiny motors directly from an Arduino once. They kinda moved, but barely, and the board got hot. A small driver IC or even a few MOSFETs makes a huge difference and saves your MCU from dying
2
u/liggamadig Nov 30 '25
You really, really shouldn't. Based on your specs (5 V, 120 mW), you already exceed the maximum current rating of most MCU GPIOs (typically 20 mA) and that's without any surges and inductive effects. You're much better off using at least small MOSFETs, if not a dedicated motor driver. For example, look at the documentation of this ST eval kit for a small drone. Maybe it'd even be a good start for your project?
1
u/Nothing-to_see_hr Nov 30 '25
mostly 20 milliamps at 5 volt, so 100 milliwatt max. per pin on the most robust arduino. newer models only tolerate 6 milliamps. Also use a decoupling diode when driving inductive loads because the magnetic energy will induce a reversed voltage spike if you drop the output from 5 volt to zero which will destroy your driver ic. I would not risk it. Consider eg a uln2003 driver which can provide at least half an amp and includes the diodes. And it has four such drivers.
1
u/FreddyFerdiland Nov 30 '25
you could use a 5 volt gpio system , the total source current allowance for 30 gpio pins should be hundreds of milliamps....
bit given most microcontrollers these days are using 3.3 volts natively... you need a transistor or relay as switch to the 5v...
1
u/pcb4u2 Nov 30 '25
No!! You will destroy the outputs. 5 volts at 30ma max for the UNO for example. You should not power a relay or motor as they draw a lot more than 30ma. Also, motors draw considerably more amperage when starting up. This is called the lock load rating. Use a transistor to operate a relay or motor. Some solid state relays can be operated directly from the Arduino family (ssr 3v ).
1
u/cquintero2 Nov 30 '25
Yes and no. If it’s something small you can but you’re probably looking something like the L298N H-Bridge
1
u/wiracocha08 Nov 30 '25
may be so, if the current output of the microcontroller is sufficient, but still, there is the EMK, not sure your microcontroller will handle that, put some diodes at least, I think better and more reliable is using a appropiate driver or make-up one with transistors and diodes.
1
u/Numerous_Habit269 Dec 01 '25
Bad idea, mcus are not designed to drive things.
As others have said use a single mosfet if it's a simple DC motor or get an hbridge controller
1
u/uzlonewolf Nov 30 '25
You could add a resistor to get the current down, however that's going to absolutely kill the torque.
Can you not just use a MOSFET as a driver?
Regardless of which way you go, don't forget the flyback diode!
-2
u/rational_actor_nm Nov 30 '25
I've used a STMF32103C6 to control pulse/dir as supplied to a stepper motor driver. It works fine.