0

Problems sending IR signals
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problems sending IR signals

by tlerdrden on Sun Sep 15, 2013 12:20 pm

Hi Adafruit,
I am trying to switch on / off my D_V_D player - sony dvp-sr100- with an IR LED.
I've monitored the signal received with one IR sensor and later I've programmed the sketch according to the tutorial created by ladyada -http://learn.adafruit.com/ir-sensor/overview-.
However, I am unable to communicate with the D_V_D player. One of my main doubts is that I don't receive always the same signal. For example, the first time you monitor the ir signal you get:

Code: Select all | TOGGLE FULL SIZE
OFF    ON
17928 usec, 2400 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 620 usec
540 usec, 640 usec
520 usec, 640 usec
520 usec, 1240 usec
520 usec, 640 usec
520 usec, 1220 usec
540 usec, 1220 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 640 usec
540 usec, 1200 usec
540 usec, 640 usec
520 usec, 640 usec
540 usec, 1220 usec
520 usec, 640 usec
13000 usec, 2400 usec
520 usec, 1200 usec
560 usec, 640 usec
520 usec, 1240 usec
520 usec, 600 usec
560 usec, 1220 usec
520 usec, 640 usec
540 usec, 620 usec
540 usec, 1220 usec
520 usec, 640 usec
13020 usec, 2400 usec
520 usec, 1220 usec
540 usec, 620 usec
540 usec, 1220 usec
540 usec, 620 usec
540 usec, 1220 usec
520 usec, 640 usec
540 usec, 620 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 1220 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 640 usec
520 usec, 1240 usec
520 usec, 640 usec
520 usec, 640 usec
540 usec, 1220 usec
520 usec, 640 usec
13240 usec, 2400 usec
540 usec, 1200 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 620 usec
540 usec, 640 usec
520 usec, 640 usec
540 usec, 1220 usec
520 usec, 640 usec
540 usec, 1220 usec
520 usec, 1240 usec
520 usec, 1220 usec
520 usec, 640 usec
520 usec, 660 usec
520 usec, 1220 usec
520 usec, 640 usec
540 usec, 620 usec
540 usec, 1220 usec
520 usec, 660 usec
13000 usec, 2400 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 620 usec
540 usec, 1220 usec
520 usec, 640 usec
540 usec, 620 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1200 usec
560 usec, 1220 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 640 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 640 usec
540 usec, 1220 usec

520 usec, 640 usec

And the second time:


Code: Select all | TOGGLE FULL SIZE
OFF    ON
63732 usec, 2400 usec
520 usec, 1220 usec
540 usec, 620 usec
540 usec, 1220 usec
520 usec, 640 usec
540 usec, 1200 usec
540 usec, 640 usec
540 usec, 600 usec
560 usec, 620 usec
540 usec, 1200 usec
560 usec, 600 usec
560 usec, 1200 usec
540 usec, 1200 usec
560 usec, 1200 usec
560 usec, 600 usec
560 usec, 600 usec
560 usec, 1200 usec
560 usec, 600 usec
560 usec, 620 usec
560 usec, 1180 usec
560 usec, 600 usec
13040 usec, 2360 usec
560 usec, 1200 usec
560 usec, 600 usec
560 usec, 1200 usec
560 usec, 600 usec
560 usec, 1240 usec
520 usec, 620 usec
560 usec, 600 usec
560 usec, 620 usec
540 usec, 1200 usec
560 usec, 600 usec
560 usec, 1200 usec
560 usec, 1200 usec
540 usec, 1200 usec
560 usec, 600 usec
560 usec, 620 usec
540 usec, 1200 usec
560 usec, 620 usec
540 usec, 620 usec
560 usec, 1180 usec
560 usec, 620 usec


Some useful information:
- I've used a camera to ensure that the IR LED changes its colour when I make some pulse.
- I've used a resistor of 220Ohm.

So here are my questions:

- Why the signal received changes?
- I've programmed the sketch with these two possibilites, but I don't have any communication with the D_V_D...Why?

Please, ¿Can you help me?

Thanks in advance,

tlerdrden
 
Posts: 79
Joined: Fri Nov 30, 2012 4:46 pm

Re: Problems sending IR signals

by adafruit_support_rick on Mon Sep 16, 2013 7:10 pm

Differences of 20 or 40 usec are not significant.
The sequences you post contain several commands. Try it with just this one:
Code: Select all | TOGGLE FULL SIZE
OFF    ON
17928 usec, 2400 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 1220 usec
540 usec, 620 usec
540 usec, 640 usec
520 usec, 640 usec
520 usec, 1240 usec
520 usec, 640 usec
520 usec, 1220 usec
540 usec, 1220 usec
520 usec, 1220 usec
540 usec, 640 usec
520 usec, 640 usec
540 usec, 1200 usec
540 usec, 640 usec
520 usec, 640 usec
540 usec, 1220 usec
520 usec, 640 usec

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Problems sending IR signals

by tlerdrden on Tue Sep 17, 2013 3:32 pm

Thanks a lot for your answer!
I haven't had luck yet :(, and I don't know what's the problem...
I think that I am using the right hardware - my only doubt was the resistor value because with too high values the signal emitted could be too weak but I've made tests with resistors of values between 39 and 330 Ohm-... And I can see how the led lights with my camera so... I guess that the only thing I can review is the code I'm sending to the D_V_D player.
For instance, if I have received the following code:

Code: Select all | TOGGLE FULL SIZE
OFF    ON
57980 usec, 8300 usec
4060 usec, 560 usec
1500 usec, 560 usec
1500 usec, 560 usec
460 usec, 540 usec
500 usec, 560 usec
460 usec, 560 usec
1500 usec, 540 usec
500 usec, 560 usec
1500 usec, 540 usec
1520 usec, 560 usec
1500 usec, 560 usec
1500 usec, 560 usec
480 usec, 520 usec
1540 usec, 540 usec
480 usec, 560 usec
480 usec, 520 usec
500 usec, 520 usec
20120 usec, 560 usec
1500 usec, 580 usec
1500 usec, 560 usec
460 usec, 560 usec
460 usec, 560 usec
480 usec, 520 usec
1540 usec, 560 usec
460 usec, 560 usec
480 usec, 520 usec
500 usec, 560 usec


The code in my Arduino sketch should be:

Code: Select all | TOGGLE FULL SIZE
// This sketch will send out a Nikon D50 trigger signal (probably works with most Nikons)
// See the full tutorial at http://www.ladyada.net/learn/sensors/ir.html
// this code is public domain, please enjoy!
 
int IRledPin =  13;    // LED connected to digital pin 13
 
// The setup() method runs once, when the sketch starts
 
void setup()   {               
  // initialize the IR digital pin as an output:
  pinMode(IRledPin, OUTPUT);     
 
  Serial.begin(9600);
}
 
void loop()                     
{
  Serial.println("Sending IR signal");
//  SendNikonCode();
  code();
  delay(8*1000);  // wait (8 seconds * 1000 milliseconds)
}
 
// This procedure sends a 38KHz pulse to the IRledPin
// for a certain # of microseconds. We'll use this whenever we need to send codes
void pulseIR(long microsecs) {
  // we'll count down from the number of microseconds we are told to wait
 
  cli();  // this turns off any background interrupts
 
  while (microsecs > 0) {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IRledPin, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(10);         // hang out for 10 microseconds, you can also change this to 9 if its not working
   digitalWrite(IRledPin, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(10);         // hang out for 10 microseconds, you can also change this to 9 if its not working
 
   // so 26 microseconds altogether
   microsecs -= 26;
  }
 
  sei();  // this turns them back on
}
void code(){
pulseIR(8300);
delayMicroseconds(4060);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(560);
delayMicroseconds(460);
pulseIR(540);
delayMicroseconds(500);
pulseIR(560);
delayMicroseconds(460);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(540);
delayMicroseconds(500);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(540);
delayMicroseconds(1520);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(560);
delayMicroseconds(480);
pulseIR(520);
delayMicroseconds(1540);
pulseIR(540);
delayMicroseconds(480);
pulseIR(560);
delayMicroseconds(480);
pulseIR(520);
delayMicroseconds(500);
pulseIR(520);
delayMicroseconds(20120);
pulseIR(560);
delayMicroseconds(1500);
pulseIR(580);
delayMicroseconds(1500);
pulseIR(560);
delayMicroseconds(460);
pulseIR(560);
delayMicroseconds(460);
pulseIR(560);
delayMicroseconds(480);
pulseIR(520);
delayMicroseconds(1540);
pulseIR(560);
delayMicroseconds(460);
pulseIR(560);
delayMicroseconds(480);
pulseIR(520);
delayMicroseconds(500);
pulseIR(560);
}

What am I doing wrong? Why my Arduino can't communicate with any of my IR devices?
Thanks a lot for your answer, :D
Regards,
T.

tlerdrden
 
Posts: 79
Joined: Fri Nov 30, 2012 4:46 pm

Re: Problems sending IR signals

by tlerdrden on Thu Sep 19, 2013 10:36 am

already solved! Thanks a lot Adafruit!

tlerdrden
 
Posts: 79
Joined: Fri Nov 30, 2012 4:46 pm

Re: Problems sending IR signals

by adafruit_support_rick on Thu Sep 19, 2013 10:58 am

What was the solution?

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Problems sending IR signals

by tlerdrden on Fri Sep 20, 2013 4:25 pm

Hi Adafruit,
I think the angle between the LED and the television is key, but I can not assure that has been the problem because then I have seen the system running with the LED in vertical position.
Anyway,I want to go further and control the entire functions of my TV, but I have an strange problem:
It seems that the "8 button code" interferes with other keys such as turning off the television / increase vol me / teletext ...
When I disable thev"8, button code", all other keys work without problems, but instead, when the "8 button code" is activated, some also respond as if you pressed the button number 8. For instance, when you push the "switch off button", instead to switch off the TV, you switch to the channel 8 of your TV.
Here I attach the "8 button code" :
Code: Select all | TOGGLE FULL SIZE
pulseIR(8840);
delayMicroseconds(4360);
pulseIR(580);
delayMicroseconds(520);
pulseIR(580);
delayMicroseconds(540);
pulseIR(540);
delayMicroseconds(560);
pulseIR(540);
delayMicroseconds(540);
pulseIR(580);
delayMicroseconds(520);
pulseIR(540);
delayMicroseconds(560);
pulseIR(600);
delayMicroseconds(480);
pulseIR(580);
delayMicroseconds(520);
pulseIR(560);
delayMicroseconds(1620);
pulseIR(600);
delayMicroseconds(1600);
pulseIR(580);
delayMicroseconds(1640);
pulseIR(540);
delayMicroseconds(1640);
pulseIR(580);
delayMicroseconds(1640);
pulseIR(540);
delayMicroseconds(1640);
pulseIR(580);
delayMicroseconds(1600);
pulseIR(580);
delayMicroseconds(540);
pulseIR(540);
delayMicroseconds(560);
pulseIR(580);
delayMicroseconds(500);
pulseIR(580);
delayMicroseconds(520);
pulseIR(580);
delayMicroseconds(520);
pulseIR(560);
delayMicroseconds(1620);
pulseIR(560);
delayMicroseconds(560);
pulseIR(540);
delayMicroseconds(520);
pulseIR(600);
delayMicroseconds(520);
pulseIR(580);
delayMicroseconds(1600);
pulseIR(580);
delayMicroseconds(1640);
pulseIR(540);
delayMicroseconds(1640);
pulseIR(580);
delayMicroseconds(1600);
pulseIR(600);
delayMicroseconds(520);
pulseIR(580);
delayMicroseconds(1600);
pulseIR(580);
delayMicroseconds(1640);
pulseIR(540);
delayMicroseconds(1640);
pulseIR(560);
delayMicroseconds(40160);
pulseIR(8820);
delayMicroseconds(2180);
pulseIR(580);
delayMicroseconds(28544);
pulseIR(8860);
delayMicroseconds(2160);
pulseIR(560);
delayMicroseconds(28564);
pulseIR(8840);
delayMicroseconds(2180);
pulseIR(560);

 
Here the "switch off TV button":
Code: Select all | TOGGLE FULL SIZE
delayMicroseconds(40020);
 pulseIR(8860);             //1
 delayMicroseconds(4340);   //1
 pulseIR(620);              //2
 delayMicroseconds(500);    //2
  pulseIR(580);             //3
 delayMicroseconds(500);    //3
  pulseIR(600);             //4
 delayMicroseconds(480);    //4
  pulseIR(620);             //5
 delayMicroseconds(500);    //5
 pulseIR(600);              //6
 delayMicroseconds(500);    //6
  pulseIR(580);             //7
 delayMicroseconds(500);    //7
 pulseIR(600);              //8
 delayMicroseconds(500);    //8
 pulseIR(600);              //9
 delayMicroseconds(500);    //9
 pulseIR(580);              //10
 delayMicroseconds(1620);   //10
 pulseIR(600);              //11
 delayMicroseconds(1580);   //11
 pulseIR(600);              //12
 delayMicroseconds(1620);   //12
 pulseIR(580);              //13
 delayMicroseconds(1600);   //13
 pulseIR(600);              //14
 delayMicroseconds(1580);   //14
 pulseIR(620);              //15
 delayMicroseconds(1600);   //15
 pulseIR(580);              //16
 delayMicroseconds(1620);   //16
 pulseIR(600);              //17
 delayMicroseconds(480);    //17
 pulseIR(600);              //18
 delayMicroseconds(480);    //18
 pulseIR(620);              //19
 delayMicroseconds(500);    //19
 pulseIR(600);              //20
 delayMicroseconds(500);    //20
 pulseIR(580);              //21
 delayMicroseconds(1600);   //21
 pulseIR(620);              //22
 delayMicroseconds(1580);   //22
 pulseIR(600);              //23
 delayMicroseconds(500);    //23
 pulseIR(600);              //24
 delayMicroseconds(500);    //24
 pulseIR(580);              //25
 delayMicroseconds(500);    //25
 pulseIR(620);              //26
 delayMicroseconds(1600);   //26
 pulseIR(580);              //27
 delayMicroseconds(1600);   //27
 pulseIR(600);              //28
 delayMicroseconds(1580);   //28
 pulseIR(620);              //29
 delayMicroseconds(500);    //29
 pulseIR(600);              //30
 delayMicroseconds(500);    //30
 pulseIR(580);              //31
 delayMicroseconds(1600);   //31
 pulseIR(600);              //32
 delayMicroseconds(1580);   //32
 pulseIR(620);              //33
 delayMicroseconds(1600);   //33
 pulseIR(600);              //34
 delay(40);
 pulseIR(8860);             //35
 delay(2);
 pulseIR(620);              //36
 delay(28);
 pulseIR(8860);             //37
 delay(2);
 pulseIR(600);              //38

Why happens?
Thank you very much again, you are the best!
Regards,
T.

tlerdrden
 
Posts: 79
Joined: Fri Nov 30, 2012 4:46 pm

Re: Problems sending IR signals

by adafruit_support_rick on Fri Sep 20, 2013 4:51 pm

I don't know why that would happen. Those are two different code sequences. You may have sampled the OFF button incorrectly. I would try sampling it again.

By the way, using your numbering of the OFF code, each code will have 33 pairs. You can delete everything after the pair numbered 33.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.