Universal Remote Control
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. This code used to encode data from remote control.
You have to wire the IR receiver. As shown in its figure:
- 1- Ground
- 2- 5V
- 3- Pin 11
After uploading this code to the Arduino open the serial monitor and press any button on your TV remote.
As shown in the image below, 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.
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw