HOWTO build your own IRDA SIR Transceiver(Dongle) for Linux using the MCP2120 


1	TFDS4500 (irda transceiver) = $6.63 Can
1	MCP2120 (irda endec chip) = $4.40 Can
1	MAX232 = $2.50 Can
1	7.3278 MHz oscillator = $0.90 Can
1	2N3904 NPN general purpose amplifier
1	7805 voltage regulator
5	1 uF capacitors (electrolytic)
2	18 pF capacitors (for oscillator)
2	10 K resistor
2	0.1 uF capacitors
1	10 uF capacitor
1	DE9S-FRS (female DB9 connector)

Short Answer:

	Wire the jumpers in the diagram as folloows: 
		J1 = 1/2 (this is DTR and it controls MODE)
		J4 = 1/2 (connects TX on the serial to the MCP2120)
		J5 = connected (this is RTS and it controls RESET) 
		J6 = 2/3 (connect RXIR on the transceiver to the MCP2120)
		J7 = 2/3 (connect TXIR on the transceiver to the MCP2120)
	Make sure to pull all the BAUD pins to high to enable software mode.

Read the following:
	Vishay Telefunken TFDU4100/TFDS4500/TFDT4500 data sheet
	Microchip MCP2120 Infrared Encoder/Decoder 
	Microchip MCP2120/MCP2150 Developer's Kit User's Guide

1. I have ordered the TFDS4500 transceiver because it has pins that are
well spaced and relatively large. Do not order any old transceiver without
checking the dimensions if you will be hand soldering the part. The transceivers
are not designed for hand soldering. Surprisingly they are also the part 
in the reference design.

2. The circuit can be culled from the MCP2120 developer's kit user's guide.
It is on page 51 of document DS51246A. If you don't want to use an integrated
transceiver, there is a circuit for you to build your own with a seperate
ir led and detector. Make sure you realize that irda leds are at a specified
wavelength and need a very quick switching time (i.e. ir leds for remote 
controls are not suitable). 

3. The MCP2120 is well behaved and easy to use. If you don't need to have
an irda compliant infrared link, you can bump up the clock speeds and get 
higher baud rates. I've never tried it so beware of errors in your 

Testing and debugging:

0. Set up the circuit and then set the mcp2120 to be in software command mode
(connect pin 7 of the mcp2120 to +5V). It will echo all data in this mode. 
Use this to test that the serial connection and the max232 are all setup 
correctly. You should be able to use minicom with 9600 8N1 and no hardware 
flow control and no software flow control. On reset the mcp2120 will default 
to 9600 baud (if you are using a 7.3728 Mhz oscillator).

1. Hardwire the MCP2120 for 9600 baud and then run a program to 
dump the serial information from the other side of an ir connection. If the irda
devices have a serial port mapping, you can open this serial port with minicom 
(but it only displays ascii characters and anything else will look like garbage).
This way you can at least prove that the whole thing is wired up properly. 
Don't forget to double check that Enable (is +5), Reset(is +5) and Mode (is +5)
are set correctly. 

Useful Code:

	Linux irda dongle driver mcp2120.c. 
Hopefully this will be part of irda for linux soon. :) It is part of the 2.5
series kernel... waiting for inclusion in future 2.4 series kernels. Check 
Jean Tourrilhes irda page.

	Serial read will read information from a serial port and display the 
actual hex values. Very useful in general. serial_read.c

	Serial write will actually program the mcp2120 if it is in software 
command mode. It manipulates the DTR and RTS lines. You can set them and then
pause the program to debug the circuit. For me, finding out about the ioctls 
was a bit of a treasure hunt. It will also write data to the serial port at 
the specified baud rate. serial_write.c

	For sanity checking you can use a digital camera to "see" the infrared
light. I personally use a 1394 Pyro Webcam for debugging... see the
Linux 1394 page for more information on this interesting technology.

Notice the ir led on the back of the laptop. This is an example of a mediated
reality scene. 
For a better example see the following...