Home / Learn Chip Programming / Motors, H-Bridges, Servos and Steppers

Motors, H-Bridges, Servos and Steppers

How a 3.3 V pin controls a powerful motor safely.

In shortHow a 3.3 V pin controls a powerful motor safely.

Theory in plain words

DC motor controlMCU PWM + DIR pinsMotor driver (H-bridge)Motor supply 6-12 VMotor + flyback diodes
DC motor control

What it is

A pin cannot drive a motor directly. Use a transistor, MOSFET or driver chip. H-bridge reverses direction; PWM controls speed. Servos take a pulse width as position. Steppers move in fixed steps.

Why we use it

Robots, 3D printers, fans, pumps and drones all use motor drivers. Wrong wiring burns drivers and microcontrollers.

How it works

DC motor: H-bridge (L298N, TB6612, DRV8833) + PWM + flyback protection. Servo: 50 Hz signal with 1 to 2 ms pulse. Stepper: driver (A4988, DRV8825) with STEP and DIR pins.

Where it is used

  • Line follower and robot car
  • Motor controller project
  • 3D printers, CNC

Motor control lab

H-bridge truth table, servo and stepperTry it Yourself

This is the arithmetic you write in the motor controller project: duty to voltage, angle to pulse width, RPM to step rate.

MotorDriverControl signalGood for
Small DC (toy)transistor / MOSFET + diodePWMfans, vibration
DC with directionH-bridge: TB6612, DRV8833, L298NPWM + 2 direction pinsrobot wheels
Hobby servo (SG90)none (needs 5 V power)1 to 2 ms pulse at 50 Hzarms, steering
Stepper (NEMA17)A4988, DRV8825, TMC2209STEP + DIR + ENprinters, CNC, precise positioning
Brushless (BLDC)ESC or FOC driverPWM / 3 phasedrones, fans
Careful:Power motors from a separate supply, join the grounds, and add a 100 uF capacitor near the driver. Never power servos from the MCU 3.3 V pin: motor current spikes will reset the board.

Quick quiz

1. H-bridge input 1/0 means...

2. Servo signal period?