PWM vs Time Proportional PID Heating Control

The Homebrew Forum

Help Support The Homebrew Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

brewzone

Regular.
Joined
Jul 28, 2008
Messages
217
Reaction score
1
Location
Staffordshire
I have been working on a PID system based on the Arduino PID libraries.

Reading all I could on the subject of PWM vs Time Proportional Heating Control I decided to do some comparison runs.

I created a simulation routine to save Me having to run the tests in a real world environment.

This helped speed the whole process of tuning the PID settings Kp Ki and Kd.

Auto Tune worked with several degrees of overshoot.

In the end I went for a step test tuning method.

Creating graphs from the output of the Arduino serial.print command over Bluetooth and recorded using Minicom on the RPI3.

I eventually got the overshoot down to 0.04C in simulation and 0.67C on a 33L test system.

I am working on removing the slight overshoot due to lag and will post the results when I achieve the 0.04C on the 33L system.

Here is the PID system.

39552857772_f693709e96_c.jpg


Here is a graph of the Time Proportional run.

38774274115_160f1a1bc9_b.jpg


Here is a graph of the PWM run.
25799564698_3f60bfab4f_b.jpg


The Blue line is Set Point, Red is Process Variable and Black is the Output from the PID compute command.

I used the same Kp Ki and Kd values for each run.

Time Proportional reached a steady state very quickly with the Output settling at 2.35% and maintains the temperature at exactly 63C.

PWM has the Output ringing anything between 0.1% and 47% and maintains the temperature at exactly 63C.

Exactly the same code albeit for the analogWrite(RelayPin, Output); vs digitalWrite(RelayPin, HIGH/LOW);

I am hoping to get the PWM runs to settle to steady state of 2.35%

PID sample rate is 1000ms.
 
Nice work. I wish I had the guts to work with a relay for my boiler. I'm trying to construct something to control via a WiFi plug socket, but I'm sure I won't be able to achieve anything so tightly regulated.
 
If You put the relay in a watertight container with cable glands its pretty safe so long as You intend to be around throughout to ensure if the relay fails there is a human override.

I have run the PWM system again with Kp Ki and Kd adjusted to reflect the Output limit of 255 rather than 10000 for Time Proportional with a 10000ms window.

It now settles to steady state exactly as I wanted.

Will be testing on the 33L system one day next week after I do the decorating I promised I'd do.
 
Spent a few days setting the Arduino Mega to do PWM at 50Hz with a duty cycle between 0-1023 on Pin44 rather than the stock settings that the core libraries seem to impose of 490hz with a duty cycle between 0-255.

To introduce some protection against the SSR failing in the on state I'm looking at using either a contactor or a cheaper mechanical relay.

Next project an Arduino oscilloscope.
 

Latest posts

Back
Top