On the hardware side of things, what is involved in making the Arduino receive signals from a TV Remote? What kind of infrared receiver is needed? Do TV remotes use some kind of channels, encoding, or encryption requiring special receivers or else additional programming work to decrypt the signals?


The most common (not sure what others are used) carrier frequency is 38khz. You need an IR receiver tuned to that frequency to get the signal from the remove. See this page for way more information.

There is no encryption or special receivers needed as long as the carrier frequencies match.

That's really all the hardware you need. On the software side of things, you read this signal and decode it. There's a neat little library for doing exactly that. It's called Arduino IRemote.

It even has an example sketch which tells you just what the decoded value is of whatever button you pressed so you can use that in your other programs.

| improve this answer | |

Responding to TV remotes is surprisingly simple, because they typically all work on exactly the same principle, with no concept of channels or encryption.

What you need is an IR receiver module, which you can buy fairly cheaply from many electronics suppliers. Anything intended to work with remote controls should be suitable. The important part is that it will work with ~38 kHz signals.

It will typically be a 3 pin component. Many are able to operate at 5 volts, which means you can usually connect the IR module's voltage and ground pins directly to the Arduino's power supply. The data (or signal) pin can typically be connected straight to any GPIO pin. Always check the component's data sheet though. It will often recommend using some additional components (e.g. resistor and capacitor) to smooth out power fluctuations. That shouldn't be necessary for a small project though.

When an IR signal is detected, the module will usually output a series of pulses on the data pin. These will be digital pulses, so there's no need to use an analog-to-digital converter. What matters is typically either the length of each pulse (Pulse Width Modulation), or the length of the gap between consecutive pulses (Pulse Distance Modulation).

The timings of the pulses/gaps will be very fast; usually in the region of 400 to 2000 microseconds. That means it's probably too fast to try to detect them using repeated calls to digitalRead(). Instead, there is a core Arduino function called pulseIn(). When it's called, it will wait for a pulse to arrive on the specified GPIO pin. It will then return the approximate length of the pulse. You can detect high pulses for PWM, or low pulses for PDM.

Precise timing values will vary considerably, so you can ignore small variations. The key is to categorise each pulse as short or long, corresponding to a binary 0 or 1. A good starting point is to consider anything below 1000 usec as short, and everything else as long. Check what timings you actually receive though, and adjust that value accordingly.

Call pulseIn() repeatedly, storing each result. Keep going until no more pulses arrive (you will need to give it a timeout after which it gives up waiting, e.g. 10,000 usec or more).

Your TV remote will output a unique sequence of short/long pulses for each button, typically 32 bits or less (possibly with extra pulses at the beginning/end). All you need to do is figure out which sequence corresponds to each button. You could store that information in a lookup table, and respond accordingly when a sequence is recognised.

| improve this answer | |

A simple IR diode like this can receive raw IR data. There are several chips which are designed to decode these signals, such as this one.

Ir diode ---------------- Ir decoder chip

Ir Diode ------------------------------- Ir Decoder

| improve this answer | |
  • To be more accurate, the TSOP382 is a bit more than just an IR diode; it includes additional electronics (pre-amp). Using a real simple IR receiver diode typically is not enough to just get commands from a TV remote. – jfpoilpret Feb 16 '14 at 18:48
  • The very nice thing about the TSOP382 and like others IC's, is that it has AGC amplifiers built in. Which accommodate a large dynamic change in amplitude, related to distances. Hence it works close and far away. DIY with discrete components gets messy(poor cost vs benefit ratio), as the IR energy drops very fast with distance. – mpflaga Feb 22 '14 at 6:56

I used TSOP1738 which is easily available at cheap price and I recorded values from more than 10 remotes and it worked very well.

Here is a file which contain recorded values of a Videocon DTH setup box's remote

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.