Projects‎ > ‎

Serial port IR transmitter/receiver


The idea is that I want to be able to control my TV from my PC and to be able to do that must I send IR codes to the TV. To be able to know which IR codes to send must I first record the IR codes from my TV's remote and after that can I play the recorded IR codes, thus controlling the TV. The handling of recording/playing IR codes is done with the help of the LIRC software.

  


Serial port IR receiver

   IC1 = TSOP 1838
   +-----------------------+ 3                           R1 (4k7)
   |               data -> +--------------------------------+------------o DCD(pin #1)
   |                       |                 _______        | 
   |                       |                | 78L05 |      | |   D1 (1N4148)
   |                       |    +-----+-----|OUT  IN|--+   | |
 +-+ 2 GND                 |    |     | +   |__GND__|  |    |      | /|
 | |                       |    |   -----       |      +----+------|< |--o RTS(pin #7)
 | |                       |    |   ----- C1    | IC2              | \|
 | |                       | 1  |     |         |
 | |                   VCC +----+     +---------+------------------------o GND(pin #5)
 | +-----------------------+          | 
 |                                    |
+ -----------------------------------+
The circuit above is based on the circuit available at Serial port receivers
IC1: - IR reciever
    
IC2: Voltage regulator



Component list

------------------------------------------------
Quantity                        1
Article number                  403334
Name                            CARBON RESISTOR 0.25 W 5% 4K7SIZE 0207
Price                           1:16 SEK
------------------------------------------------
Quantity                        1
Article number                  460508
Name                            MINI ELEC CAPACITOR 4.7UF 50V'-40/105 GR
Price                           1:37 SEK
------------------------------------------------
Quantity                        1
Article number                  162280
Name                            DIODE 1N4148  500MW
Price                           0:42 SEK
------------------------------------------------
Quantity                 1
Article number                  171115
Name                            IR RECEIVER MODULE TSOP1838 
Price                           17:85 SEK
------------------------------------------------
Quantity                        1
Article number                  742082
Name                            9-PIN SUB-D FEMALE CONNECTOR
Price                           5:78 SEK
------------------------------------------------
Quantity                        1
Article number                  715968
Name                            FLIP-TOP COVER FOR D-SUB CONNECTOR 9 PIN
Price                           8:82 SEK
------------------------------------------------
Quantity                        1
Article number                  156070
Name                            VOLTAGE REGULATOR L78M05CV [STM]
Price                           8:82 SEK
------------------------------------------------
Total = 44,22 SEK(about 6 USD)

The components can be found at Conrad

Software
Download Lirc: 
http://sourceforge.net/projects/lirc/files/LIRC/0.9.0/lirc-0.9.0.tar.bz2/download
Installation of packages:
$ apt-get install lirc
$ modprobe lirc_dev
$ modprobe lirc_serial

The following configuration file can be used when using a serial port IR sender/receiver:

$cat /etc/lirc/hardware.conf
REMOTE="Home-brew (16x50 UART compatible serial port)"
REMOTE_MODULES="lirc_dev lirc_serial"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_SOCKET=""
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS=""
TRANSMITTER="Serial Port (UART) : Direct TV Receiver"
TRANSMITTER_MODULES="lirc_dev lirc_serial"
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE="/dev/lirc0"
TRANSMITTER_SOCKET=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
START_LIRCD="true"
START_LIRCMD=""
LOAD_MODULES=""
LIRCMD_CONF=""
FORCE_NONINTERACTIVE_RECONFIGURATION="false"

After changing the configuration must Lirc be restared:
/etc/init.d/lirc restart


I have a Philips TV 42PFL3606H/12

but unfortunately is my TV's remote not included in the Lirc remote database so I need to create it myself. It is recommended to use standardized names, i.e.

$ irrecord --list-namespace 
KEY_0
KEY_102ND
KEY_10CHANNELSDOWN
KEY_10CHANNELSUP
KEY_1
KEY_2
KEY_3
KEY_4
.....

The recording of the different keys take a long time but the instructions are easy to follow. Recording of IR codes:
$ irrecord -d /dev/lirc0 /tmp/Philips_42PFL3606H_12




Serial port IR transmitter

                                              1N4148
               +------+       | /|
      +--------| 1K3  |-------|<-|-------------- DTR(pin #4)
      |        +------+       | \|
 IR  _|_
<--  \ /
<--   V 
     ---
      |
      +----------------------------------------- GND

Component list

------------------------------------------------
Quantity                        1
Article number                  162280
Name                            DIODE 1N4148  500MW
Price                           0:42 SEK
------------------------------------------------
Quantity                        1
Article number                  184365
Name                            LD271 = LD271L IR-S-DIODE EMITTER DIOD E
Price                           6:30 SEK
----------------------------------------------
Quantity                        1
Article number                  420751
Name                            METAL RESISTORS 0.6W 1% 1K3 BF
Price                           1:26 SEK
------------------------------------------------
Total = 7,98 SEK(about 1 USD)

The components can be found at Conrad
Note: The range is very limited(a few centimeters) with the circuit described above


The configuration file that was recorded above must be copied to the correct place: 

$ cp /tmp/Philips_42PFL3606H_12 /etc/lirc/lircd.conf
$ /etc/init.d/lirc restart

It should now be possible to control the TV by using irsend, for example:

$ irsend SEND_ONCE /tmp/Philips_42PFL3606H_12 KEY_6
$ irsend SEND_ONCE /tmp/Philips_42PFL3606H_12 KEY_MUTE
$ irsend SEND_ONCE /tmp/Philips_42PFL3606H_12 KEY_VOLUMEUP
$ irsend SEND_ONCE /tmp/Philips_42PFL3606H_12 KEY_VOLUMEUP


Comments