Get tutorials Arduino Sensor Kit V1.0 for Arduino

Lesson 9 Infrared-Receiver


An infrared-receiver is a component that receives infrared signals and can independently receive infrared ray and output signals compatible with TTL level. It's similar with a normal plastic-packaged transistor in size and it is suitable for all kinds of infrared remote control and infrared transmission.



- 1 * SunFounder Uno board

- 1 * USB data cable

- 1 * Infrared-Receiver module

- 1 * Remote controller

- Several jumper wires

Experimental Principle

Control a certain key (for example, Power key) via a remote controller by programming. When you press the key, infrared rays will be emitted from the remote controller and received by the infrared receiver, and the LED on the SunFounder Uno board will light up.

Experimental Procedures

Step 1: Build the circuit

                          Infrared-Receiver Module            SunFounder Uno

                                       S ----------------------------------------D2

                                      -  -------------------------------------- GND

                                       + --------------------------------------- 5V

Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)

Step 3: Compile

Step 4: Upload the sketch to SunFounder Uno

Now, press Power on the remote control and the LED attached to pin 13 on the SunFounder Uno board will light up. If you press other keys, the LED will go out.

C Code

#include <IRremote.h>

const int irReceiverPin = 2;
const int ledPin = 13;

IRrecv irrecv(irReceiverPin);
decode_results results;

void setup()

void loop()
if (irrecv.decode(&results)) {
Serial.print("irCode: ");
Serial.print(results.value, HEX);
Serial.print(", bits: ");
if(results.value == 0xFFA25D)

Copyright © 2012 - 2016 SunFounder. All Rights Reserved.

Previous chapter: Lesson 8 Reed Switch

Next chapter: Lesson 10 Analog Temperature Sensor

Feb 02 2016 at 08:45 am

© Developed by CommerceLab