|Infrared Serial Communication|
Improving the Range
Standard non-return-to-zero serial (more commonly known as asynchronous serial) communication is an age old standard which is still very widely used. It is used by anything which connects to a serial port (dial-up modems, serial mice, barcode scanners... etc) and is often used for communication between digital circuits. The hardware responsible for creating the asynchronous serial signals from each byte of data sent or received is called a UART. (Universal Asynchronous Receiver Transmitter, usually a 16550A chip in a PC) The details of asynchronous serial transmission and reception will not be discussed in detail by this article as it is assumed that anyone wanting to make some serial link into a wireless infrared link will already have a basic understanding of serial communication.
Most applications involving serial communication use some form of electrical connection between each device which needs to communicate. This can take many forms such as RS232 (usually used to connect to PCs), differential signals such as RS485 which do not require a common ground, or just plain old TTL/CMOS +5V logic levels. However, the only requirement for this type of serial communication to work is to have some means of conveying a logic 0 and 1 to the other device. This article will discuss the use of modulated infrared signals as a means of communicating logic levels.
Infrared light is simply electromagnetic radiation (EMR) at frequencies just below that of red visible light. For those not in the know, EMR covers everything from radio and TV transmissions (at relatively low frequencies ranging from a few hundred KHz to a few GHz), infrared radiation (heat), visible light, ultraviolet light, microwave radiation, to gamma radiation (from nuclear decay) and so on. Infrared is in the upper part of the heat spectrum, almost in the visible spectrum. (which starts with red at the lowest frequencies, thus infra red)
Why infrared? Because we can buy infrared LEDs and infrared sensitive photodiodes and phototransistors.... The concepts involved would likely work with most frequencies with manageable power levels, although visible light could get quite annoying. Another good reason to use infrared is that the relevant part of the electromagnetic spectrum is relatively quiet in an indoors environment, where we don't have to worry about heat radiated from the sun. (LED versus sun, go figure)
So we take a infrared LED and an infrared sensitive phototransistor, place them a few meters apart, turn the LED on and the phototransistor conducts? Not really.... Unfortunately, while being inside may eliminate the problem of direct sunlight swamping out the efforts of your LED there's still enough background noise in the infrared spectrum to result in false triggering or loss of signal. (just about anything which gives of heat is radiating infrared) This may work in a darkened room, but in most practical applications it would not be very reliable.
To get around this we turn to a technique called amplitude modulation. We take one signal, in this case a 38KHz square wave, and switch it on and off with the signal we want to send. If the receiving end can be made to be sensitive only this 38KHz signal then the likelihood of false triggering from your heat lamp is greatly reduced. Why 38KHz? Possibly because the first TV remotes used 40KHz ultrasonic remotes, a practice soon abandoned for some unknown reason. (perhaps peoples cats went berserk when their owners changed the channel)
To make the design of infrared systems easier, infrared receiver ICs are available which are sensitive to 38KHz modulated signals and provide a buffered 5V logic output. One of these ICs is pictured below. (I don't have any infrared LEDs to show at the moment, but they just look like normal 5mm LEDs with a smokey lens)
These integrated circuits do all the work of the receiving end and provide a signal which can be directly coupled with the receiving devices UART. As there is only three pins on these ICs, they are very easy to use. (two pins for 5V power, one for the output signal) However, there is still the task of creating a 38KHz modulated serial data stream to drive the transmitting end. Transmitter IC solutions are not so readily available (or at all) so we're going to have to get our hands dirty.
There are a number of ways to create a switchable 38KHz signal which could be used to drive an infrared LED. A microcontroller could be dedicated to this task (this would be a low part count solution, but somewhat more difficult for a hobbyist) or a free running oscillator of the desired frequency could be controlled by the serial signal. Below is a circuit based on the 555 timer which should be within the means of most hobbyists.
This is a basic astable configuration of the 555 timer which will pump out an semi-square waveform at 38KHz whenever the reset input (pin 4) is driven high. The values of R and C will have to be chosen to obtain the 38KHz frequency. (I have not built this circuit, so I can't provide component values that are likely to work) A good idea would be to make C 1nF and put a 100KΩ trimpot in the place of R. Adjust the trimpot with the LED pointed at a receiver IC until the output of the receiver goes high. The datasheet for the 555 timer provides a formula to select appropriate values for a desired frequency, which may help you get close. (an adjustable resistor may still be required)
The reset input on the 555 timer is designed for 5V TTL/CMOS logic, so it can be directly connected to the transmitters UART.
Improving the Range:
A single LED is usually only gives a reliable operating range of a few metres, so the first thing most people want to know is "how do I make it go further?" The two easiest ways would be to either increase the current driven through the LED, or to add more LEDs.
To increase the current through the LED, simply adjust the value of R2. Have a look at the datasheet for the LED you are using to find the maximum forward current, (usually something like 50mA) and then use ohms law to calculate the value of R2 for optimum intensity. If you add a resistor between C and pin 7 on the 555 you can influence the discharge time for this capacitor which directly affects the duty cycle of the 38KHz output. At 50% duty cycle the LED can be driven at almost twice the rated current without damaging it. Keep in mind that reducing the duty cycle also makes the LED harder for the receiver to see, so a bit of experimentation might be required to get the best out of your infrared LED.
Because the TTL version of the 555 can drive as much as 200mA from it's output, it's easy to stack up more LEDs to increase the range. However, there is a catch. Because the apparent luminosity of light radiated from a point source is proportional to the reciprocal of the square of the distance from the source, adding another LED does not give twice the range. Have a look at the formula below.
The constant k is related to the absolute luminosity of the light source. (ie. at the source) From the above formula, if the distance is doubled the apparent luminosity will reduce by a magnitude of four. Treble the distance and the luminosity drops to a ninth. Doubling the absolute luminosity (by adding a second LED) will result in twice the luminosity at the same distance, but at twice that distance there will be considerably less than there was at the original distance with a single LED. With this in mind, there's not much point in adding more than two or three LEDs.
Many (most?) applications will require data to be sent and received in both directions, which requires at the very least two sets of the hardware described above. Further complications are likely to arise if full duplex (both ways at the same time) communication is required, as infrared light transmitted from one end can be picked up by the receiver at the same end. This can happen directly if the receiver IC is not properly shielded from the transmitter LED, or indirectly from reflections off other objects.
If it's at all possible, the easiest solution is to adapt your project to work with half duplex communication. This means that only one end is transmitting at any given time, and can therefore ignore any input from it's receiver IC while sending. If full duplex is required then echo cancellation can be implemented in software (if you have any software), or the all-in-one receiver IC can be abandoned for something which can have it's frequency adjusted. If one end of the serial link transmits with a slightly different modulation frequency to which the other end is sensitive then any reflections will not be seen as valid signals. (unless one end of the link happens to be moving away from the other at exactly the right speed for the Doppler Effect to result in a matching frequency, but one can only cover so many contingencies....)
Hopefully this article will have given most readers enough information to implement serial communication of infrared. The hardest part for most hobbyists is likely to be obtaining a 38KHz output from the 555 without expensive equipment such as oscilloscopes. As stated above, the datasheet for the 555 will provide formulas which can get you close to the desired values or R and C, but a bit of tweaking will probably be needed.
I have received a few emails claiming success with this approach for linking two Casio fx-9750G Plus graphing calculators together.
If you have any comments or questions please don't hesitate to contact me.
|Return To Top||Last Updated: 19/02/2007||Home Page|