An Infrared light emitting diode (IR LED) is a special purpose LED emitting infrared rays ranging 700 nm to 1 mm wavelength. Different IR LEDs may produce infrared light of differing wavelengths, just like different LEDs produce light of different colors. IR LEDs are usually made of gallium arsenide or aluminum gallium arsenide. In complement with IR receivers, these are commonly used as sensors.
The appearance of IR LED is same as a common LED. Since the human eye cannot see the infrared radiations, it is not possible for a person to identify if an IR LED is working. A camera on a cell phone camera solves this problem. The IR rays from the IR LED in the circuit are shown in the camera.
IR emission LEDs are used in TV remote, Lets see how to make TV remote using this module.
In this tutorial we are using both receiver and transmitter modules.
Transmitter:
Arduino Connections with IR emission module KY-005
KY-005 Connection Diagram
Connect the Power line (middle) and ground (-) to +5 and GND respectively. Connect signal (S) to pin 3 on the Arduino UNO or pin 9 on the Arduino Mega. The pin number for the infrared transmitter is determined by the IRremote library.
Arduino Code for IR transmitter module KY-005
Following code uses IR remote library Download from here
#include <IRremote.h> IRsend irsend; void setup() { Serial.begin(9600); } void loop() { for (int i = 0; i < 50; i++) { irsend.sendSony(0xa90, 12); // Sony TV power code delay(40); } }
Receiver:
Arduino Connections with IR receiver module KY-022
Arduino GND –> Module pin (-)
Arduino +5V –> Module PLUS (middle pin)
Arduino Digital pin 11 –> Module S
Arduino Code for IR Receiver module KY-022
/* * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv * An IR detector/demodulator must be connected to the input RECV_PIN. */ #include <IRremote.h> int RECV_PIN = 11; 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 } }
Transmitter and Receiver Modules
Results
Open serial monitor on Receiver side module and keep both module in front of each other. see the transmitter hex on serial monitor.
Responses