Introduction: IR Receiver Light Control

If you're just beginning to learn how to use an IR Receiver, and figuring out how the component works, this is the perfect project to start off with! Before you jump into this project make sure you have downloaded the IR receiver library found under Tools << Manage Libraries.

Supplies

  • 3 different coloured LEDS
  • IR Receiver
  • Remote (A T.V remote would work)
  • Jumper Wires
  • 3 1K resistors
  • Breadboard

Step 1: Step 1: Receive HEX Code

Depending on which remote is used the HEX codes for each remote is different. In order for the IR receiver to recognize the remote controls that are pressed, the HEX codes need to be identified and stored within the code.

Here is the code to receive the HEX code for each control. You want to record 5 buttons from your remote including an OFF and ON button.

#include

const int RECV_PIN = 7;

IRrecv irrecv(RECV_PIN); decode_results results;

void setup(){

Serial.begin(9600); irrecv.enableIRIn(); irrecv.blink13(true); }

void loop(){

if (irrecv.decode(&results)){

Serial.println(results.value, HEX);

irrecv.resume(); } }

Step 2: Step 2: Setup IR Reciver

Now it's time to setup the components on the breadboard. Start off by assembling the IR receiver.

There are 3 legs on the IR receiver. The leg on the far right is VCC (power), the leg on the far left if OUT (connect to a pin), and the middle leg is for GND.

  • Connect the VCC to the power rail on the breadboard
  • Connect the OUT pin to 11 on the Arduino
  • Connect the GND pin to the ground rail on the breadboard

Step 3: Step 3: Connect LEDS

  • Connect the short leg of all the LEDs to a 1 K ohm resistor which then connects to power
  • Connect the blue LED's long leg to pin 5 on the Arduino
  • Connect the red LED's long leg to pin 3 on the Arduino
  • Connect the green LED's long leg to pin 6 on the Arduino

Step 4: Step 4: the Code

Here is the Code:

Be sure to change each buttons HEX code to the designated HEX code for the remote that is being used.