Mini Project: Infra-red Repeater

As part of a larger project I’m thinking about, I wanted to see how easy it would be to make a TV remote control repeater. What it needs to do is listen for a TV remote control command, learn the command and then repeatedly send out that command.

Only 3 external components required. (I used four).

Only 3 external components required. (I used four).

For the processor I am using an Arduino Mega 2560 rip-off with the Arduino bootloader removed so that it is effectively just a development board for an Atmega2560. This has far more pins than I need, but it is very suitable for development. I am programming it using Atmel Studio 6.2 in C via an AVRISP MKII.

On the input I am using a TSOP31238 Infra-red receiver module. There are thousands of variations of this type of component, but this one has three pins:

GND Connect to ground
VCC 2.5V-5.5V
OUT Outputs low when there is a 38kHz IR signal incident on the receiver, otherwise outputs high

Therefore, it is easy to detect when an IR pulse is sent from a TV remote by listening to the output pin and waiting for it’s voltage to drop.

On the output, I am using an IR LED connected directly to the output of the Atmega, in series with a 156Ω resistor (actually a 100Ω + a 56Ω). This limits the current to about 20mA.

The code is relatively simple in concept. When the processor detects the first falling edge on the input pin, it starts a timer. Each time the input pin changes state, it stores the value of the timer in an array and resets the timer. If the timer overflows, this is taken to mean the command is over. This leaves us with an array of integers indicating how long the signal must be low or high.

The input from the IR Receiver module. The signal drops low when there is a 38kHz signal incident.

The input from the IR Receiver module. The signal drops low when there is a 38kHz signal incident. (Timebase in milliseconds).

The processor then uses the same timer to activate the output pin with the same timing as the input signal by reading back the array of integers.

There is a slight complication in that the output signal has to modulate a 38kHz square wave. This is achieved by using another timer to generate a 38kHz signal, which is then outputted to the LED only if the other timer indicates that the output should be high.

The output from the processor. The red blocks are actually 38kHz pulses.

The output from the processor. The red blocks are actually 38kHz pulses.

It then sends the signal once a second.

This works very well and it can easily copy the signals from my TV remote and repeat them to the TV. The only issue at the moment is that this method of storing the pulses takes up a relatively large amount of space – approximately 300 bytes for one command.

Advertisements

2 thoughts on “Mini Project: Infra-red Repeater

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s