Skip to content

0.4.0 PWM and new control algorithms

Choose a tag to compare
@elcojacobs elcojacobs released this 03 Dec 19:19
· 660 commits to develop since this release

This release brings PWM support to BrewPi and splits out the control algorithm in smaller classes and independent objects.


  • Modular control algorithm, which is easy to scale to multiple control loops later.
  • New fixed point class to represent internal temperatures and variables
  • Fridge temperature now also controlled by PID. Overshoot estimation has been removed.
  • PID class
    • Filtering has moved inside this PID class instead of in temperature sensor class
    • How integrator anti-windup is implemented has been completely reworked. It now reads back the actuator state to see if it is saturated and compensates.
    • PID constants are now defined as Kp, Ti and Td (time constants for integral and derivative, instead of gains)
  • Setpoint class: setpoints can be shared by multiple PIDs and are independent.
  • Controller state is output as JSON using ESJ


  • Many new actuator classes, that can have each other as target. Composite PWM classes can make up more complex actuators.
  • PWM actuator
    • Drives another digital actuator
    • Configurable PWM frequency
    • Automatically adapts to achieve correct average if the actuator below has a minimum ON or OFF time. It can skip high or low cycles when near the minimum or maximum.
  • Time limited actuator: guards that the actuator it is driving is high/low for a minimum time.
  • Mutex actuator: Actuators can be made mutually exclusive by adding them to a Mutex group, which keeps track of their priority and serves as an arbiter to determine who can go active. Also manages a dead time for switching between actuators.
  • Support for DS2413 actuators, which can also be driven with PWM
    • Fixed bugs in DS2413 code. Now both outputs work correctly.
  • Support for valve controller boards based on the DS2408
  • Cascaded control is now implemented with a SetPoint actuator that offsets one setpoint with another
  • Minimum ON and OFF time for a fridge is now configurable


  • Boost test framework and new unit tests
  • New simulations in unit tests, which output CSV files that can be plotted with Python.
  • Time out on touch screen calibration on the Photon
  • Temperature output is now unfiltered
  • Prevent the same actuator or function to be installed twice in device manager
  • Fixed alarm/buzzer sounding weird