Raspberry Pi HVAC and Equipment Controls Data Logger and Troubleshooter

I created the Raspberry Pi Building Controls Data Logger and Troubleshooting Tool because of how often I was asked to troubleshoot equipment that failed only when no one was watching, or when I couldn’t be on-site. This obviously makes it difficult to determine the cause and can lead to best-guess parts swapping and repeated callbacks. I wrote the software in C++.



With my logger, I can alligator clip or screw leads onto terminals I want to monitor and see a second-by-second log of what switches are making or opening and some sensor points. Even better – I can send a coworker off with it and help them troubleshoot without ever setting foot on the site. Either way, you can watch events happen in real-time or view the log later, both either at the device or remotely. I imagine a beautiful world where my employer (maybe every manufacturer!) installs a quick-connect harness on every new unit we get (It’s a large research university – we have THOUSANDS of heat pumps, rooftops, boilers, pump system controllers, etc) and any of even our less skilled techs can simply plug in the harness, turn the logger on and I can tell them where to look in an instant from anywhere – preferably a beach. Even better, if we install harnesses on units that are still working correctly, I can write a program that learns the proper order of operations for each unit…then the logger can identify deviations and troubleshoot on it’s own. I’m not sure how to profit off of this yet…

More info below the video




Found an old case and a screwed a bunch of relays and a Raspberry Pi Zero W to a very hi-tech piece of wood. Made a little board for plugging the DS18B20 temperature sensors and in case I wanted to add blinkies and widgets. (I had considered a bank of LEDs that would “replay” the logged events – until I decided to just include a monitor and keyboard). Put a universal laptop power supply in the bottom to power the 12 monitor (and car backup camera display that I had laying around) and the 5v USB supply for the little computer. Now it’s as easy as plugging it into the wall without needing separate power supplies. The position of the relays are read with the raspberry pi GPIO pins, and I added a software function to debounce the relay chatter (the pi will read like 15 events if I don’t add this).

Currently, I’ve only got 8 inputs plus two temperature sensors. I wanted to shake out the proof of concept before I went all-in. Also, the inputs are currently mechanical relays – kind of caveman-ish, but I had bunches of them handy in the man cave and when I want to build, I want to build. Another shortcoming is they are 24 volt relays and so far I can’t use it on our boiler or a lot of other equipment with 120v controls. ( I thought I’d add 120 volt relays side-by-side – you can see the one I added – but it seems silly to waste so much space when more-reliable optoisolators are readily available and cheap. I have ordered a bunch and now just have to find time to put them in place and come up with a clever automatic voltage-selecting circuit so the device automatically switches whether it’s looking at 24v or 120v points because I’d inevitably forget to switch by hand someday and the smoke would come out.)

Coming soon – 16 inputs, the two temperature sensors, 3 current sensors, and hopefully a couple pressure sensors if I can find some affordable ones. And mass-producing harnesses with quick-connects that I can leave in equipment – so future visits are as easy as plugging in.

Another detail I’m not thrilled with is the clunky user-interface. Can you tell I’m not much of a graphics guy? I’ve always said I know how to make things work – not make them pretty. Still true with software… Although I think I know how to operate through an HTML page – that would be an improvement, but this is also an excuse to learn completely new tricks with maybe java. Making the output easier on the eyes would be pretty great – along with the ability for the user to “name” each point, so instead of trying to remember “r1 was w1, and r2 was the gas valve…or wait, was that r4?” it’ll simply have a label at the top W1, W2, Draft proof, etc…




So I took her out for a trial run on a rooftop Heating and Cooling unit that the operator kept finding locked out, but never witnessed it fail. I did a quick once-over and found it was indeed locking out, but the board did not specify for what (blinking an error code of “locked out” – thanks, Carrier). I quickly spotted very loose blower belts (all too common around here – as the guys doing PMs like to make it easy to slip belts on an off without tools….sigh) and told the operator that he needed to tighten them because, without adequate airflow, the unit was likely tripping on high-temperature limit. He insisted “they aren’t THAT loose” no matter how I tried to convince him otherwise. (I’ll post a short video I took shortly). Fine, dude – I need an excuse to try out my new toy anyway. I wired up my harness and put a temp sensor right by the limit switch. Reset the unit and made sure things were logging. Then went about my business for the day. The logs I gathered the next morning were pretty clear – the unit fired as expected and the discharge temperature slowly rose until the limit switch opened up at 162 degrees. A little higher that I’d have expected, but I didn’t check the label so maybe that’s what it was set for. The unit had a good looking flame so I was absolutely convinced that it was an airflow problem.  The guy still wanted to hem and haw about belt tightness, so I got out a tachometer and measured motor and fan rpms, and did some quick math showing him that he was only pushing 60% of the air that he should be.
The Bonus:

The most satisfying part for me was the logger showing me something I probably would have missed without it – the limit switch was resetting before the unit could cool off. Even if it was designed to trip at 160ish degrees, it shouldn’t close again until the unit had cooled off by 30-40 degrees or so. Indeed, I did some checking and the limit switch should have been an “open at 140, close at 100.” So bingo, the unit was locking out quickly because the limit switch was allowing rapid resetting.  I changed the limit switch, the operator relented and tightened his belts,  I showed him the increase in RPMs/airflow, and the unit has run happily ever after.



3 thoughts on “Raspberry Pi HVAC and Equipment Controls Data Logger and Troubleshooter

  1. Lochana Kollure says:

    Hello, This is very good. I’m a mechanical engineer looking for a way to use a raspberry pi to build a low cost temperature and humidity data logger with C++ for my project. Can you pls. advice me as to where to start? A tutorial I can follow so that I’ll get this done ASAP. I have never used a raspberry pi. But, I have learnt and coded in C, C++, python and Matlab during various stages of my academic career but didn’t use them afterwards. Now I’m reviving my C++ as I need it for CFD. So I’m trying to use the same to build this data logger for my project. Thanks for an advice.


  2. lbrombach says:

    Hi, I recommend you browse the raspberrypi.org forums – there is no shortage of the type of project you are looking for. What I’ve done won’t be of much help because I use the ds18b20 temp sensor, but that does not have a humidity sensor that wroks with that protocol (and honestly the code was awful from my early coding days). I will suggest that the DHT22 (combined temp and humidity sensor) has a better reputation than the slighty cheaper DHT11, so for better accuracy it will be well worth a few extra bucks. Although you’ll likely find some examples with code done for you, if you have a choice of GPIO library I am rather partial to the pigpio library. Wiring Pi remains popular but has been deprecated, and bugs pop up as new version of the Pi rolls out and the original developer no longer updates it. Best of luck!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s