Introduction: Controlling an Arduino Board Using an Infrared Remote Control

Hello everyone, my name is Noreddine Kessa, I am an electronics enthusiast.  I had fun this weekend playing with my new toy ,  Arduino ATmega328 DIY Kit that I got on eBay, and I would love to share the joy with everyone interested in learning about the subject. OK enough of that,  let us dive right in, my project is to remotely control three Digital channels using an infrared remote control,   basically I will show you how to use a remote control to control an Arduino board which in turn can be used to control a device,  a robot , or  some type of gadget that you wish to remotely  control.

II-Bill Of Materials

1X  Arduino board,
1X Computer Loaded with Arduino compiler (you can download it on (
1X USB cable
1X 9 Volt Power supply (optional, you can use you computer  USB as power source)
1X infrared remote control (Model : Car mp3)
3X  LEDs
3X 330 Ohm resistors
Connecting wires(as needed)
1X  infrared receiver (Model PNA4602 )
1X breadboard 
1X Multimeter(Optional)


Note: you can use any remote control or infrared receiver, I just listed what I used in this project
Step1: download the infrared library from (, and unzip it in the Arduino libraries folder
Note:  you may have to change line
in  the header file “Irremoteint.h”  .

Step 2: connect the IR receiver LEDs and instructed below, use picture for  reference
*************LEDs and resistors connections***************
a)connect the Cathode of all three LEDs to Arduino Ground
b)connect one end of resistor R1 to LED1 anode
c)connect the  other end of resistor R1 to pin 9 of the Arduino board
d)connect one end of resistor R2 to LED2 anode
e)connect the  other end of resistor R2 to pin 11 of the Arduino board
f)connect one end of resistor R3 to LED3 anode
g)connect the  other end of resistor R3 to pin 12 of the Arduino board 
*************Infrared receiver connections***************
  h)connect pin 1 of the IR receiver to 5Volt supply from the Arduino board
  i)connect pin 2 of the IR receiver to ground of the Arduino board
  j)connect pin 3 of the IR receiver to pin  10 of the Arduino board
Step 3: connect the Computer to the Arduino board using a USB cable.
Step 3: 
a) open Arduino Compiler
b) start a new project
c) copy the source code at the end of this tutorial to the compiler editor, then upload the program to the Arduino board
Step4: now you are ready to test your project
a) use button 1 to turn LED1 on
b) use button 2 to turn LED2 on
c) use button 3 to turn LED3 on
d) use button 4 to turn LED1 off  
e) use button 5 to turn LED2 off
f) use button 6 to turn LED3 off
g) use button 7 for all three LEDs to flash on and off

I hope you enjoyed my tutorial. you are free to modify the code as you wish for your personal application.

/*****************Code Starts Here***********************

Author: Noreddine Kessa
Date : 15 jan 2012
Project: Infrared program arduino board:
Purpose: Controle an arduino IO board using a remote control.


#define button1 16724175
#define button2 16718055
#define button3 16743045
#define button4 16716015
#define button5 16726215
#define button6 16734885
#define button7 16728765
#define button8 16730805
#define LED1  11
#define LED2  12
#define LED3  9
#define RECV_PIN  10
#define del 50
#define flashNumber 100

int times ;
IRrecv irrecv(RECV_PIN);
decode_results results;
long lReceived = 0 ;

void setup()
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(RECV_PIN , INPUT);

  irrecv.enableIRIn(); // Start the receiver


void loop() {
  if (irrecv.decode(&results)) {
    lReceived = results.value ;
      switch (lReceived) {
    case button1:
      digitalWrite (LED1, HIGH);
    case button4:
       digitalWrite(LED1, LOW);
    case button2:
      digitalWrite( LED2, HIGH);
    case button5:
       digitalWrite(LED2, LOW);
    case button3:
      digitalWrite (LED3, HIGH);
    case button6:
       digitalWrite(LED3, LOW);
     case button7:
       times = flashNumber;
flash :

       digitalWrite (LED1, LOW);
       digitalWrite (LED2, LOW);
       digitalWrite (LED3, LOW);
        if (!(times--))
         goto brk ;

       digitalWrite (LED1, HIGH);
       digitalWrite (LED1, LOW);
       digitalWrite (LED2, HIGH);
       digitalWrite (LED2, LOW);
       digitalWrite (LED3, HIGH);
       goto flash ;

    irrecv.resume(); // Receive the next value
//*****************Code Ends  Here***********************

Arduino Challenge

Participated in the
Arduino Challenge