Close

April 30, 2018

Learn: Control a Circuit with an IR Remote Control

OVERVIEW

Adding an infrared (IR) receiver to a circuit lets you control the circuit with an IR remote control.

 

PART 1: TESTING THE IR RECEIVER

STEP 1: Assemble this circuit.

 

STEP 2: Point a regular TV remote control at the IR receiver. Press any button on the TV remote control and the LED on the breadboard should blink.

 


MODULATED IR

The IR receiver has a demodulator inside that only looks for modulated signal at 38kHz. Since the IR receiver is tuned to a 38kHz signal, it will not be affected by ambient IR. Therefore, the communication path has a greater range.


 

PART 2: CAPTURE THE CODE FROM AN IR REMOTE CONTROL

STEP 1: Assemble this circuit.

 

STEP 2: Install the IRremote library.

  1. Download IRremote.zip (Ken Shirriff’s IR library) from https://github.com/z3t0/Arduino-IRremote/releases.
  2. Unzip the file and copy the IRremote folder to the Arduino libraries directory (default location c:/Program Files/Arduino/libraries or c:/Program Files (x86)/Arduino/libraries).
  3. Delete the RobotIRremote folder in the Arduino libraries directory. The library RobotIRremote has similar definitions to IRremote and causes errors.

 

STEP 3: Upload the program to Arduino.

  1. Restart the Arduino IDE.
  2. Upload the sketch at File > Examples > IRremote > IRrecvDemo to Arduino.
  3. Open the Serial Monitor.
  4. Point the TV remote control at the IR receiver. Press a few buttons and see how the hexadecimal (HEX) code changes in the Serial Monitor. In this example, button 1 generates the hex code E6F04469, and button 2 generates 396E315D.

 

PART 3: CONTROL A CIRCUIT WITH AN IR REMOTE CONTROL

Let’s create a circuit that lets you control a tri-colour LED using the TV remote control.

STEP 1: Add a tri-colour LED and resistors to the circuit from Part 2.

 

STEP 2: Modify and upload this sketch to Arduino.

When you press button 1 (generating the hex code E6F04469), pin 7 turns ON. When you press button 2 (with the hex code 396E315D), pin 7 turns OFF.

 

STEP 3: Modify the program further to control each colour of the tri-colour LED as follows.

Arduino Pin ON OFF
7 Button 1 Button 4
8 Button 2 Button 5
9 Button 3 Button 6

 

 


UNIVERSAL REMOTE CONTROL

You can record any signal of any IR remote control. Then, you can playback the code using your computer’s keyboard.

STEP 1: Refer to the circuit from Part 1.

STEP 2: Capture the IR signal from a remote control using your IR receiver to determine the code used. Then from your computer’s keyboard, playback the same code using the IR LED.

STEP 3: Try out the program File > Examples > IRremote > IRrecord to see how this concept works.

 

You can also create a universal remote control called TV-B-Gone that turns off almost any TV. Find out more from Learn: Infrared TX and RX.


 

 

Leave a Reply

Your email address will not be published. Required fields are marked *