The transmitter in the remote control handset sends out a stream of pulses of infrared light when the user presses a button on the handset. A transmitter is often a light emitting diode (LED) which is built into the pointing end of the remote control handset. The infrared light pulses form a pattern unique to that button. The receiver in the device recognizes the pattern and causes the device to respond accordingly (Wikipedia).
So we have to know that unique pattern of each button.
Simply, you have to download the IR library for Arduino.
In the examples of that library, you can find IRrecvDump example (as illustrated in the third image). This code used to encode data from remote control.
You have to wire the IR receiver. As shown in it’s figure:
3- Pin 11
After uploading this code to the Arduino open the serial monitor and press any button on your TV remote, you will find something as in the fifth image image.
As shown in the fourth image, you can find the hex code that refer to each button of the remote control. Write down these hex numbers corresponding to its function (e.g. 20DFC03F ,32 refers to power button).
Note, If you get “unknown encoding”, press the button again.
Now, We have to upload the code that is used to transmit the commands to our devices. You can find the code Here but you will make a small change depends on your remote.
All you have to do here is to replace by hex values as (0x20DF10EF) by the values you have got from the power button, volume up/down buttons and any other button you want.
Since 1Sheeld mobile application doesn’t have a remote control interface, I used the KeyPad shield as the remote controller, you can choose the Keyboard shield as well for much more devices.
Finally, you use the IR LED at pin 3 in Arduino and Place it next to the in front of the devices as shown.
Now Open 1Sheeld mobile application and connect it with the shield and then choose the keypad shield, all of these shown in the video.
Now, by pressing the buttons on your mobile phone it will make the corresponding task whether to power on, volume up, volume down, ….etc.