Arduino Infrared Receiver

by Miguel on July 10, 2011

in Arduino

an Arduino, remote control, and infrared sensor circuit

What Our Circuit Will Do

The circuit will detect when a button, any button, from a remote control is pressed and let us know through the serial port.

Parts Required

I used:

infrared receiver circuit

Infrared part of the circuit

The circuit was pretty easy to set up, I just followed the receiver’s datasheet. The schematic is below.
infra red receiver circuit schematic

infrared receiver circuit schematic

How The Infrared Receiver Works

The pictures below were taken with an oscilloscope, they are the output of the receiver.

The output of the receiver is normally approximately 5 volts.

ir receiver signal as seen in oscilloscope

The receiver's output when no IR signal is present. Approximately 5V.

If an infrared signal is present the output is 0v, each remote key makes the IR light in the remove turn on and off producing a square wave at the output of the receiver diode.

square wave in oscilloscope

Output signal from receiver diode. This was one push of the power button in my remote.

Next is a close up of the signal above.

infrared signal close up  in oscilloscope

close up of infrared signal from remote produced by the receiver diode.

Infra Red Receiver Code

We won’t be differentiating between signals from each remote key, instead we just want to know when a button is pressed. Since the signal is normally 5v (HIGH), when a button is pressed the signal changes to 0V (LOW), since each key produces several ups and downs we are going to wait for about 50ms (your remote might need more, just test different values) so that we let the signal rest back up to HIGH again.

int irPin=2;

void setup()

void loop()

     //button pressed 
     Serial.println("You pressed a button");

This is what you should get from the serial monitor every time you press a key in your remote.

arduino serial screen

Arduino screenshot of serial monitor output.

What are you planning to do with infrared? leave your comments or questions below.

Previous post:

Next post: