Close

Things that make me see (node) red...

A project log for ThermPi

A Raspberry Pi thermostat for my heat pump, with presence detection

nelson-butterworthNelson Butterworth 05/10/2017 at 05:380 Comments

As I've worked on this project over the last 3 weeks or so, I have made several attempts at 2 different features:

  1. compressor inhibit timer, and
  2. refresh fan timer

You'd think these would be simple to implement, but they've been kicking my butt. I finally built a workable solution for #1, but #2 remains elusive at this time.

Most compressor-driven refrigerant systems require a minimim cycle time in order to prevent premature compressor failure. For some heat pumps and air conditioner units, 5 minutes is recommended as the minimum time for the compressor to be on before turning back off, or the minimum shut-down time before another cycle turns the compressor back on.

Node-RED has 2 built-in timer type nodes; a delay, and a trigger. The delay takes an input message, and delays it for the set amount of time before passing it to the next node in the execution path. The trigger node emits a message upon receiving an input, then waits for a set amount of time before sending a second message. This sequence could start by emitting a true, then waiting for a few minutes before emitting a false, for instance.

The compressor cycle timer needs to allow the compressor to switch from stop to run, or run to stop, then wait for the set amount of time before allowing another run change; i.e. if stopped, let it start, then wait at least 5 minutes before letting it stop again. My first attempts quickly showed that I could not directly insert the timer directly into the execution path between other logic and the compressor's GPIO pin; for instance, every time any signal passed through the path to the pin, it would trigger the delay, even if the logic were sending a run command to an already running compressor.

So I realized that I needed to loop the timer's output back into the logic function node and flip an inhibit flag there. After several attempts, I have a solution that seems to work well enough. I've also effectively dampened most sources of repeated triggers to the various GPIO outputs, which were causing some other issues throughout the thermostat logic.

As for feature #2, the refresh timer, I've given up on it for the time being. The idea is to run the fan periodically to recirculate stale air and rebalance temperatures in all the rooms, without running the compressor. In fact, the refresh cycle shouldn't run at all until at least an hour has passed without any other heat pump cycles running. I've tried a few arrangements of doubled-up delays and triggers, but none of them have worked. I think I'll have to add some code here, as well, just like the compressor cycle timer required. However, it's not a critical feature, so I'll just leave it alone for now.

Discussions