Create a portable IR remote cloner and emulator with Arduino

If you have owned at least one device controllable through an IR remote, you have sure gone through a quite common problem. What to do when your remote is not within reach? Or when the batteries run out? Or when it breaks/gets lost? How to prevent the annoying ritual of having to stand up and control your device from its bulky physical buttons, or worse lose a way to control your device?

Universal IR remote cloners are becoming an increasingly common gadget in the arsenal of a geek, but some come with a high price tag or might not be as “universal” as they claim to be. So it may be time to build your own — and don’t worry, it won’t take long and it won’t cost you more than $25.

What do you need

  • An Arduino or compatible ATMEGA-based circuit. I’ve tested my code both on an original Arduino Uno and an Arduino Nano clone.
  • An infrared receiver and an emitter. You can get both for $2: Sparkfun has a good article on advised products and IR basics on Arduino if you’re interested.
  • A few push buttons.
  • A couple of LEDs, or an RGB LED, to notify the status of the remote.
  • A bunch of 10 kOhm resistors (one for each button) and 100/220 Ohm resistors (one for each LED).
  • A way to externally power your Arduino — 9V battery, power bank, lithium battery etc.
  • Breadboard and wires to plug your components together.

Wiring things up

  • Connect the buttons to the breadboard, connect one of their pins to ground through a 10 kOhm resistor, one to Vcc and the other to the Arduino as shown in the picture:

The code in this example assumes that you’ve got two buttons respectively connected to the Arduino pins 8 and 9, but you can easily change that.

  • Connect your IR receiver pins to Vcc, GND and to an Arduino digital pin (in our code we’ll assume that the receiver is connected to the pin 7), as shown in the picture:
  • Connect the IR sender to Arduino’s pin 3 (the pin number for the sender is currently hardcoded in the IRremote library) and to GND.
  • Connect your LED(s) to some of the Arduino’s remaining PWM pins. In this example we’ll assume that you’ll have a red LED connected to pin 5, a green one connected to pin 6 and a blue one connected to pin 10 (or an RGB LED connected to those ends).

Coding time

  • Compile the code and upload it to your Arduino board.
  • Open the serial monitor. If you press a button or the IR receiver detects a signal, and you’ve wired up everything correctly, then you should see a message on the serial monitor (and the LED(s) should turn on).
  • If you can see the messages on the serial monitor then it’s time to unplug the Arduino and connect it to your external power source.
  • In order to memorize a new IR code on your remote, just press the button on the original remote while keeping the button you want to associate to that command pressed on the breadboard. If a button already has a code stored, then keep it pressed for at least two seconds and then press the button on the original remote to overwrite it.
  • Test your new remote by pointing it to the device linked to your original remote and pressing the newly configured button. If everything went well, then pressing the button on your Arduino remote will have the same effect as pressing it on the original remote!

To do:

  • You may have noticed that the new commands are stored in the Arduino internal memory itself. That means that they will be erased when you reboot the board. This might be inconvenient as you’ll have to reconfigure the buttons every time you unplug the battery, but it can be improved by using an SD card module and storing the IR codes in a file.
  • There’s no limit to the amount of IR protocols out there. While I tried by best to make this tool as universal as possible, testing it with more exotic remotes might be a good idea.

Automation, IoT, programming, machine learning, science, math, economics and more. Powered by Fabio “BlackLight” Manganiello and Sneha Divakar.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store