I have a LED controller that has several temperature sensors in different places of the system. I want to implement an overtemperature protection for the system.

Now this would be theoretically a simple excercise but the thing is that the system needs to keep on operating at a reduced output power when overheated. The ambient temperature load can vary greatly (sun/no sun etc). So the feedback needs to be proportional, simple hysteretic control will not do. In essence if the ambient thermal load is large enough to trip overheat protection, the system starts operating as an PI controlled unit with the limit acting as a setpoint.

I'm thinking of doing this with a trusty PI control sans the delta function. Is there any proven method of implementing this type of control which in normal operation remains permanently below the setpoint? If I do straight PI control the I portion will grow excessive and will prevent reasonable response to overheat condition.

I'm thinking of imposing a hard cap on "below setpoint" integral portion. For example it cannot exceed whatever 32 minutes at 1 degree below setpoint works out to. This would allow the integral to "reset" relatively quickly at overtemperature condition.

Is this a good solution?

  • \$\begingroup\$ I think what you are referring to is called "anti-windup" and is used in almost every PI(D) controller I've ever implemented. \$\endgroup\$
    – Ron Beyer
    Commented Dec 8, 2017 at 14:43
  • 1
    \$\begingroup\$ The description is almost unreadable, like google translate. A simple proportinal regulator can do the trick. \$\endgroup\$ Commented Dec 8, 2017 at 14:59
  • \$\begingroup\$ @RonBeyer Ok, some references to this in googling Integral Windup. I didn't know what it'd be called. \$\endgroup\$
    – Barleyman
    Commented Dec 8, 2017 at 15:27

3 Answers 3


Simple PI where you regulate the temperature should do the trick.

In normal operation, no overheat, your regulation loop saturates and provides full power to your system. If it starts getting too hot, the control loop does its job and turns the power down.

If your PID is analog, no problem, if it is in software, you will have to cap the I term to avoid the problem you correctly fear.

  • \$\begingroup\$ According to google the integral windup is more of a problem in analog systems. I guess you could end up with your process generating a large overshoot if your analog controller cranks up the power to max during warm-up. \$\endgroup\$
    – Barleyman
    Commented Dec 8, 2017 at 15:30
  • \$\begingroup\$ @Barleyman Digital PI will wind up just as nicely as analog. Most practical PI controllers have anti-reset-windup algorithms implemented. All the ones I've done do. \$\endgroup\$ Commented Dec 8, 2017 at 17:25
  • \$\begingroup\$ @SpehroPefhany It's much easier to fix thought. \$\endgroup\$
    – Barleyman
    Commented Dec 8, 2017 at 18:23
  • \$\begingroup\$ @Barleyman Indeed, and software is just a bit of typing beyond that. \$\endgroup\$ Commented Dec 8, 2017 at 19:14

With an MCU you just feed the PI the maximum temperature as setpoint, Tlim.
The PI outputs a number between 0.0 and 1.0. (as in 0 to 100% floating point) You multiply this number with the LED driver output, whatever that might be.

When Tlim, the PI outputs anything from 0 to 1.

In the PI you skip the integrator accumulator when the output is saturated as anti-windup.

Another method would be to implement a derating curve, a simple linear formula that ramps from 1 to 0 crossing X at Tmax. Since heat is relatively predictable, it might be easier to configure than a PI if you know the heat dissipation numbers.

  • \$\begingroup\$ I was thinking about that linear formula but I felt it could become rather unstable plus you'd probably end up oscillating ABOVE your temperature limit if it's a hot enough day.. For what it's worth the puny microcontroller cannot reasonably deal with floats so I'm multiplying power by 1 to 16 and shifting result right by 4 positions. \$\endgroup\$
    – Barleyman
    Commented Dec 8, 2017 at 17:14
  • \$\begingroup\$ @Barleyman the same can be applied for fixed point math. \$\endgroup\$
    – Jeroen3
    Commented Dec 8, 2017 at 18:30
  • \$\begingroup\$ Oh yes. In fact I described a way to do it without that nasty division. DIV? What DIV instruction, never heard of it.. Add a second term with an additional shifted coefficient and you get a more fine-grained control. \$\endgroup\$
    – Barleyman
    Commented Dec 9, 2017 at 2:00


simulate this circuit – Schematic created using CircuitLab


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.