OCTOBER 7, 2019
7 min

Automatic AC system

An office in the attic of the old chocolate factory has a lot of benefits, nevertheless, a place like this could get hot on summer days. Air-conditioning (AC) can solve this problem, although in order to avoid unnecessary energy consumption (which contributes to global warming and costs us money) we want to turn the AC off when no one is in the office. This creates a new problem because people tend to forget about turning it off when they leave the office. 

Another issue, which led to a heated discussion, was about “what temperature should we set AC”. Different people have different temperature perception and preferences. Even on the International Space Station, there is a range of temperatures defined (yes, we checked that during the discussion). For sure it is an important issue too.

IMG_4494Our office

Problem

Making sure that AC is turned off and on when needed, the first problem we have attacked, could be solved in numerous ways. Setting a bunch of reminders or even building the app for this purpose was an option, but we knew that we could do better than that. We approached it the same way we approach our startups. We started with the problem and explored potential solutions before jumping into writing code and building an app.   

 

Define problem

First of all, we wanted to fully define and understand the issue. To do so, we brainstormed within the team to collect the requirements and state the problem. We ended up with the following problem statement:

Make sure that the AC in the polish office is on when needed and off when it is not needed.

And the following requirements:

AC should be `on` when

  • Anyone is in the office and
  • It is hot in the office

Moreover, we wanted to build a cost-effective solution.

The AC setup itself is composed from 5 AC split units in the whole office (4 in the open space and 1 in the conference room) and 1 central unit.

 

Solution

Divide into subproblems

After collecting the requirements we were able to think about the solution to the problem. As usual, the best approach was to divide it into technical subproblems:

  1. How to control AC units remotely?
  2. How to detect if anyone is in the office?
  3. How to combine information about presence with the additional information (e.g. weather forecast) in order to control the AC 

Attacking each subproblem we started with initial research to validate potential solutions and pick the one that met our criteria.

 

Remote AC control

For the first problem, we have defined that we want to be able to send a web request to control the AC split units that we have in the office.

 

Manufacturer’s solutions

We first researched the producer's website looking for a solution to AC remote control.  We found that WiFi connectivity is an option via a USB stick.

IMG_4495

AC split unit

This off the shelf solution had one potential flaw. Communication with the USB stick is done through the proprietary, closed protocol and we were unable to find any API exposed by the manufacturer’s Cloud. Moreover, the cost of a single USB stick was non-negligible.

 

Relays

An alternative approach was to use relays to directly cut off the AC units from power. Within the growing market of home automation products, it seemed like a great idea, however, as we are only renting the office, we did not want to interface that much with the building's infrastructure and were forced to abandon this idea.

 

Universal remote

Nevertheless, home automation was a good direction to search for the solution. Usually, we control the AC units using the infrared remote controls. Therefore, using a universal infrared remote that could learn commands seemed interesting. One of the cheapest universal remotes is the Broadlink RM mini3. It has a decent range and there are open-source libraries to control it via web requests. 

IMG_4493

RM mini3 and Raspberry Pi 4

Problem 2: Human detection

Human detection has numerous potential solutions described on the Internet. Some of them (such as the Pressure-sensitive floor tiles) we crossed out immediately as an overkill. Others (Acoustic sensors, Radar, Chemical sensors - detecting carbon dioxide mostly) we have eliminated after a bit longer consideration due to the different use cases and the environment we were operating in. For instance, chemical CO2 sensors work best in the closed, small rooms whereas we are looking for a solution for the entire open space. Similarly, Acoustics sensors can detect a human’s heartbeat although from initial research we were aware that this solution may be imprecise, especially with other people working on the floor below us. 

Finally, we ended up with the 3 solutions which were interest worthy:  

  • Image recognition of human shapes
  • Infrared detectors
  • Detection of mobile phone, computer, Bluetooth, or WiFi signals of a device assumed to be in the possession of a person in the office.

And we dug into further research in them to find the best for our case.

 

Image recognition of human shapes

Image recognition of human shapes seemed like the most interesting idea initially.

The concept was simple: We place a camera (or cameras) in the office and when they detect a human in the office we know that someone is inside. The performance of these algorithms has improved significantly in the recent few years with the introduction of the deep learning-based, already trained models such as R-CNN, SSD and YOLO (used widely in the autonomous cars) with superior performance over the traditional machine learning methods like HAAR or HOG.

Image recognition would have been an interesting area for us to learn more, although from the deployment perspective there would have been some challenges. We could place a single camera at the entry to the office, and based on the direction of the detected humans assess the number of people inside. This method due to the imperfect accuracy of the ML models seemed as not reliable enough.

An alternative approach was to place multiple cameras over the entire office and reason from multiple sources. Our office is not a typical open space office as there are multiple semi-opened cubicles and some walls which limit a direct line of sight. Thus we would need around 9 cameras to cover the entire space and we would end up with the significant cost of the entire installation. Moreover, any form of collecting and processing the video image of any office visitors may lead to some privacy concerns that we wanted to avoid. 

 

Infrared detectors

Infrared technology is an industry-standard for human detection in motion sensors. Sensors like this are based on passive infrared sensors. Passive infrared sensors (PIRs) detect infrared light radiated by hot objects (humans, other animals). In our case a system with PIRs would be similar to previously described cameras systems, although it would be simpler. There would be no need to add any machine learning algorithm and single-unit cost would be significantly reduced (both PIR sensors are cheaper than camera and processing unit could have less computing power). This option was good enough and we didn’t select it only because we have found a more suitable and cheaper solution.

 

Detection of the mobile phone, computer

Detecting people in the office by mobile phone and computer use made a lot of sense to us. To utilize this concept in practice we had considered different ways to monitor those peoples’ belongings.

Bluetooth was one option. We could put a few Bluetooth Low Energy beacons in the office and then create an app (or use some already made geofencing apps.) to detect enter and exit events. We were not sure if all of our employees would be happy to install this kind of app and if the technology would be reliable enough due to the mobile systems' privacy and power optimizations. Other option,  still, in the Bluetooth realm, we could also build a Bluetooth sniffer that would passively detect BLE phones as they continuously send some content through this medium. A downside is that this would require some reverse engineering of the communication protocols. Another downside is that we might pick up signals from the people working on the floor below.

An alternative to Bluetooth was WiFi. A similar WiFi sniffer was a first technical possibility although as we had admin access to our router we researched if we could read devices connected to it as it was a far more robust solution. We found that connecting to the office router through SSH allowed us to read a full list of connected devices. 

After excluding devices that are continuously connected to WiFi and clearly are not human assets like printers we end up with the list of “human” devices. If this list is empty we could assume that there is no one in the office and AC could be turned off. A clear advantage of this solution is its zero cost using the current infrastructure. A disadvantage is that for some people that are not connected to our WiFi (i.e. cleaning service) we would not detect their presence.

After factoring the advantages and disadvantages of each solution we have decided that human detection based on the list of connected to the router devices would be the best one for us. It is the cheapest solution while being reliable enough.

 

Combine it all together

The last step of our research and development process for this system was to build the selected solutions, combine them and utilize additional data in the control process.  

Thinking about the overall architecture of our system we wanted to place the entire logic of the control in a single central point with easy development and deployment process. The central point of our system was the web server which accepted information about connected devices and after applying control rules, exposed control commands for potential readers. Collecting information about the connected devices from routers and sending commands to the remotes were 2 separate and simple tasks that could be contained in a single logical unit and run on the Raspberry Pi (which was in the local network, that was of the requirements of the used solutions). Moreover, we have integrated the openweather free API to turn AC only when the forecasted temperature for the next 24 hours is above 22 degrees Celsius.

AC system

Block diagram of the combined system

Summary

Currently, the system is successfully operating in our office and right now we are collecting feedback from our users and adjusting the system accordingly. 

Solving problems like automatic AC control and similar smart office solutions is all about picking the right building blocks (which include both hardware solutions like the universal remote and software like web servers, external APIs and open source libraries) and joining them together. 

The research step, to answer what are the available options and why some solutions are better than the other, was a real value added to the product. 

The final outcome of the project is the working solution to our problem. AC is turned on/off automatically when it should. We took a step back, analyzed the problem roots and found a systematic solution that does not require any additional setup or onboarding to the app. The total cost clearly outweighs potential future costs for new employees. Moreover, we have significantly expanded our team knowledge in the fields of home automation and human detection.

Ok, so we have managed to solve the problem of turning off AC when it is not needed. What about the other issue that we had? The problem of setting the optimal temperature in the office seems to be more philosophical thus we have decided to handle it somehow later.

 

Sign up to our

Newsletter

Subscribe to get articles, guides, templates and event invites direct to your inbox once a month.

Top