We all lose our remote controls—it’s just a fact of life. But, if you’re anything like me, there is one thing you always have within arms reach: your cell phone. For some reason, Apple hasn’t thought to put a 10 cent IR (infrared) LED and remote control app on the iPhone yet, but you can build the next best thing yourself right now.
That next best thing is to use a Raspberry Pi Zero W to make an IR blaster that you can control with a smartphone app. Most remote controls work by blinking an IR LED in a specific modulated pattern, and an IR blaster is just a stationary device that points at your TV and mimics the relevant patterns. Giving that capability to a Raspberry Pi is a startlingly simple matter of adding an IR LED and an IR receiver, along with a couple of resistors.
On the Raspberry Pi, the software side of things is handled with LIRC (Linux Infrared Remote Control). That handles both reading and recording signals picked up by the IR receiver, and modulation of the IR LED for controlling devices. All you have to do is push buttons on your original remote to record the signal for a function, and then you can save it to use from the Raspberry Pi as needed.
The final piece of the puzzle is controlling it all from your smartphone. For that, bbtinkerer created a Node.js program that runs on the Raspberry Pi and integrates with LIRC. The program creates a web page that contains different remotes, and all you have to do is setup some buttons and assign them to LIRC commands.