1️⃣ Introduction
A DC motor converts electrical energy into mechanical rotation. When voltage is applied to its terminals, the motor shaft rotates continuously.
However, a DC motor cannot be connected directly to Arduino because:
-
Arduino provides very low current (around 20mA per pin)
-
DC motors require higher current
-
Motors generate back EMF (voltage spikes)
To solve this, we use a transistor as a switch.
2️⃣ Components Required
Arduino Uno
DC Motor (6V–12V)
NPN Transistor (TIP120 / 2N2222)
1kΩ Resistor
1N4007 Diode (Flyback diode)
External Battery (9V–12V)
Breadboard & Connecting wires
3️⃣ Circuit Diagram
4️⃣ Circuit Explanation
The transistor works as a switch.
When Arduino sends HIGH signal, the transistor turns ON.
Motor receives power from the battery and starts rotating.
The diode protects the circuit from voltage spikes (back EMF).
All grounds must be connected together.
5️⃣ Arduino Code (Motor Rotation Only)
int motorPin = 9;
void setup() {
pinMode(motorPin, OUTPUT);
}
void loop() {
digitalWrite(motorPin, HIGH); // Motor ON
delay(5000); // Runs for 5 seconds
digitalWrite(motorPin, LOW); // Motor OFF
delay(3000); // Stops for 3 seconds
}
6️⃣ How It Works
Arduino sends HIGH signal to pin 9
Transistor activates
Current flows from battery to motor
Motor shaft rotates
7️⃣ Applications
Robotics projects
DIY fans
Small automation systems
8️⃣ Safety Tips
✔ Do not power motor from Arduino 5V
✔ Always use external power supply
✔ Use flyback diode
✔ Connect all grounds together
9️⃣ Conclusion
Controlling a DC motor using an Arduino Uno is simple when using a transistor as a switching device. This method allows safe and efficient motor rotation control.