In
a former post
I did some hacking/checking how our underfloor heating control system
handled the valves, actuators, regulating the heat.
Now it was time to do some tests with NodeRed(NR), with a
PID controller, and a
Shelly 1(S1) connected via WiFi and driving the actuator.
The actuators are in my case controlled by 24 VAC and the S1 accepts 110
- 240 VAC, 24 - 60 VDC and 12 VDC. So in this case it was simple to
just add a rectifier and a capacitor, to the 24 VAC, to get
approx 36 VDC to source the S1.
Hardware setup
Raspberry Pi
I have a Raspberry Pi which is running 24/7, with other functions, so added below flow to the NR installation.
Relay
So connect according to the schematics, seen at the right, and
then setup the S1
for your WiFi.
Thermometer
In my Hombridge setup, with Z-way add on, I use an
Aotec Multisensor 6
which is used to retrieve the temperature in the test room. Here is a
link how to get the data. As we will se the resolution is just 0,1 °C which will give some unwanted effects.
A much better sensor could be
the Ruuvi tag or using cheep 433 MHz temperature sensors.
Software
Prerequisites
As said I have used
NodeRed with the additional nodes
- node-red-contrib-pid, PID node. Check the documentation with links to a sample flow
- node-red-dashboard, which visualizes the data
- node-red-contrib-timeprop, gives a time proportioned output from a linear input.
The flow
As an extra function the valve is exercised to max open during 10
minutes, at 06:45, so it will not get stuck. Especially useful during
summertime when it's probably closed most of the time.
Tuning
There are lot of documentation for tuning PID controllers but the guy who wrote the PID node have done an article and Eurotherm, a machine automating company, also have a good compact writing.
Start up with configure the PID node to use ON/OFF control
- "Proportional band” set to zero.
- The integral effect, "Integral time", will be disabled with a large number. One day in seconds => 24x60x60 => 86400.
- Disable the derivate effect, "Derivative time" and set to zero.
- "Initial integral" set to zero.
- "Derivate smoothing factor" set to zero.
Start up the process and check the temperature progress in the graph. Get the values for "Xosc" and "tosc". As a first approach change the values in the PID to;
P = 2.0 * Xosc, Proportional band
I = 1.5 * tosc, Integral time
D = I / 5, Derivative time
I = 1.5 * tosc, Integral time
D = I / 5, Derivative time
As said by Eurotherm "These values result in a slightly over damped response and consequently all values can be reduced slightly to give a more responsive loop."
Wrap up
As seen in the picture, set point 20 °C, the measured temperature values are in 0,1 °C steps which makes the PID output react with a quick raise in the
output. This could be changed with a smaller "Derivative time", or a
low pass filter on the input, but the best way is to have
a measurement with better resolution.
Please note that the data with the valve opening status have
another time base.
If you want to learn more about the PID controller and it's parameters
just search on Youtube and, as said, use the sample flow.
No comments:
Post a Comment
Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !