IR Timed Repeater - to controll TV

Hey all, im trying to do repeater for IR TV remote control. What I want to do is to record the IR pulse of spesific button (w/o caring what the encoding is) and tem play it back when i want to. ex so i can turn of TV if im not at home :)

Should of been easy project, but something is not right here :( I went and got IR reviver and transmiter from radio shack and put them in as Button and LED. OK so far now i used this script to record readings (http://www.arduino.cc/playground/Code/InfraredReceivers)

Then i made small program to re-send collected data in givven intervales.... now here comes the prpblem, it does not work :)

I send data to IR LED but TV does not turn on when i send the command :(

Any one can help me out?

My code to send IRs

int ledPin =  12;    // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup()   {                
  // initialize the digital pin as an output:
  pinMode(ledPin, OUTPUT);     
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()                     
{

   IR_SEND(4, 0);

 IR_SEND(191668, 0);

 IR_SEND(191668, 1);

 IR_SEND(191692, 1);

 IR_SEND(191692, 0);

 IR_SEND(191696, 0);

 IR_SEND(191696, 1);

 IR_SEND(191720, 1);

 IR_SEND(191720, 0);

 IR_SEND(191728, 0);

 IR_SEND(191728, 1);

 IR_SEND(191744, 1);

 IR_SEND(191744, 0);

 IR_SEND(191752, 0);

 IR_SEND(191752, 1);

 IR_SEND(191772, 1);

 IR_SEND(191772, 0);

 IR_SEND(191780, 0);

 IR_SEND(191780, 1);

 IR_SEND(191796, 1);

 IR_SEND(191796, 0);

 IR_SEND(191804, 0);

 IR_SEND(191804, 1);

 IR_SEND(191824, 1);

 IR_SEND(191824, 0);

 IR_SEND(191832, 0);

 IR_SEND(191832, 1);

 IR_SEND(191852, 1);

 IR_SEND(191852, 0);

 IR_SEND(191856, 0);

 IR_SEND(191856, 1);

 IR_SEND(191880, 1);

 IR_SEND(191880, 0);

 IR_SEND(191884, 0);

 IR_SEND(191884, 1);

 IR_SEND(191904, 1);

 IR_SEND(191904, 0);

 IR_SEND(191908, 0);

 IR_SEND(191908, 1);

 IR_SEND(191932, 1);

 IR_SEND(191932, 0);

 IR_SEND(191936, 0);

 IR_SEND(191936, 1);

 IR_SEND(191956, 1);

 IR_SEND(191956, 0);

 IR_SEND(191960, 0);

 IR_SEND(191960, 1);

 IR_SEND(191984, 1);

 IR_SEND(191984, 0);

 IR_SEND(191992, 0);

 IR_SEND(191992, 1);

 IR_SEND(192008, 1);

 IR_SEND(192008, 0);

 IR_SEND(192016, 0);

 IR_SEND(192016, 1);

 IR_SEND(192036, 1);

 IR_SEND(192036, 0);

 IR_SEND(192044, 0);

 IR_SEND(192044, 1);

 IR_SEND(192060, 1);

 IR_SEND(192060, 0);

 IR_SEND(192068, 0);

 IR_SEND(192068, 1);

 IR_SEND(192092, 1);

 IR_SEND(192092, 0);

 IR_SEND(192096, 0);

 IR_SEND(192096, 1);

 IR_SEND(192116, 1);

 IR_SEND(192116, 0);

 IR_SEND(192120, 0);

 IR_SEND(192120, 1);

 IR_SEND(192144, 1);

 IR_SEND(192144, 0);

 IR_SEND(192148, 0);

 IR_SEND(192148, 1);

 IR_SEND(192168, 1);

 IR_SEND(192168, 0);

 IR_SEND(192172, 0);

 IR_SEND(192172, 1);

 IR_SEND(192196, 1);

 IR_SEND(192196, 0);

 IR_SEND(192200, 0);

 IR_SEND(192200, 1);

 IR_SEND(192220, 1);

 IR_SEND(192220, 0);

 IR_SEND(192228, 0);

 IR_SEND(192228, 1);

 IR_SEND(192248, 1);

 IR_SEND(192248, 0);

 IR_SEND(192256, 0);

 IR_SEND(192256, 1);

 IR_SEND(192272, 1);

 IR_SEND(192272, 0);

 IR_SEND(192280, 0);

 IR_SEND(192280, 1);

 IR_SEND(192300, 1);

 IR_SEND(192300, 0);

 IR_SEND(192308, 0);

 IR_SEND(192308, 1);

 IR_SEND(192324, 1);

 IR_SEND(192324, 0);

 IR_SEND(192332, 0);

 IR_SEND(192332, 1);

 IR_SEND(192356, 1);

 IR_SEND(192356, 0);

 IR_SEND(192360, 0);

 IR_SEND(192360, 1);

 IR_SEND(192380, 1);

 IR_SEND(192380, 0);

 IR_SEND(192384, 0);

 IR_SEND(192384, 1);

 IR_SEND(192408, 1);

 IR_SEND(192408, 0);

 IR_SEND(192412, 0);

 IR_SEND(192412, 1);

 IR_SEND(192432, 1);

 IR_SEND(192432, 0);

 IR_SEND(192436, 0);

 IR_SEND(192436, 1);

 IR_SEND(192460, 1);

 IR_SEND(192460, 0);

 IR_SEND(192468, 0);

 IR_SEND(192468, 1);

 IR_SEND(192484, 1);

 IR_SEND(192484, 0);

 IR_SEND(192492, 0);

 IR_SEND(192492, 1);


  
  //delay(5000);  
}

//Lets try ctreate universal function for us
void IR_SEND(long time, int value){
  if(value==1){
    //Show high
    digitalWrite(ledPin, HIGH);
  }else{
    //Show low
    digitalWrite(ledPin, LOW);  
  }
  delay(time/2500);
       
}

Something doesn't look right here. You're sending bits with delays like 191720 which, divided by 2500, gives something like 77 milliseconds. Infrared transmissions do not spend nearly that much time from one bit to another. Usually it's measured in microseconds.

You will have to use the timer resources or the delayMicroseconds() function to get down to that level.

Our Gadget Shield can be used to do what you are looking for: record an arbitrary infrared transmission then play it back (it can even store them in EEPROM for playing back later!) Also, the code for doing that is on our web site so maybe you can use it as a prototype.

-- Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

just changed delay() to delayMicroseconds(time); that did not help :(

I can try the soft posted on your site but it seams comlex as it is univerasal for various boards :( I dont think i need actual shild for this?

delays like 191720 which, divided by 2500, gives something like 77 milliseconds

Is that the delay? Or is it like a point in time? I see that the value there goes up by a small amount(4-8 units) every other line. Id it was a delay for a frequency, it would be a constant amount. I have never worked with this kind of project, though. Just an idea.

to me amounts like "191720" are delay, but i dont know for sure, im not an expert in this things at all.

I just used the script i linked to, to record data and that i use that data.

What makes me cautious is that data never constant, i mean 1 & 0 semas to be in the same order but the first # like 191720 seam dto be completly different all that time...

So if we assume that it is used for the requanct what shiuld the #s be?

Where is the code that generated the data?

here: http://www.arduino.cc/playground/Code/InfraredReceivers

I dont fully understand parts of so i dint mmodify anything in there :)

Hmmm..., most tv ir remotes toggle on/off without having descrete on and off buttons. Does yours have seperate on and off buttons?

I think it is the difference in integers that encodes the time delays, not the integers themselves.

191668–>191692: 24 microseconds
191692–>191696: 4 microseconds
etc.

Though even those times seem a bit short.


Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

well yes my small 7" LCD has ON and OFF buttons separatly on remote, still im not being abele to replicate any commands rgardless of tha fact taht buttons are separate

RuggedCircuits
Maybe you are right, but then i think in some cases # go to the small valuse so I would get negative valuse which is imposible… well i need to look up the log and figure out easy way to calcuate diferences, or better find existing sample codes :))