The Definitive FAQ: Arduino Controlling a Motor
When building electromechanical projects, Arduino controlling a motor is one of the most common yet frequently misunderstood tasks. Whether you are spinning a simple brushed DC fan, positioning a robotic arm with high-torque servos, or driving a CNC gantry with NEMA 17 steppers, the microcontroller cannot source the required current directly from its I/O pins. An Arduino Uno R3 or Nano can safely source only 20mA per pin (with an absolute maximum of 40mA), while even small hobby motors demand anywhere from 300mA to 3A under load.
As of 2026, the maker market has largely moved past legacy, inefficient driver ICs in favor of modern MOSFET-based and specialized chopper drivers. This quick reference guide and FAQ will cut through the noise, providing exact wiring topologies, component recommendations, and troubleshooting matrices to ensure your motor control circuits are robust, thermally stable, and electrically quiet.
Quick Reference Matrix: Motor Types & Driver ICs
Selecting the correct driver IC is the first critical step. Below is a comparison of the most reliable motor drivers for 5V logic microcontrollers, contrasting legacy components with modern standards.
| Motor Type | Recommended Driver IC | Max Continuous Current | Voltage Drop / Efficiency | Typical Cost (2026) |
|---|---|---|---|---|
| Brushed DC (Small) | TB6612FNG (Dual) | 1.2A per channel (3.2A peak) | ~0.5V (MOSFET, High Efficiency) | $4.00 - $6.00 |
| Brushed DC (Legacy) | L298N (Dual) | 2.0A per channel | ~2.0V (BJT, High Heat Loss) | $3.00 - $5.00 |
| Bipolar Stepper | DRV8825 | 1.5A (without active cooling) | Current-regulated chopper | $3.50 - $5.00 |
| Bipolar Stepper | TMC2209 (Silent) | 2.0A (RMS) / 2.8A (Peak) | StealthChop / SpreadCycle | $8.00 - $12.00 |
| Standard Hobby Servo | Direct PWM / External BEC | Up to 2.5A (Stall) | N/A (Requires 5V-6V Rail) | N/A |
Expert Note: Avoid the L298N for new battery-powered designs. Its bipolar junction transistor (BJT) architecture drops roughly 2V across the H-bridge, wasting significant battery life as heat. The TB6612FNG uses MOSFETs, dropping only ~0.5V and running vastly cooler. For a comprehensive overview of modern IC architectures, refer to the Texas Instruments Motor Drivers Guide.
FAQ: Power, Grounding, and Brownouts
Q: Why does my Arduino reset or freeze when the motor starts?
This is the most frequent issue when Arduino controlling a motor circuits fail. It is almost always caused by a brownout or ground bounce. When a motor starts, it draws a massive inrush current (stall current), which can momentarily pull the shared voltage rail down below the Arduino's ATmega328P minimum operating threshold (typically 2.7V to 4.5V depending on clock speed).
The Fix:
- Separate Power Rails: Never power a motor directly from the Arduino's 5V or VIN pins. Use a dedicated power supply (e.g., a 12V LiPo or bench supply) for the motor driver's high-current terminals.
- Common Ground: The ground (GND) of the motor power supply must be tied to the Arduino's GND. Without a common ground reference, the PWM and direction logic signals will float, causing erratic behavior.
- Bulk Decoupling: Solder a large electrolytic capacitor (e.g., 470µF to 1000µF, rated for at least 25V) directly across the motor driver's power input terminals to absorb inrush current spikes.
Q: Can I power a high-torque servo like the MG996R from the Arduino board?
No. A standard MG996R metal-gear servo can draw up to 2.5A under stall conditions. The Arduino's onboard 5V linear regulator (often an NCP1117) will thermally shut down or permanently fail if subjected to currents exceeding 800mA, and USB ports typically limit current to 500mA. You must use an external BEC (Battery Eliminator Circuit) or a dedicated 5V/6A switching buck converter to power the servo's red wire, while connecting the signal wire to the Arduino PWM pin and ensuring a shared ground.
FAQ: Stepper Motor Tuning & Vref Calculations
Q: How do I set the current limit on a DRV8825 or A4988 stepper driver?
Stepper drivers use a sense resistor (Rsense) to monitor current. If the current limit is set too high, the driver will overheat and trigger thermal shutdown. If set too low, the motor will skip steps and lack torque. You must tune the Vref (reference voltage) potentiometer on the driver board.
According to the Pololu DRV8825 Documentation, the formula for the DRV8825 (which typically uses a 0.1Ω sense resistor) is:
Vref = Imax * (8 * Rsense)
Step-by-Step Tuning:
- Identify your motor's rated current (Imax) from the datasheet. For a standard NEMA 17, this is often 1.5A.
- Calculate Vref:
1.5A * (8 * 0.1Ω) = 1.2V. - Power the driver's logic side (VDD) with 5V from the Arduino, but do not connect the high-voltage motor supply yet.
- Use a digital multimeter to measure the voltage between the GND pin and the metal body of the potentiometer.
- Adjust the pot with a ceramic screwdriver (metal tools can short the pins) until the multimeter reads exactly 1.2V.
Q: What is the difference between Fast Decay and Slow Decay modes?
Chopper drivers use PWM to regulate current. Slow decay allows current to recirculate through the low-side MOSFETs, providing smoother low-speed operation but potentially causing mid-band resonance. Fast decay forces current to drop rapidly by reversing the voltage across the coil, which is necessary for high stepping rates but introduces more audible noise and ripple. Modern drivers like the TMC2209 handle this automatically via StealthChop and SpreadCycle algorithms, eliminating the need for manual decay mode tuning.
FAQ: EMI, Noise, and Signal Corruption
Q: Why do my I2C sensors drop out when the DC motor is running?
Brushed DC motors are notorious for generating broadband Electromagnetic Interference (EMI). The physical sparking at the carbon brushes creates high-frequency noise that travels back through the power wires and radiates into adjacent logic cables, corrupting sensitive protocols like I2C, SPI, and analog sensor readings.
The Hardware Solution:
- Terminal Capacitors: Solder a 100nF (0.1µF) MLCC ceramic capacitor directly across the two motor terminals. This shorts high-frequency noise before it escapes the motor casing.
- Case Grounding: For severe noise, solder two additional 100nF capacitors: one from the positive terminal to the metal motor casing, and one from the negative terminal to the casing.
- Twisted Pairs: Always use twisted pair wiring for motor phase cables to cancel out magnetic field emissions.
- Optoisolation: In industrial environments, use optocouplers (like the PC817) between the Arduino logic pins and the motor driver inputs to physically break ground loops.
For foundational knowledge on isolating logic from high-current inductive loads, review the Official Arduino Motor and Inductive Load Guide.
Troubleshooting Matrix: Common Failure Modes
Use this rapid-diagnostic table when your Arduino controlling a motor build exhibits unexpected physical behavior.
| Symptom | Probable Root Cause | Hardware / Code Fix |
|---|---|---|
| DC Motor whines loudly but doesn't spin. | PWM frequency is too low or insufficient current to overcome static friction. | Change PWM pins to 3 or 11 (980Hz) or use Timer1 library to set 20kHz (ultrasonic). Increase supply voltage. |
| Stepper motor vibrates but shaft does not turn. | Wiring sequence is wrong, or step pulse is too fast for the driver. | Verify coil pairs with a multimeter (A1/A2, B1/B2). Add a 2ms delay in the step() function. |
| Driver IC is too hot to touch (>60°C). | Vref set too high, or inadequate heatsinking/airflow. | Recalculate and lower Vref. Attach an aluminum heatsink and ensure 2+ CFM of active airflow. |
| Servo jitters randomly at its end-stops. | Signal wire picking up noise, or power supply ripple. | Route PWM signal wire away from motor power cables. Add a 470µF capacitor on the servo 5V rail. |
Software & Library Quick Hits
While hardware dictates the physical limits of your system, software determines its precision. For DC motors, the native analogWrite() function is sufficient for basic speed control. However, for stepper motors, blocking code like delay() will cripple your microcontroller's ability to read sensors simultaneously.
Always use the AccelStepper library for non-blocking stepper control. It handles acceleration and deceleration profiles automatically, preventing the motor from stalling due to sudden inertial loads. Set your setMaxSpeed() and setAcceleration() parameters conservatively during initial testing, scaling up only after verifying the mechanical limits of your gantry or lead-screw assembly.
Final Wiring Best Practices
When assembling your final prototype on a breadboard or perfboard, keep high-current motor traces as short and thick as possible. If using a custom PCB, ensure motor power traces are at least 40-50 mils wide per amp of expected current, and pour a solid ground plane on the opposite layer to minimize inductance. By respecting the physical boundaries of your driver ICs and implementing rigorous decoupling strategies, your motor control projects will achieve industrial-level reliability in a maker-scale footprint.






