EmbeddedRelated.com
How to Build a Fixed-Point PI Controller That Just Works: Part II

How to Build a Fixed-Point PI Controller That Just Works: Part II

Jason Sachs
Still RelevantIntermediate

In Part I we talked about some of the issues around discrete-time proportional-integral (PI) controllers: various forms and whether to use the canonical form for z-transforms (don't do it!) order of operation in the integral term: whether to...


Summary

This blog post continues a practical walkthrough of implementing a robust fixed-point discrete-time PI controller for microcontrollers. The author explains numeric choices (Q-format, scaling), anti-windup and saturation techniques, implementation patterns in C, and pragmatic test strategies so readers can deploy PI loops that behave reliably on resource-constrained hardware.

Key Takeaways

  • Choose an appropriate Q-format and scaling strategy to maximize dynamic range while avoiding overflow.
  • Implement anti-windup and saturation in integer arithmetic to prevent integral windup and unexpected behavior at limits.
  • Use fixed-point multiply-and-shift patterns (and MCU-specific intrinsics when available) to preserve precision and efficiency.
  • Select discretization and ordering of operations that minimize numerical error and maintain closed-loop stability.
  • Validate the controller with unit tests, step-response checks, and simple hardware-in-the-loop tests before on-target deployment.

Who Should Read This

Embedded firmware engineers and control engineers working on microcontroller-based PI loops who need reliable, efficient fixed-point implementations for constrained targets.

Still RelevantIntermediate

Topics

Firmware DesignMotor ControlARM Cortex-MSensor Interfacing

Related Documents