

A motor is an electromechanical 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, perform work, or enable motion in devices such as fans, robots, conveyor belts, and vehicles.








Motors come in various types, such as DC motors, stepper motors, and AC motors. Below are the general technical specifications for a typical DC motor:
For a basic DC motor, the pin configuration is straightforward:
| Pin Name | Description |
|---|---|
| V+ | Positive terminal for power input. |
| V- | Negative terminal (ground). |
For more complex motors, such as stepper motors, the pin configuration may include multiple control pins:
| Pin Name | Description |
|---|---|
| A+ | Coil A positive terminal. |
| A- | Coil A negative terminal. |
| B+ | Coil B positive terminal. |
| B- | Coil B negative terminal. |
| EN | Enable pin (optional, for motor drivers). |
Below is an example of controlling a DC motor using an Arduino UNO and an L298N motor driver:
// Arduino code to control a DC motor using L298N motor driver
// Connect IN1 and IN2 of the L298N to Arduino pins 9 and 10 respectively
// Connect ENA of the L298N to Arduino pin 3 (PWM pin)
#define IN1 9 // Motor driver input 1
#define IN2 10 // Motor driver input 2
#define ENA 3 // Motor driver enable pin (PWM)
void setup() {
pinMode(IN1, OUTPUT); // Set IN1 as output
pinMode(IN2, OUTPUT); // Set IN2 as output
pinMode(ENA, OUTPUT); // Set ENA as output
}
void loop() {
// Rotate motor forward
digitalWrite(IN1, HIGH); // Set IN1 high
digitalWrite(IN2, LOW); // Set IN2 low
analogWrite(ENA, 128); // Set speed to 50% (PWM value: 128 out of 255)
delay(2000); // Run for 2 seconds
// Stop motor
digitalWrite(IN1, LOW); // Set IN1 low
digitalWrite(IN2, LOW); // Set IN2 low
delay(1000); // Wait for 1 second
// Rotate motor backward
digitalWrite(IN1, LOW); // Set IN1 low
digitalWrite(IN2, HIGH); // Set IN2 high
analogWrite(ENA, 128); // Set speed to 50% (PWM value: 128 out of 255)
delay(2000); // Run for 2 seconds
// Stop motor
digitalWrite(IN1, LOW); // Set IN1 low
digitalWrite(IN2, LOW); // Set IN2 low
delay(1000); // Wait for 1 second
}
By following this documentation, you can effectively integrate and troubleshoot motors in your projects.