Home Sensor Projects Infrared receiver example

Infrared receiver example

by shedboy71

In this example we look at how to connect an IR Reciever. Generally, they require Vcc(5v), GND and there is a data out which you connect to your Arduino. Here is a typical IR showing the pinout. The Infrared Receiver is used to receive infrared signals and also used for remote control detection. There is an IR detector on the Infrared Receiver which is used to get the infrared light emitted by the Infrared Emitter. The IR detector have a demodulator inside that looks for modulated IR at 38 KHz

IR-example

There are many breakouts that make it easier to use these

You’ll need the IR Remote library, you can get this from : https://github.com/shirriff/Arduino-IRremote

Download and import or copy into your Arduino -> Library folder. As usual this library will be doing most of the work making it easier for ourselves.

Code

#include <IRremote.h>
 
int RECV_PIN = 3;
 
IRrecv irrecv(RECV_PIN);
 
decode_results results;
 
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
 
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);
irrecv.resume();
}
}

 
Testing

I opened the serial monitor and pressed the keys from 0 to 9 here is what was displayed

FF30CF
FF18E7
FF7A85
FF10EF
FF38C7
FF5AA5
FF42BD
FF4AB5
FF52AD
FF6897

As you can see with a bit of programming we can take these values and put them to use.

 

Links

Infrared reciever on Amazon UK

Infrared reciever at Amazon

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More