Manchester and Differential Manchester Code and the Pulse Position Modulation and Differential PPM theory pages. I planned to use some LEDs that i was provided by Alan Parekh's store. Alan offered me these 5mm IR LEDs as a replacement for the Long Range IR Beam Break Detector circuit, but i sincerely did not have enough time to work on an interesting project with IR LEDs. hopefully, the one that i prepare will pay off all this waiting.
But first of all, some theoretical matters. I will explain some essential and widely used IR protocols including the Phillips RC5/6 and the Sony SIRC protocol. But first of all, there is something very important to explain. Many people tend to confuse the protocol and the modulation. I first wrote this article as part of the RC5 protocol, but since it became that long i decided to make a separate page.
The difference between Protocol and Modulation
It is important to understand the difference between modulation and protocol. In words, modulation is the method that the signal is being transmitted by the transmitter so that the receiver will recognize it as a valid signal. On the other hand, the protocol is the method that the data to be transmitted are arranged and sent to the receiver - Both the receiver and transmitter must have the same modulation-demodulation method and also they must have the same protocol encoding and decoding method.
Here is an everyday example. The different languages that people speak, is one of the most complex protocols that you will find. People speaking the same language have a common method to encode sounds and make words, and also a common method to decode these sounds and understand these words. People can learn different protocols (Greek, English, Chinese...) and communicate with other people. For a successful communication, both the transmitter (the one that talks) and the receiver (the one that hears) must know the same protocol (language).
As for the modulation: Suppose that two people own the same protocol (language). One of them is about to speak, so he thinks of the phrase "Hello"... He knows the protocol, he knows what must be transmitted, but there has to be a way to modulate this thinking into something that can be transmitted through air. This is accomplished with his vocal strings. His brain will send electrical signals to his vocal strings which will modulate his thought into air vibrations, able to travel through air. When these modulated vibrations arrive inside the ear of the other person (receiver), they will be demodulated into electrical signals and his brain will decode it into the word "Hello"...
Let's water the plants - A simple IR remote control system
Defining the transmission protocol
Lets see now a typical example. Suppose that we have a device which control 4 irrigation valves, and this device is controlled by an IR remote control. The transmission protocol (which we can call VESTRAPROFOE - VEry Simple TRAnsition PROtocol For Our Example) has 4 bits. The first bit is the start bit to wake up the receiver microcontroller. The next bit is the command. Here are the possible commands:
0 - Turn valve OFF
1 - Turn valve ON
And the next 2 bits is the valve address:
00 - Valve #1
01 - Valve #2
10 - Valve #3
11 - Valve #4
If the operator wants to turn the second valve ON (#2), then by pressing the proper key, the transmitter will send this signal:
1 - 1 - 0 - 1
Reading from left to right, the first bit is the start bit, the second bit tells the receiver that a valve must be turned on, and the last 2 bits indicate that this valve is the valve #2
This protocol is extremely simple. Usually, consumer products with remote controls have more sophisticated and complex protocols, but this does not mean that such a simple protocol would not work.
Defining the transmission modulation
Now that we know what has to be transmitted, we need to find a way to transmit it thorough air from the transmitter to the receiver. We need therefore to make a modulation method. This will be more trickier than defining the protocol. The modulation has two parts. The first part is how to transmit the four data bits so that the receiver will be able to understand what bit is being transmitted. Since we use infrared light, the bits will be transmitted with light pulses. Let's define a simple transition modulation:
So, this was the first part of the modulation. This ensures that the receiver will be able to understand if a 0 or an 1 was transmitted. The receiver only needs to check the duration of the pulse that was transmitted: If the duration is less than 5mSec (2mSec), then a zero was transmitted, otherwise (8mSec) an ace was transmitted.
Actually, this method of modulation is not new neither mine. It is so called "Pulse Width Modulation" or PWM and it is a very common modulation method for transmitting digital signals.
The second part of the modulation is how to transmit the four bits so that the receiver will distinguish the signal from ambient interference. If there were absolutely no ambient IR radiation other than the one being transmitted by our transmitter, then turning on and off the LED according to the PWM would be enough but this is not the case. Actually, there are countless sources of IR light around us, with most common being the sun and the light bulbs. So, the transmitter must emit the IR light in a way that the receiver can distinguish it from the ambient IR light.
The most simple way to do this is to use a "carrier frequency" to transmit the pulses. Here is how this works: First of all we select a frequency for the carrier frequency such that it cannot be mistaken with other ambient IR frequencies. A very common range for IR transmitters is 36 to 46 KHz. Suppose that we choose a carrier frequency of 38 KHz.
Suppose now that we want to transmit a pulse with 8 mSec ON duration and 2 mSec OFF duration (digital ACE). Instead of simply turning ON the LED for 8 mSec, we will set the LED to oscillate at the carrier frequency for 8 mSec. This way, instead of transmitting a continuous light beam, we transmit a series of very fast light pulses (38 KHz) for a duration of 8 mSec. The receiver has a narrow band filter that discards all other IR light sources that do not have a 38 KHz frequency. If the transmitted signal reaches the receiver, it will go through the narrow-band filter. Then, with a set of low-pass filters or other filtering devices, it will be translated into a pulse back again.
Understanding the difference with images