Raspberry Pi Zero remote for my air conditioner

This is essentially a reboot of a project I did many years ago.

I have a window air conditioner unit, with a remote control. This remote allows you to control the unit within line of sight. Neat, but still inconvenient when you need to go into the bedroom to pre-cool the room with the AC before going to bed.

My AC unit does not have fancy features like integration with Alexa/Google/etc. and frankly I can’t justify the price bump. In this post, I will be using a Raspberry Pi Zero W and a few IC parts to build a (better?)remote control device over WiFi.

Raspberry Pi Zero W IR remote!


The circuit board

I’ll be using the following:

All components

  1. Raspberry Pi Zero W - RPiZW has WiFi support, and it is important for this project!
  2. 10KΩ resistor - this was a spare part, left over from the last time I built this.
  3. 330Ω resistor - this was a spare part, left over from the last time I built this.
  4. 2N222a transistor - this was a spare part, left over from the last time I built this.
  5. IR LED
  6. IR Receiver
  7. PCB board
  8. Camera for Raspberry Pi Zero - [OPTIONAL] I had a spare camera module lying around

…and I’m going to solder all the pins because, well, soldering is fun.

Built the following circuit for IR-LED.

Circuit diagram

PWR(5V) -> IR Receiver(Vcc)
GND -> IR Receiver(Gnd)
GPIO(23) -> IR Receiver(Out)

PWR(5V) -> R(330Ω)
R(330Ω) -> IR LED(+)
IR LED(-) -> NPN(Collector)
NPN(Base) -> R(10KΩ)
GPIO(24) -> NPN(Emitter)

The Soldered board

Parts on breadboard

All assembled

All assembled

Side view of assembly

Top view of assembly


Raspbian setup

With the latest Raspbian software(Raspbian GNU/Linux 10 (buster)), the recommended module to handle IR signal is gpio-ir instead of LIRC.

the following lines are added in /boot/config.txt;


Install ir-keytable package

So, the following package is installed(ir-keytable);

sudo apt install ir-keytable

At this point, let’s do a full reboot;

sudo shutdown -r now

This should have created the following files;

$ ls -l /dev/lirc*
crw-rw---- 1 root video 251, 0 Aug 22 17:20 /dev/lirc0
crw-rw---- 1 root video 251, 1 Aug 22 17:20 /dev/lirc1

With ir-keytable package, we also get the ir-ctl command, which we will be using. Air conditioner remotes are abit unique and funky, so the plan is to record the signals sent from the remote through the IR receiver and play it back through the IR LED on demand.

For additional info;

$ ir-ctl -f
Receive features /dev/lirc0:
 - Device cannot receive
Send features /dev/lirc0:
 - Device can send raw IR
 - IR scancode encoder
 - Set carrier
 - Set duty cycle

This tells me that ir-ctl will use /dev/lirc0 by default, and it is the IR LED.

$ ir-ctl -d /dev/lirc1 -f
Receive features /dev/lirc1:
 - Device can receive raw IR
 - Can report decoded scancodes and protocol
 - Can set receiving timeout min:1 microseconds max:1250000 microseconds
Send features /dev/lirc1:
 - Device cannot send

This tells me that /dev/lirc1 is the LED receiver.

Record signals from remote

sudo ir-ctl -d /dev/lirc1 -rac_on -v

This will read the pulse and space data from the remote to the ac_on file.

The -v parameter will also dump it to the console, so you can see the signal.
The -d parameter tells ir-ctl command use /dev/lirc1 to read.

Press the power button exactly once, then exit by pressing CTRL+C on the keyboard.

NOTE : it might be tempting to use -1 to record one button, but that results in a partial pulse and space sequence.

NOTE : My air conditioner appears to have a different signal for power on and power off. My remote does seem to know if the AC is powered on or not, the menu options on the display shows options when it’s on and when it’s off. This is different from my older air conditioner, which has a simple remote and power on and power off are the same signal!

So I’ve saved ac_on and ac_off files. Upon testing, the ac_on will always signal my AC to the power on state, and ac_off will only signal the AC to the power off state. Sending multiple ac_on after the initial one will not toggle the power state of my AC! This means I need to be aware of the state of the appliance as I will need to send a different signal.


This actually makes for the second raspberry pi zero based remote control. The other one is based on Raspbian Jessie and LIRC, and it workds just fine on an old, simple AC.

This AC has remote-sensing features, more complicated functionality and is newer. The operation wasn’t as smooth as the other remote, and I suspect that measures will need to be taken to ensure the AC is really on or off as commanded.

💻Software Engineer 🤖Technophile