Sending IR with Arduino means that you can control various different devices in your home. Controlling different devices with IR can be part of your Arduino smart home.
Reading the IR signals is fairly easy. All you need is a IR receiver. The most commonly used infrared carrier signal is 38 kHz, but it should still work fine, if the receiver and sender use different frequencies.
Receiver:
I used IRremote library to send and receive infrared signals. You can download and read more instructions about IRremote library
here.
Use the IRrecieveDump -demo to dump all the data read from your remotecontroller. If the data could be identified as RC5, Sony or NEC it will also be very simple to send.
To send IR, you need an Infrared LED with a resistor. You don't want to burn your LED so use
this counter to calculate the best resistor for it.
IR-Led
Example:
Start the IRrecieveDump -demo and open serial monitor.
Point your remote towards the receiver and press a button.
The program should print out for example the NEC -code and the raw data.
The NEC -code should look like this: "FF906F".
Now you can try sending the same code by using sendNEC() method:
Irsend.sendNEC(0xFF906FF, 38);
UPDATE:
the 38 above is wrong. The second parameter is the lenght in bits. The Nec function will always send 38khz. Correct way is:
Irsend.sendNEC(0xFF906FF, 32);
Because the code you are sending is a HEX code you need to put the "0x" before it.
"38" in the constructor means that you want to send it with 38khz carrier frequensy.
Some devices use their own protocols such as Samsung, but you can get the raw data from them. To clean the raw data you get from the dump -demo, you need to erase the first number, then convert all negative numbers to positive and place commas between the numbers.
Here's an example:
Raw data: 4802, -620, 500, -420, 600, -440....
Sending:
unsigned int[68] power_ON ={620,500,420,600,440... ...};
Irsend.sendRaw(power_ON, 68, 38);
68 is the length of the unsigned integer.