In this tutorial, we will learn how to hack a TV (television) remote using Arduino. TV remote communicates with TV using infrared rays. Encoded commands and transmitted by remote, TV internal circuitry decodes them and performs an action on received commands.
On the front of the remote, we have an IR led which emits IR rays carrying data. Each key on the remote is mapped to a single command. When we press a particular key, IR’s associated command is transmitted on IR rays by IR led. At the receiver(television) side, an IR decoder decodes the received command and passes it to the television controller for further action (switch on/off, change the channel, etc.)
The above communication process seems straightforward. But there is a lot of things going on inside. Let’s take a deeper look.
Both the transmitter and receiver are operating on a fixed frequency IR signal. That’s because other IR signals are always present in surroundings. IR Receiver is made sensitive to only one frequency. Different vendors have specified the frequency ranging from 30KHz to 40KHz. 38KHz is popular. This range is selected for remote control because IR rays in this frequency are rare. Let’s take 38KHz for this project. So, IR led transmits data at 38KHz, and the IR receiver is only sensitive to 38KHz frequency.
Data is transferred in bursts. Each burst at 38KHz represents one bit. Notice in the below picture that carrier frequency is translated into data bits by the receiver.
Since plenty of vendors are in the market, each vendor has defined its instruction format differently. Start from the start signal, followed by command/data, address, and at last stop bits, for vendor-specific instruction format (IRremote Protocols).
Decoding the IR data
The IR detector which I am going to use is tsop1738. It is sensitive to 38KHz frequency. The circuit diagram of the project is below.
Digital pin 11 of Arduino is receiving the data bits from the IR detector. I am using the IRremote library in the project. A timer interrupt is reading the pin 11 status every 50us. Decoding is a little complicated, but you can easily understand the reading and decoding logic if you study the library documentation.
In the code, I first imported the library. Then defined the digital pin will be read after the specified internal set in the timer. Next, the onboard Arduino led is made to blink when data is received. The serial monitor started at a 115200-bit rate. IR module is started. To see the decoded commands, open the serial monitor at 115200 bps and press the remote buttons. Associated commands with each button will be decoded and displayed on the serial monitor.
You’re own remote
To build your own remote, the decoded commands can be inputted back and send using IR led. Just connect the IR led to any PWM pin of Arduino and specify the IR remote library code pin. A circuit diagram of the project is given below.
IR remote library outputs the data signal at 38KHz frequency using the timer, and PWM is used for burst. In the below example, I am sending out Sony remote control commands to the Sony TV. Commands can be seen on the serial monitor.
Arduino IR remote library is playing a huge part in the code. I would encourage all to go through the library. Timer configuration and time stamp for data decoding is a complex task.
Let’s DIY the above project: Where to purchase parts?
Arduino: Mouser
TSOP1738 IR detector: Mouse
IR LED: Mouser
You may also like:
Filed Under: Arduino Projects, Microcontroller Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.