In this tutorial, we will learn how to use an IR Receiver and Remote with Arduino.
Infrared (IR) communication is widely used and wireless technology which is easy to implement. We will use the TSOP1738 IR receiver for receiving data from the remote. Mainly, TSOP Receiver is used to receive data which support various transmitted code.
In this tutorial, we will cover –
- Decoding the remote keys.
- Control Light using the IR Receiver and Remote.
Circuit Diagram For IR Receiver and Remote with Arduino
IR Sensor Arduino Library
You need to install the IR library. Now go to Sketch > Include Library > Manage Libraries and search for IRRemote by shirriff.
OR just download from https://github.com/Arduino-IRremote/Arduino-IRremote and Add .Zip Library.
Code For Decoding The Remote Keys
Upload below code for decoding the remote keys code. Press the remote keys in front of the IR receiver and get the key code in the serial monitor of IDE.
Code For Control LED using IR Receiver and Remote
Now we will control a led using the IR Receiver and Remote. Connect a led on Arduino pin 13. You can easily modify the code for controlling servo motor or relays.
Now press the remote key to turn on the led. When you press the key repeatedly it changes the light state of led.