RC5 or RC6

hi.
Bought my Phillips tv in europe april 2009

Does anyone know what protcol is used for this remote ir device?

And while into it, ive searched for the rc6, visual timer scheme but not found any. Anyone?

(I plan to waitfor and read command bits. Have to find time to wait and delay between the readings.

(from another post ive read, its 4752/1728 uS for the 6 bit commandcode regarding rc 5. I THINK its 8887/? for the 8bit commandcode regarding rc6.

I tried out the 6 bit rc5 code, but dont get any meaningful readings, wondering if my TV-controller is using rc6 protocol.

(I would use a scope to view the signal output, but im on holiday. Will post some pics from it when holidays ends)

Anyone?

Below is the snipped of my trialprogram regarding RC5
Thank You

#define antall 11

int IRpin = 11;

int tab[antall];
byte change_count;
long time;
long int timer1;
long timer2=1728;
long timer3=4752;
int teller;

void setup() {
Serial.begin(9600);

pinMode(IRpin, INPUT);
}

void loop()
{
while(digitalRead(IRpin) == HIGH) {}

timer1=micros();
while((micros()-timer1)<timer3) {} // waitfor the adressbits
// Serial.println(micros()-timer1);

teller=0;
while(teller<antall) // read the following 5xadressbits + 6xcommandbits
{

tab[teller]=digitalRead(IRpin);
timer1=micros();

while((micros()-timer1)<timer2){} //waitfor next middlepoint to read
teller++;
}

Serial.println("Bit stream detected!");
teller=0;

while(teller<antall)
{
Serial.println(tab[teller]);
teller++;
}
delay(2000);
teller=0;
}

I included the digitalRead in the while statement to get a more correct waitingtime.

.
.
timer1=micros();
tab[teller]=digitalRead(IRpin);
while((micros()-timer1)<timer2){} //waitfor next middlepoint to read
teller++;

Using below values and changing antall to 16, gives me a binary read of the 0's that fit for the Phillips TV controller regarding keys 0-9.

But its not accurate, so stil miss that oscilloscope to adjust.

regards

.
.
long timer2=888;
long timer3=9331;

just attached the last worked code below for my Phillips remote tv controller (probably rc6):

#define antall 16

int IRpin = 11;

int tab[antall];
long time;
long timer1;
long timer2=888;
long timer3=9331;
int teller;

void setup() {
Serial.begin(9600);

pinMode(IRpin, INPUT);
}

void loop()
{
while(digitalRead(IRpin) == HIGH) {}

timer1=micros();
while((micros()-timer1)<timer3) {} // waitfor the adressbits
// Serial.println(micros()-timer1);

teller=0;
while(teller<antall) // read the following adress and command bits
{
timer1=micros();
tab[teller]=digitalRead(IRpin);
while((micros()-timer1)<timer2){} //waitfor next middlepoint to read
teller++;
// Serial.println(micros()-timer1);
}

teller=0;
while(teller<antall)
{
Serial.println(tab[teller]);
teller++;
}
delay(2000);
teller=0;

Serial.println("----------");
}

adding code below will store which key is pressed on remotecontrol, into variable named key. Is sure is more elegant methode to convert from binary to decimal.

// convert binary content of last 8 bits (commandbits) tab[] to the key number pressed. tab[15] (LSB) to tab[8] (MSB)
// weigth 1-2-4-8-16-32-64-128

teller=15;
key=0;
while(teller>7)
{
switch(teller)
{
case 15:
if(tab[teller]==0){ key=key+1;} else {key=key+0;}
break;

case 14:
if(tab[teller]==0) {key=key+2;} else {key=key+0;}
break;

case 13:
if(tab[teller]==0) {key=key+4;} else {key=key+0;}
break;

case 12:
if(tab[teller]==0) {key=key+8;} else {key=key+0;}
break;

case 11:
if(tab[teller]==0) {key=key+16;} else {key=key+0;}
break;

case 10:
if(tab[teller]==0) {key=key+32;} else {key=key+0;}
break;

case 9:
if(tab[teller]==0) {key=key+64;} else {key=key+0;}
break;

case 8:
if(tab[teller]==0) {key=key+128;} else {key=key+0;}
break;

} // end switch

teller--;
} // end while loop

Serial.print("Key pressed is ");
Serial.println(key);

to get full 255 readable codes, my thoughts is:

Watch the flipp bit and read next key pressed, but thats another story

Then move this program into an interrupt function.

regards

forgot. You get the control keys on remote too. That makes it a bit more than the 10 singleclick numbers

Mainly the simplest way to know whether RC-5 or RC-6 is used is by the number of channels, if it's 90 channel TV or less then it must be RC-5 if it's 200-300 channel or something like that it must be RC-6 because of new technology in new TV system's

Nishant:
Mainly the simplest way to know whether RC-5 or RC-6 is used is by the number of channels, if it's 90 channel TV or less then it must be RC-5 if it's 200-300 channel or something like that it must be RC-6 because of new technology in new TV system's

Thanks. I think its the rc6.

regards

Adding a simple interrupt and getting rid of memorystealer table.

/*
This program decodes which key is pressed on a Philips TV remote control, following a Philips TV bought in 2009.
It uses an interrupt to detect when a digital signal at pin 2 is LOW. The interruptfunction then sets a flag.
A switch is used on flag content. If its 1, then detection of the 16 following databits is done and stored in tab[].
Then the decimal value of the binary content of tab[] (containing the 8 commandbits are fount and stored
in the 'key' variable.
An Arduino UNO microcontroller and an IR sensor of type SFH 5110-36 was used in this project.
*/

#define antall 16 // set how many bits You want to detect after the awaiting periode of timer3.
volatile byte flag=0; // define volatile as it uses var in interrupt function
byte IRpin = 2; // pin MUST be a pin attached to interrups which varies at diffrent types of arduino microcontrollers
long timer1;
int timer2=888; // timedelay between middlepoints (of 8 adress bits and 8 command bits)
int timer3=9331; // timedelay from LOW to first middlepoint of first adressbit
byte teller;
int container;
byte bitnum; // number will not increase 255
void lesdata();

void setup()
{
Serial.begin(9600); // start serial communication
pinMode(IRpin, INPUT); // set content of variable IRpin as input
attachInterrupt(0, setflag, LOW); // set interrupt 0 (at pin2) and call function setflag() when signal changes to LOW-lvl (key pressed at remote control)
}

void loop()
{

switch(flag)
{
case 0: // do nothing
break;

case 1: // find which philips remote key has been pressed

timer1=micros(); // get current time
while((micros()-timer1)<timer3) {} // waitfor the adressbits

teller=0; container=0; bitnum=15;
while(teller<antall) // read the following 8 adress and 8 command bits
{
timer1=micros();
bitWrite(container, bitnum, !(digitalRead(IRpin))); // read bit,invert it, and write bit in correct position of the container-variable
teller++; bitnum--;
while((micros()-timer1)<timer2){} //waitfor next (middle) point to read. Ive not checked with oscilloscope yet, bet Im on the last quarterpart of bits read
}
teller=0; bitnum=0; flag=0;
Serial.println(container);
attachInterrupt(0, setflag, LOW); // turn on interrups again as were finished getting the number of key pressed
break;

} // end switch flag...

} // end loopfunk

void setflag() // interruptfunction changes flag content to 1
{
flag=1;
detachInterrupt(0); // turn off interrupt as we dont want interrupt during read of further 0-bits in adress and command bits
}

heres a pic of the burst for remote control key 0

and the remote key 1 pressed: