A simple Air Conditioner Controller using Linux

I wanted to have a way to turn off the aircon in a server/printer room remotely using a Web Application and/or an executable via ssh and bash.

I had to find a way to interact with the air conditioner via some device connected to a server (CentOS) so I could turn off/on the air conditioner via a daemon and/or via a web application.

I searched the Internet and found a device that did not need any special drivers. The drivers needed to interact with the device are already part of any modern Linux system as the device uses the Standard FTDI USB module and those drivers (ftdi_sio.ko) are already part of any Linuxkernel.

Super4 USB Relay Module #16730

d_1112See (2021, changed) link at: https://sigma-shop.com/product/205/usb-relay-controller-four-channel-box-with-clips-for-din-mount-rail.html

The orginal board I cannot find anymore, the one above has the same features – just looks different.

USB hub powered, modular relay control board.
Relays (4 x):   5 Amp 30VDC, 5Amp 250V AC

Sealed omron mechanical relays
Command-line application
Standard FTDI USB module (dlls for most OSs)
Power on LED, relay indicator LEDs

The super4 USB relay board is driven over USB directly (not virtual com port). Each board is uniquely identified via its’ serial number string, this can be changed using TCTECs RelayMapper application, making replacement of boards easy and programming simple to understand.

The link aboce contains:

The web pages have all you need to get this thing to work.
There is no need for me to go into detail here, as the webpage above explains everything in very good detail.

You can have multiple controllers, each controller is identified by a unique string, so you can have as many USB boards as you like.

Connection to the Air Conditioner

IMG_20150617_184836This was quite easy. If you dismantle a remote control for air conditioners you see that they are rather simple circuit boards and the biggest part is the area for button control – human hands are “big”, so they need “large” buttons. What those button do in those remote controls they bridge two electrical connectors, once bridged the air conditioner is turned on, bridged again it is turned off.

So all I had to do it dismantle the remote control, find the two connectors that are responsible to turn on/off the air conditioner and solder a pair of rs232 cable (telephone cable works as well) to the back of the remote control circuit board.

After putting it all together I had to position the remote control in a way that it would point the infra red beam correctly at the air conditioner – the setup is shown in the image on the right.

It is really simple to do, one can test the function by touching the other side of the two cable together.

 

Connection to the Server

IMG_20150617_184759All I had to do is to connect the USB relay module to the Server, setup is on the right, lid taken off.
The box is located within one of the cabinets.

As soon as one connects the USB cable to the server, the kernel will load the required USB drivers but also load the ftdi_sio.ko, this even works after a reboot, there is nothing required to get this to work (at least on my CentOS server, your mileage may vary).

The board shown controls a few extra things other than the aircon:

  1. A couple of extra fans
  2. Lights
  3. and off course the air conditioner

On the bottom right is the USB cable that connects to one of the server within the cabinet.

The program described above is located on that server, too. So there are two option to interact with the USB board, command line and web interface.

 

Web Application

webappThe web application tells me whether the aircon is running (besides some other information).

It also allows me to turn off/on a large amount of “stuff” (not shown), but it allows me to turn on/off the air conditioner.

Although the cameras in the room have InfraRed, sometimes it is nice to check the room with lights on, so you can see things in color.
The “Toggle Light” allows me to do that.

 

I have shown that it is possible to control an air conditioner with little effort using a Linux system.

Let good coding be with you.

Leave a Comment

Your email address will not be published. Required fields are marked *

You must tick the checkbox for 'I am not a robot' before you can submit your comment!