This project isn't FINISHED as such, but it's functional enough that it's reached a certain stasis where I don't have ENOUGH reason to do additional work. With one exception. The DS18B20 sensors I've been using for all the temperature measurements are, honestly, kinda bad.
- The resolution isn't awesome. 12 bit equates to .0625C, but the issue is they're still kinda noisy even down there. Or at least, they seem like it, even in water. I'm not super sure.
- The big one: they tend to fail. I'm just GUESSING I have counterfeit silicon, since I ordered them cheap from China. That might be part of the problem. But these guys have a tendency to just stop working correctly and fail CRC after maybe a few (6? 12?) months of usage.
Here's the real killer: the failure mode is VERY tricky.
The DS18B20 is a 1Wire sensor, and the readout time is relatively long in 12bit mode (~1s). I think these two factors conspire with the architecture of the linux kernel driver for 1Wire such that a CRC failure in 12 bit mode basically blocks whatever thread was trying to call the sensor for a full second. If you've got multiple sensors or a high read-rate, this can absolutely halt your application in its tracks.
In my case, if even one sensor fails, Node-Red basically grinds to a halt and debugging becomes a huge challenge. The real clue was `tail -f /var/log/syslog` which showed the repeated sensor failures. Remove all the sensors and reboot, and Node-Red is suddenly zippy again.
The solution, unfortunately complex as it is, is to use something besides the DS18B20, ideally something with better longevity.
I've had a handful of platinum RTD supplies on hand for a while to fix this issue. Luckily (pt. 1) one of those items is a MAX31865 RTD reader, and luckily (pt. 2) in the time since I last checked, "melvinrook" has created a MAX31865 RTD reader Node-RED node specifically targeting the raspberry pi.
Ultimately, my solution here needs to include multiple RTDs rather than just the one, AND I think I can do better than the MAX31865 for an application like reading a large body of water at a slow rate. But at least for now, the hot tub is working again.