In this example we look at how to connect an IR Reciever. Generally, they require Vcc(5v) but I found this to work well with 3v3, GND and there is a data out which you connect to your Arduino. Here is a typical IR showing the pinout.
Many electronic shops online stock breakouts for these but of course these are pretty useless without a remote control, you can use a standard remote but you can also purchase one like this for less than $1
1pcs/lot 38khz MCU learning board IR remote control Infrared decoder for protocol remote control For arduino .MP3 .MP4
Layout
Code
You’ll need the IR Remote library, you can get this from
https://github.com/markszabo/IRremoteESP8266
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.
[codesyntax lang=”cpp”]
#include <IRremoteESP8266.h> int RECV_PIN = D4; //an IR detector connected to D4 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(); // Receive the next value } delay(100); }
[/codesyntax]
Testing
I opened the serial monitor and pressed the keys on my remote control here is what was displayed
FF6897
FF30CF
3D9AE3F7
FF7A85
FF10EF
FF38C7
FF5AA5
FF42BD
FF4AB5
FF52AD
FFE01F
FFA857
As you can see with a bit of programming we can take these values and put them to use.
Links
Mini 38KHz Infrared Receiver Sensor Module for Arduino RPi STM32 FZ1577
[…] Ein Schaltplan für den Anschluss an einem WEMOS ist hier zu finden: http://www.esp8266learning.com/wemos-infrared-receiver-example.php […]
[…] IR ReceiverESP8266http://www.esp8266learning.com/wemos-infrared-receiver-example.phphttps://github.com/crankyoldgit/IRremoteESP8266/blob/master/examples/IRrecvDemo/IRrecvDemo.inohttps://kookye.com/2016/12/13/use-nodemcu-and-infrared-receiver-to-send-signal-to-mqtt-client/https://github.com/piotrC4/mqtt-ir-transceiver […]