What is IrDA?
Chances are your IR transceiver will not be a single stand-alone device, and instead you will be using it for transmitting data from your microcontroller. I assume you will be using the available hardware UART on your microcontroller - please read that tutorial if you are not fully familiar with UART!
Before starting, check out my IR transceiver demo:
Infrared Transmission - The Wrong Way
And now for the proper way . . .
The IR transceiver should handle all that low-level boring stuff, such as hardware handshaking, ID transmission, modulation, etc. If you want to know more, refer to the datasheets. This is not required knowledge so don't worry about it.
Also to note, the IrDA transceivers are 'half-duplex', meaning they can only transmit or receive, but not both simultaneously. You will need to have your microcontrollers coordinate data transfer (its actually pretty easy to do, I have confidence in you!).
IrDA Encoding and Decoding
How? Well, buy an IrDA encoder decoder IC, silly. There are many manufacturers of these IC's, but the one I used is the MCP2120 from Microchip.
There is another method other than using an IC to interpret the IrDA standard signals - you can emulate the conversion in software on your microcontroller. In fact, in industry, this is the preferred method because software is cheaper than hardware. If you don't need to save a buck, and/or don't know what you are doing, just go with the IC encoder method.
As with UART, you need to make sure all devices are operating at the same baud rate. Some devices have user selectable rates by applying voltages on various pins, and others have an auto-baud detect feature. Many of these devices also have reset pins to uuhhhh reset the hardware, and also enable/shutdown pins to put the devices into power-save mode. You also may need to install a clock - a square wave signal that times all the devices. The datasheet will explicitly state information on the clock, give a suggested schematic, and give you specs on the required external hardware (such as a crystal and capacitors). A clock can also be taken from a microcontroller (see microcontroller datasheet on clock oscillator info).
Now looking at just the left half, here is a closer breakdown on how things get wired up:
Of specific note, notice how Rx connects to Rx, and Tx connects to Tx. At first this seems confusing and counterintuitive compared to how UART is done. But actually, when a transceiver receives data, it also transmits it - so Rx is basically Tx. A bit confusing, but just follow the datasheets and this diagram to get the wiring correct.
This video shows how I soldered and assembled the transceiver.
The IrDA to TTL Signal conversion
As you can see, for every doubling of distance the emitter
power must be increased by a factor of 4.
For 4m distance, 15 LEDs would be need to be added in parallel.
This image is the transceiver wired up onto my custom PCB:
When its transmitting, you can see the pretty light by using a common digital camera. This is a very easy method to help you debug your hardware/software:
And this is an image of the encoder decoder IC on protoboard. I wasn't motivated to do it on a custom PCB since they offered a PDIP package for easy wiring:
Further reading on IrDA and RS-232
Has this site helped you with your robot? Give us credit -
link back, and help others in the forums!
Society of Robots copyright 2005-2014