Sign In / Join Cloud 360
Engineering • Innovation • Learning
Motors & Actuators Intermediate Level 17 min

DC Motor Modeling, H-Bridge PWM & Optical Quadrature Encoders

Armature electro-mechanical transfer functions, back-EMF, 4-quadrant H-bridge operation, dead-time shoot-through prevention, and optical quadrature decoding.

Prerequisites: Newton's rotational mechanics ($T = J\alpha$), Faraday's law of induction, and basic PWM duty cycle.

1. Overview & Concept Definition

Direct Current (DC) brushed motors convert electrical energy into rotational mechanical work via Lorentz force interactions between a permanent stator magnetic field and rotating rotor commutated windings.

2. Engineering & Industrial Significance

Standard prime mover for mobile robotics, wheels, conveyor belts, linear actuators, and automotive power windows due to high starting torque and straightforward voltage-proportional speed control.

3. Physical Working Principle & Transducer Dynamics

Armature current generates Lorentz force on rotor coils. As the rotor turns, coils cut stator magnetic flux, generating an opposing counter-electromotive force (Back-EMF $E_b = K_e \omega$). An H-Bridge with 4 MOSFET/BJT switches controls current direction across the motor windings, enabling forward, reverse, freewheel coasting, and dynamic braking.

4. Governing Equations & Mathematical Models

Armature Electrical KVL: $V(t) = R_a I_a(t) + L_a \frac{dI_a(t)}{dt} + K_e \omega(t)$
Mechanical Torque Equilibrium: $T_{em}(t) = K_t I_a(t) = J \frac{d\omega(t)}{dt} + B \omega(t) + T_L$
Motor Steady-State Speed: $\omega_{ss} = \frac{V_{in} - I_a R_a}{K_e}$
Quadrature Resolution: $CPR = 4 \times N_{lines}$ (4 transitions per cycle on Channel A and B)

5. Practical Implementation

// Arduino C++: Quadrature Encoder ISR with direction detection
const int PIN_ENC_A = 2; // External Interrupt 0
const int PIN_ENC_B = 3; // External Interrupt 1
volatile long encoderTicks = 0;

void IRAM_ATTR isrEncoderA() {
    // Read channel B to determine rotation direction
    if (digitalRead(PIN_ENC_B) == LOW) {
        encoderTicks++;
    } else {
        encoderTicks--;
    }
}

void setup() {
    pinMode(PIN_ENC_A, INPUT_PULLUP);
    pinMode(PIN_ENC_B, INPUT_PULLUP);
    attachInterrupt(digitalPinToInterrupt(PIN_ENC_A), isrEncoderA, RISING);
}

6. Common Engineering Pitfalls & Troubleshooting

Frequent Engineering Pitfalls
  • Shoot-through failure in DIY H-bridges: Turning on both top and bottom MOSFETs on the same leg simultaneously creates a dead short across the power supply, instantly destroying the transistors. Enforce hardware or software dead-time (~500ns).
  • Neglecting inductive flyback diodes: Collapsing motor winding magnetic field produces high-voltage inductive spikes ($V = -L di/dt$) that puncture driver silicon. Always ensure ultrafast freewheeling clamp diodes are present.
Diagnostic & Troubleshooting Checklist
  • Encoder reading jumps or drifts: Induced electrical noise from unshielded motor brushes couples into encoder wires. Twist encoder wire pairs, solder 100nF ceramic noise bypass capacitors across motor terminals, and enable hardware Schmidt-trigger inputs.
  • Motor buzzes at low PWM without rotating: Overcome static stiction by implementing minimum PWM deadband thresholding or increasing PWM frequency above 18 kHz.

7. Applications & Physical Constraints

TYPICAL APPLICATIONS
  • Differential-drive autonomous ground vehicles
  • Closed-loop robotic position servomechanisms
  • Camera pan-tilt motorized gimbals
PHYSICAL LIMITATIONS
  • Mechanical commutator brushes experience frictional wear, acoustic noise, and sparking at high RPM, limiting lifespan compared to BLDC motors.
Pinout & Interface Specs
PIN / SIGNAL FUNCTION / ELECTRICAL SPEC
ENA / ENB PWM speed control input (0% to 100% duty cycle)
IN1 / IN3 Direction control pin A (Logic HIGH/LOW)
IN2 / IN4 Direction control pin B (Logic HIGH/LOW)
VM / VMS Motor high-current power rail (+7V to +36V)
ENC_A Quadrature encoder channel A output (digital TTL)
ENC_B Quadrature encoder channel B output (90° phase shifted)
Have questions on this topic?

Ask LUNA to calculate component values or explain alternative control methods for DC Motor Modeling, H-Bridge PWM & Optical Quadrature Encoders.