In this DIY guide, we will build a Wi-Fi-based IR controller to convert a traditional air conditioning system into a smart AC. By building this tiny controller, you will be able to control your traditional HVACs or air conditioner units using your smartphone with an intuitive climate control interface that allows you to turn the HVAC on/off and change the temperature, fan speed, modes, etc. with just a tap.

It also shows you the real-time temperature inside and outside the room from the ADC sensors installed in your AC unit. By making your traditional AC smart, you can conveniently control the AC unit, add automation, save energy, and increase its lifespan.

Things You Will need

  • Home Assistant set up on a Raspberry Pi
  • ESP8266 MCU, such as NodeMCU or D1 Mini; an ESP-01 will also work
  • 5mm 940nm IR transmitter LED
  • TSOP1738 or 1838 IR receiver
  • 2N2222 transistor
  • General PCB board
  • Soldering iron and solder

Step 1: Compile and Build the Firmware

To compile and build the firmware, you need to install the ESPHome add-on in Home Assistant. Then follow these steps:

  1. After installing the ESPHome add-on, go to Configuration > Add-ons, Backup & Supervisor, and click ESPHome. Makes sure to enable Start on Boot, Watchdog, Auto-Update, and Show on the sidebar.
  2. Click Open Web UI or ESPHome on the sidebar to launch it.
  3. Click +New Device > Continue.
  4. Type the firmware name, such as smartac, and click Next.
  5. Select ESP8266 from the options and click Next > Skip.
  6. Find and click on the EDIT button below smartac to open the smartac.yaml file in the editor and paste the following YAML code below captive_portal:
          status_led:
pin: GPIO4

remote_receiver:
id: rcvr
pin:
number: GPIO5
inverted: True
dump: all

remote_transmitter:
pin: GPIO14
carrier_duty_percent: 50%

climate:
- platform: climate_ir_lg
name: "AC"
header_high: 3265us
header_low: 9856us

edit compile flash the smart ac firmware

Now make the following changes in the code:

  • Enter your Wi-Fi SSID and password. For instance:
          wifi:
ssid: "MyWiFI Network Name"
password: "12345678"
  • Change the platform: coolix name in the code as per the AC model you have.
          climate:
- platform: coolix
name: "AC"

For instance, change to platform: lg for LG AC. You can refer to the IR Remote Climate documentation for more details.

After making the required changes, click Save and then click Install. Plug the NodeMCU or D1 Mini into your PC using a micro USB cable and select the Plug into this computer option. This will start compiling the firmware.

Once compiled, click Download. Save the downloaded smartac-factory.bin firmware file in the Desktop or Downloads folder.

Step 2: Flash the smartac-factory.bin Firmware

Once the firmware is downloaded, you may click Open ESPHome web and do the following:

  1. Click Connect and select the COM port.
  2. Click Choose File and select smartac-factory.bin firmware file,
  3. Click Install to flash the firmware.

After the firmware is flashed, the device should be online.

check smart ac is online if not reflash

Add IR Remote Climate Controls to Home Assistant

In the Home Assistant (HA), you can now add and control the wireless IR remote. The steps are as follows:

  1. Go to Configuration > Devices & Integration. You will see smartac auto-discovered by HA.
  2. Click Configure, select the Area, and click Submit.
  3. Under ESPHome, click smartac and then click 1 device.
  4. Click ADD TO DASHBOARD.
    add smart ac ir climate controller to home assistant
  5. Select the dashboard, click Next and then click ADD TO DASHBOARD.
    intuitive ac control panel convert traditional ac smart

This will add the smart AC controls on the dashboard. Next, you can connect the NodeMCU or D1 mini with the IR transmitter and receiver to start controlling your AC through your smartphone.

Connect MCU With IR Transmitter and Receiver Sensor

Refer to the following diagram to solder the IR LED, receiver sensor, and transistor on a PCB. If you've never soldered before, learn how to solder.

schematic diagram showing nodemcu connection with ir transmitter receiver sensor
  1. Connect or solder the negative (GND) IR transmitter LED terminal to the emitter of the 2N2222 transistor.
  2. Connect the positive IR transmitter LED terminal to 3.3V on NodeMCU or D1 Mini.
  3. Connect the base to GND on NodeMCU or D1 mini.
  4. Connect the collector pin of 2N2222 to the D5 pin on NodeMCU or D1Mini.
  5. Connect the IR receiver sensor's positive (Vcc) terminal to the 3.3V on NodeMCU or D1Mini.
  6. Connect the GND pin of the TSOP IR receiver to GND on NodeMCU or D1Mini.
  7. Connect the Data Out of the IR receiver sensor to the D1 pin on NodeMCU or D1 Mini.

You can use a berg strip and jumper wires to connect the IR transmitter and receiver Vcc, GND, and Data In/Out pins to the NodeMCU or D1 Mini.

smart wifi based ir remote control for ac hvacs

The result may not look good on the first attempt. However, you can improvise later. You can print a 3D case using a 3D printer to enclose all hardware. Alternatively, you may also buy a cheap IR blaster and flash the smartac-factory.bin firmware on it. Check out our complete guide to convert a cheap IR blaster and integrate it with Home Assistant.

Control Your Traditional HVAC Using the Home Assistant App

You may now connect the USB cable to the device to power it on and use the climate control component added to your Home Assistant dashboard to control your traditional HVAC wirelessly.

You may download and install the Home Assistant app on your iOS device or Android smartphone to control your HVACs, add automation, etc. For instance, you can set up an automation where the HVAC will turn on automatically when your presence is detected in the room and switch off as soon as you leave the room. For this, you can use an ESP32 board to build a presence detection sensor for HA, allowing you to trigger automation based on your presence.

Integrate With Apple HomeKit

If you own an iOS device (i.e. iPhone or iPad), you may also add this DIY smart IR climate controller to your HomeKit setup and control your HVACs using the HomeKit interface instead of Home Assistant.

The HomeKit UI is much more intuitive, and so recommended for iOS users. All you need to do is install HomeKit integration in Home Assistant to broadcast it as a HomeKit bridge; you can then control your smart devices in Home Assistant, including the IR AC controller, from the HomeKit app on iPhone or iPad.

Make Your Air Conditioning System Smart

By following this step-by-step guide, you will be able to create a Wi-Fi-based IR controller to make any standard AC system smart. You can then control your traditional HVACs or air conditioner units using your smartphone, to turn them on/off and change the temperature, fan speed, and more. This should help you save energy and stay cool this summer!