/RemoteControlCodes

Stores the codes sent by an IR remote control code to electronic devices

Primary LanguagePascal

RemoteControlCodes

This application stores the codes sent by an IR remote control to electronic devices (TV, VCR etc). It cooperates with an Arduino microcontroller which receives and decodes the IR signal using a TSOP4838 IR receiver. Code information is communicated to the program by the serial port.

In addition, the application can send the stored codes to the electronic device using an IR LED connected to a digitial output of the Arduino.

Setting up the Arduino

Needed parts:

  • Arduino microcontroller (Arduino Nano)
  • TSOP4838 infra-red receiver
  • Infrared LED
  • 220 ohms resistor

Circuit

  • Connect the output of the IR receiver (pin 1) to digital pin 7 of the Arduino.
  • Connect the digital output pin 3 of the Arduino Nano to the anode of the IR light-emitting-diode via the 220 ohms resistor. Note that this output pin cannot be changed. A different pin may be required for other Arduino models.
  • Connect the Arduino to the PC via an USB cable and upload the codes.ino sketch (in folder arduino/codes) to the Arduino.

Usage of the program

  • Open "Codes" > "Set up remote control". Define the name of the remote control and enter the labels of the remote control key for which you want to store the IR codes. After pressing "OK" each key name gets a row in a grid of the main form.
  • Active the serial port by pressing the "Connect" button.
  • Select the key in the first grid row. Point the remote control towards the IR receiver on the Arduino and press the first key. The code will be added to other cells in the corresponding grid row.
    • column "Code": hexadecimal value of the code received from the IR remote control.
    • column "Type: manufacturer
    • column "Bits": number of bits used on the code.
    • column "Raw": list of the mark ("m") and space ("s") times of the pulses sent by the IR remote control. Times are in microseconds. When "Code" > "Plot marks/spaces" is checked a plot of the pulse sequence is shown at the bottom of the window.
  • After the code has been received the next row in the grid is highlightes. Press on the associated remote control key to continue.
  • The button "Send" creates the original pulse sequence received and sends it to the IR LED attached the Arduino board. This way the Arduino can be used as a "spare" remote control.
  • The button "Save" stores the pulse and code data to an xml file with the extension .rcf ("Remote Control File").
  • The button "Open" loads an rcf file into the grid.
  • The button "Save WAV" creates for each of the listed codes a WAV file which allows to convert a smartphone to a remote control as described in the next section.

Experiment: Converting a smart phone to a remote control

The idea for the following experiment is based on several internet articles, among them

New smartphone do not seem to have IR transmitters any more for application as TV remote control. The WAV files generated by the rcc program, however, can be used to retofit this functionality to many of today's smartphones.

  • Copy the WAV files generated by rcc to the smartphone.
  • Connect an IR transmitter to the smartphone's headphone connector and play the WAV file for the requested TV function. This way a modulated IR signal is created from the audio stereo signal. Turn up the audio volume to maximum in order to get a sufficiently large signal to overcome the LED's threshold voltage. Note that this procedure will not work will not work if the smartphone does not deliver sufficient signal.

Circuit Image

The simplest IR transmitter is a pair of infra-red LEDs connected in an anti-parallel configuration between the left and right channel connectors of a 3.5 mm audio jack; do not connect to ground! This way of configuration doubles the headphone output signal which is possible because the WAV files are written as anti-phase stereo. This is critical because the smartphone's output power may be too small to overcome the LED's threshold voltage of about 1.3 - 1.5 V.

It should also be noted that the IR detector in the TV set requires a modulation frequency of about 38 kHz. A problem is that this frequency is usually filtered by the smartphone's audio cirquit, and BTW is too close to the audio sample frequency of 44.1 kHz (Nyquist theorem). The solution is to modulate the audio signal only by half of this requency (19 kHz) and to use the anti-phase stereo signal and the anti-parallel LED configuration to emit light at twice the modulation frequency: When channel 1 has a positive signal LED1 is emitting, and when channel1 has a negative signal then channel 2 is positive and makes the other LED emit.