

A motor is a device that converts electrical energy into mechanical energy. It is a fundamental component in countless applications, ranging from industrial machinery to consumer electronics. Motors are used to drive mechanical systems, such as conveyor belts, fans, pumps, and robotic arms. They are available in various types, including DC motors, AC motors, stepper motors, and servo motors, each suited for specific use cases.
Common applications of motors include:








The specifications of a motor vary depending on its type and intended application. Below is an example of a DC motor's typical technical specifications:
| Parameter | Value |
|---|---|
| Operating Voltage | 6V - 12V |
| Rated Current | 0.5A - 2A |
| Stall Current | 2A - 5A |
| Rated Speed | 1000 - 5000 RPM |
| Torque | 0.1 - 1.5 Nm |
| Power Output | 1W - 50W |
| Motor Type | Brushed DC Motor |
| Pin Name | Description |
|---|---|
| VCC | Power supply input (6V - 12V) |
| GND | Ground connection |
| Motor+ | Positive terminal for motor winding |
| Motor- | Negative terminal for motor winding |
| Encoder A | Encoder output signal A (for speed/direction) |
| Encoder B | Encoder output signal B (for speed/direction) |
Below is an example of how to control a DC motor using an Arduino UNO and an L298N motor driver.
// Example: Controlling a DC motor with Arduino UNO and L298N motor driver
// Define motor control pins
const int motorPin1 = 9; // Motor input pin 1
const int motorPin2 = 10; // Motor input pin 2
const int enablePin = 11; // Enable pin for motor speed control
void setup() {
// Set motor pins as outputs
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(enablePin, OUTPUT);
}
void loop() {
// Rotate motor in forward direction
digitalWrite(motorPin1, HIGH); // Set pin 1 HIGH
digitalWrite(motorPin2, LOW); // Set pin 2 LOW
analogWrite(enablePin, 128); // Set speed (0-255)
delay(2000); // Run motor for 2 seconds
// Rotate motor in reverse direction
digitalWrite(motorPin1, LOW); // Set pin 1 LOW
digitalWrite(motorPin2, HIGH); // Set pin 2 HIGH
analogWrite(enablePin, 128); // Set speed (0-255)
delay(2000); // Run motor for 2 seconds
// Stop the motor
digitalWrite(motorPin1, LOW); // Set pin 1 LOW
digitalWrite(motorPin2, LOW); // Set pin 2 LOW
analogWrite(enablePin, 0); // Set speed to 0
delay(2000); // Wait for 2 seconds before repeating
}
Motor Not Spinning:
Motor Overheating:
Noisy Operation:
Inconsistent Speed:
Q: Can I connect a motor directly to a microcontroller?
A: No, motors typically require more current than a microcontroller can provide. Use a motor driver or H-bridge circuit to control the motor.
Q: How do I reverse the motor's direction?
A: Swap the polarity of the motor terminals or use a motor driver to control the direction programmatically.
Q: What is the purpose of an encoder in a motor?
A: An encoder provides feedback on the motor's speed and position, enabling precise control in applications like robotics.
Q: Can I use a single power supply for both the motor and microcontroller?
A: Yes, but ensure the power supply can handle the combined current requirements of both components. Use decoupling capacitors to reduce noise.