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.
The circuit board
I’ll be using the following:
- Raspberry Pi Zero W - RPiZW has WiFi support, and it is important for this project!
- 10KΩ resistor - this was a spare part, left over from the last time I built this.
- 330Ω resistor - this was a spare part, left over from the last time I built this.
- 2N222a transistor - this was a spare part, left over from the last time I built this.
- IR LED
- IR Receiver
- PCB board
- 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.
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
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
So, the following package is installed(
At this point, let’s do a full reboot;
This should have created the following files;
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;
This tells me that
ir-ctl will use
/dev/lirc0 by default, and it is the IR LED.
This tells me that
/dev/lirc1 is the LED receiver.
Record signals from remote
This will read the pulse and space data from the remote to the
-v parameter will also dump it to the console, so you can see the signal.
-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_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.