Controlling your Arduino Project with a Standard Remote Control

In this tutorial we will focus on using an infra-red receiver and an Arduino micro-controller to receive signals from any infra-red remote (such as your television remote). We can then program the Arduino to react in unique ways to specific button presses, such as turning on an LED.

Step 1 – Setting up the Arduino: First, we need to connect the infra-red sensor to the Arduino so that it is ready to receive IR signals from your remote. To do this, connect the left leg of your sensor to a digital pin (in this case we are using 11), the middle leg to ground and the right leg to +5V.

Step 2 – Finding the IR values of your remote: This tutorial is assuming you are a least a little familiar with Arduino and have set up the environment (if not, view this previous tutorial). Now we need to find a way to decode the IR signals with our sensor. In order for the sensor to change the light it is receiving into a usable number, we need to measure the pulse of the light. The easiest way to do this is to download a pre-made external library for Arduino here. To install the library, all you need to do is move the unzipped IRremote directory to your Arduino libraries folder (where you first installed the Arduino IDE).

Now that we have our library, we can open Arduino. I have provided the basic code below that we will use to get our values below, with explaining comments:

Now we can begin to get IR values from our remote. First, upload the sketch to your Arduino. Next open the Serial Monitor:

Now, aim your remote control at the sensor and press a button. You should see a decimal value appear on your serial monitor.

Press the same button a few times to make sure the same value repeats itself. The value itself may look like gibberish, but be sure to make note of it (write it down!).

Many times a remote button will have multiple functions (such as with a universal remote) and will give off multiple values, so it’s easiest if you stick with a button that consistently shows one value in the serial monitor.

Step 3 – Using our IR receiver values to turn on an LED: Once you’ve found the values of your remote control buttons that you wish to use in your project, the world is your oyster! In this tutorial we will use turning an LED on and off as an example, but you can use the IR signals however you wish!

First we must set up our LED circuit alongside our IR receiver, by connecting an LED to our breadboard. In this case the output of the LED should be connected to pin 6 (using the resistor!) and the ground to the ground rail. Note that we have modified our previous circuit to have a common ground and power.

Now we can modify our code to use the inputted remote IR values to turn the LED on and off. Using the value we made note of in the previous step, we can write a simple if statement to turn on the LED if that value is read. See the code below with changes highlighted, and note the comments for a description. Make sure you use the value you found in the second step!

Now if we upload this sketch, we can use our remote to turn on the LED! Make sure you use the value related to the button you pressed. If the LED does not turn on, first check your serial monitor again to make sure the value matches the value in your if statement, then check your circuit wiring.

Conclusion – Applying our IR receiver values to other projects:

With this tutorial we learned the basics of using infra-red receiver sensors with Arduino micro-controllers. Once you understand how to use the IR values to turn on an LED, you can apply it to your own projects. It does not need to be limited to turning things on or off either. For example, you could create a light sculpture with RGB LEDs and use the remote to choose the light color, or use it as a dimmer, etc.

You can program the Arduino to use the remote control buttons however you wish!