Transmitting IR Data

Some time ago, I wanted to see if I could control my Westinghouse TV using an Arduino micro-controller platform.


When I started, I didn't know what communication protocol was being used by my TV, so I used the same approach described earlier in this post, to look at the data being transmitted from my remote control. After analyzing the output, I matched it's protocol signature to the already well defined and commonly used Sony SIRC standard. This website was extremely helpful in doing that analysis.

I then began the process of implementing the protocol in the Arduino language. I broke the protocol definition into three simple transmission parts:
- sending the header
- sending a 0 bit
- sending a 1 bit

Here's some code to help you get started - a method for each part of the protocol:


I then assembled those into the proper sequence to produce the IR blast required to control the TV. Here is a simple explanation of the sequence used to control the TV:

1. Send header
2. Send command (this is info like raise the volume, channel up or mute...etc.)
3. Send device ID (this is like TV, DVD, Tuner...etc.)

This needs to be repeated a minimum of 3 times for the receiver to verify that it indeed is a correct message being sent. Here is a brief video showing a simple looping program that sends commands to my TV.

// send header
void sendHeader() 
{
int i = 0;
while(i < T_HEADER)
{
digitalWrite(LED_PIN, HIGH);
delayMicroseconds(T_CARRIER);
digitalWrite(LED_PIN, LOW);
delayMicroseconds(T_CARRIER);
i+=(2 * T_CARRIER);
}
delayMicroseconds(T_SHORT);
}

//send an On Bit
void sendOneBit()
{
int i = 0;
while(i < T_LONG)
{
digitalWrite(LED_PIN, HIGH);
delayMicroseconds(T_CARRIER);
digitalWrite(LED_PIN, LOW);
delayMicroseconds(T_CARRIER);
i+=(2 * T_CARRIER);
}
delayMicroseconds(T_SHORT);
}

//send an Off Bit
void sendZeroBit()
{
int i = 0;
while(i < T_SHORT)
{
digitalWrite(LED_PIN, HIGH);
delayMicroseconds(T_CARRIER);
digitalWrite(LED_PIN, LOW);
delayMicroseconds(T_CARRIER);
i+=(2 * T_CARRIER);
}
delayMicroseconds(T_SHORT);
}



More to come...