Home » ESP32 and Infrared receiver example

ESP32 and 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.

I managed to get mine working just fine with the 3.3v from the ESP32 board

Many electronic shops online stock breakouts for these. Here is a picture of the remote control that I used for testing, there are many variants of these available

 

Layout

 

Code

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.

[cpp]
#include <IRremote.h>

int RECV_PIN = 15;

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();
}
}
[/cpp]

Testing

I opened the serial monitor and pressed various keys on my remote here is what was displayed

FFA25D
FFFFFFFF
FFE21D
FF22DD
FFFFFFFF
FF02FD
FFFFFFFF
FFC23D
F076C13B
FFFFFFFF
FFA857
FF906F
FFFFFFFF
FF6897
FFFFFFFF
FFFFFFFF
FF9867
FFFFFFFF
FFB04F
FFFFFFFF
FF30CF

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

 

Links

TL1838 VS1838B VS1838 Infrared receiver module Remote control module

You may also like

1 comment

Leave a Comment

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.