Cool Stuff
February 23, 2024

Boost office efficiency with smart HVAC automation

Written by
Steve Briskin
Director of Engineering

How smart monitoring and automation across our office HVAC systems reduced energy usage and led to thermostatic peace.

In every office there are disagreements about temperature. On any given day in our office, we had people complaining about the temperature in their seating areas and meeting rooms. Our office manager stated that any action we were going to take needed to be backed by data, so we decided to embrace one of our company values to “act decisively” and use the Viam MicroRDK (viam-server for the esp32) to start collecting temperature data across the office. 

Using Viam’s Data Management and recently released Queryable Data Service, we came to realize that our office had a much bigger problem than we expected.

Data collection and dashboarding revealed a “saw-tooth” pattern of heating and cooling.

Data from across the office

We knew that our office seemed to have varying temperatures in different areas, so we wanted a simple and cost effective solution to start collecting data in a number of these areas. Using a mix of esp32-wrover-e and esp32-wrover-ie models attached to TMP36 analog temperature sensors, we configured the hardware through the Viam app, which allowed us to start testing without writing any code.

Once we tested the sensors and knew they were all working, we deployed a small script to collect data from each sensor on a regular basis. The code runs as a Google Cloud Function on a 5 minute interval. All ESP32s are configured as parts of a single Viam machine, which allows us to use one secure connection and API to collect temperature from all devices and send that data to the Viam Data Management service.

The reveal

Now that we were collecting data, we started looking for patterns. We decided to use the newly released Queryable Data feature with Grafana cloud to create a dashboard without adding any additional infrastructure (you can read how we did this in a guide here).

The data initially provided proof that our office did in fact have a wide range of temperatures - at any given time the temperature was as low as 21C (69F) in one area and 31C (88F) in another area. No wonder some folks were happy and others were blazing.

This gave us the knowledge we needed to make some adjustments, after which the range was narrowed (now between 21°C and 26°C). However, we noticed a curious “sawtooth” pattern arising, with drastic peaks and valleys unlike one would normally expect.

Further sleuthing revealed that our office in fact has 2 independent heating/cooling systems – one controlled by the building and one by us. On a typical 36F (2°C) NYC winter day, the building system heats the office to ~79°F (26°C) and our AC unit cools it down to 74°F (23°C). We could not change or fully disable the building system, and 26°C is too warm for most. The polar bears are crying.  

Could we automate this problem away?

Automating manual switches

The office HVAC system incorporates manual slide switches for turning zones of the system on and off. We realized that if we could automate the actuation of these switches, we could gain control over the system and interoperate it successfully with the system we fully control. 

To actuate this switches, we developed custom hardware that could be mounted to HVAC panels, comprised of: 

  • Raspberry Pi 4 running viam-server
  • 3D printed gantry for traversing the HVAC
  • Limit switches to indicate on/off
  • Small DC motor and a simple controller
  • Chassis that incorporates the electronics and can be mounted to the HVAC system using locking screws
The key components in the custom HVAC control system

We then developed a small code module that receives an on/off command and actuates the gantry system accordingly to adjust the slide switch until the corresponding limit switch is actuated. 

Finally, we needed a way to call these now “smart” switches to turn them on and off. We opted to use Google Cloud Functions again so as to avoid additional infrastructure. The logic is simple:

  • A configuration maps HVAC units and temperature sensors to zones
  • The script runs once an hour (can be as frequent as we want). This is orchestrated by Google Cloud Scheduler and Google Cloud Functions.
  • The script queries the data service for an average of temperature readings over the last hour for the zone. We use the MQL interface for this.
  • The HVAC unit (which is hardwired in heating mode right now) is turned on/off based on whether the average temp is above or below the desired zone temperature.

Interoperability

In the end, this turned out to be a story about interoperability and harmony:

  • Our two HVAC systems now work together in a way that keeps us comfortable and is more in balance with the environment.
  • Our employees no longer are fighting about which areas of the office are freezing and which are sauna-like.
  • Even our office manager Kristina is at peace, therefore we are all at peace.

This is made possible with a mix of technologies: microcontrollers, single board computers, different programming languages and cloud technologies, all working together without much complexity thanks to the Viam platform.

Ready to start building with Viam? Explore some starter DIY home automation projects, or go more niche and build your own smart security system.

On this page

Get started with Viam today!