Completed Feb 2026 – Jul 2026
View GitHub Repository

Fully Analog DC Motor Speed Controller

A closed-loop DC motor speed controller with no microcontroller anywhere in the loop: encoder feedback, PID and PWM generation done entirely with op-amps and discrete power electronics.

Overview

This project regulates DC motor speed in closed loop without a single digital component in the control path. Encoder pulses are converted to a proportional analog voltage by a custom frequency-to-voltage converter (an RC low-pass filter, peak detector and signal-conditioning stage), giving continuous real-time speed feedback with no ADC sampling anywhere in between.

That feedback voltage is compared against a reference and run through a full analog PID controller built from TL072 op-amp stages implementing proportional, integral and derivative action directly in the analog domain. The PID output drives a custom analog PWM generator (a Schmitt-trigger oscillator, integrator and comparator producing a clean triangular carrier, followed by a precision rectifier and positive clipper to shape it into a clean 0–5V PWM signal), which finally switches an IRLZ44N logic-level MOSFET (with flyback diode and gate/pull-down protection) to drive the motor.

My part of the loop was the PWM generation stage: designing the Schmitt-trigger oscillator, integrator and comparator chain, and getting the precision-rectifier output clean enough to reliably switch the MOSFET stage. Testing and tuning the whole loop entirely on hardware, with no software knob to fall back on, meant every gain, corner frequency and clipping threshold had to be nailed down through component selection and bench iteration.

Key Features

  • 01Fully analog closed-loop speed control — no microcontroller, DSP or FPGA anywhere in the loop
  • 02Custom frequency-to-voltage converter turning encoder pulses into continuous analog speed feedback
  • 03Analog PID controller (P + I + D) built from TL072 op-amp stages
  • 04Analog PWM generator: Schmitt-trigger oscillator, integrator, comparator, precision rectifier and clipper
  • 05IRLZ44N MOSFET power driver stage with flyback protection for reliable motor switching