Simple transmitter circuit on serial port:
_____ |\ | DTR -----|_____|-----| >|--------- GND R |/ | IR LED e.g. SFH485
R should be greater than 1K so that the current is less than 10mA (my serial port has about +/- 10V). I guess it is also save to leave out the resistor since the serial port should also have a max. short circuit current. Since the maximum current is so small almost any infra-red LED should be usable.
The range of this device is up to 1m depending on the receiving device (e.g. with my Sony VCR) and if you aim right at the IR detector. Not good enough to be practical but enough to e.g. invent your own code to control your computer and program a programmable remote with it.
Usage of the this circuit is not recommended if you value your serial port. If it is on the motherboard I would not use it! I use a serial port on a cheap serial card for testing. Actually I only say this, so that it's not my fault if your house burns down ...
If you don't want strain your serial port, use a bigger resistor or a simple amplifier circuit like this:
(please excuse my bad ASCII art)
+---------------------+-------------+------ + 5-9 V 15K NPN | IR-LED | | _____ | / \_/ -> | + Signal ---|_____|---+---|< 100R --- -> ----- (e.g. DTR) | | \> _____ | / ----- 470 uF - \---|_____|---+---|< BD237 | 100K | | | | \> | | | \_/ | | - --- - | | 2x1N4148 | | | 5-100 R | ----- diode \_/ | | R | --- - | | | | ----- ----- -----
R in the amplifier circuit can be chosen as small as 5 Ohm (for 5V !). Since the signal is pulsed and with a 40kHz carrier frequency, an LED like the SFH485 (or others with max. 100 mA) can tolerate 1A for a short period of time. Some data sheets might mention how high the current can go for certain pulse lenghts.
But take care that after the signal is sent the signal line is low or your LED might become a little "brownish" like one of mine did :-) (It even still works, but the range decreased to a few centimeters ...) It should be safe if you use >50 (>90) Ohm for 5 (9) V, but the range will be much smaller.