Help needed to understand and make an IR Remote.

Hi friends,
I'm new to electronics so please be patient with me :wink:

I have a Leonardo board and i'm trying to make it communicate with my Samsung TV.
I've connected IR Led to PIN3 and tried to use IRremote library, but it seems that no singal is outputted (timer problem?!).

I've read a milion texts about IR and protocols, but I haven't found any SIMPLE (so I can see what is what) program to send signal.

IRremote dump from my Samsung remote gave:

E0E020DF (32 bits)
Raw (68): -28516 4450 -4450 550 -1650 600 -1650 550 -1650 600 -500 600 -550 550 -550 550 -550 600 -500 550 -1650 600 -1650 550 -1650 600 -500 600 -550 550 -550 550 -550 600 -500 600 -500 600 -500 600 -1650 550 -550 600 -500 600 -500 600 -550 550 -550 550 -1650 600 -1650 550 -550 550 -1650 550 -1650 600 -1600 600 -1650 600 -1600 600

Here's my remote:

http://lirc.sourceforge.net/remotes/samsung/BN59-00507A

And here is something that I think should be useful:

http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-1-getting-started/

Thanks for all Your help :slight_smile:

Hi,you test it with IRrecord from Ken Shirriff's IR library? You must connect a button to send back the IR signal...or test it with IRsendDemo....change Sony with NEC protocol and 32 bit....look my site for Samsung TV example....irsend.sendNEC(0xE0E020DF, 32); // Samsung TV power code without for....loop...
I think the problem is the header pulses.Samsung header is 4450 -4450 ( look your raw ), NEC header is 9000 -4500 in this case you can follow this way.....Reading IR Commands | IR Sensor | Adafruit Learning System it definitely works...
but needs more work from user....modify this example...

    // 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();
    delay(60*1000); // wait one minute (60 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 SendNikonCode() {
    // This is the code for my particular Nikon, for others use the tutorial
    // to 'grab' the proper code from the remote
    pulseIR(2080);
    delay(27);
    pulseIR(440);
    delayMicroseconds(1500);
    pulseIR(460);
    delayMicroseconds(3440);
    pulseIR(480);
    delay(65); // wait 65 milliseconds before sending it again
    pulseIR(2000);
    delay(27);
    pulseIR(440);
    delayMicroseconds(1500);
    pulseIR(460);
    delayMicroseconds(3440);
    pulseIR(480);
    }

My Toshiba TV , header pulses : 9000 4500

name  Toshiba_CT-9573
   bits           16
   flags SPACE_ENC|CONST_LENGTH
   eps            30
   aeps          100

   header       9107  4413

and works fine with sendNEC command (Ken Shirriff's IR library).....for NEC protocol...

Another solution is edit/modify the Ken Shirriff's IR library inside NEC protocol header, change it with 4500,4500...or make new protocol Samsung protocol....to help and others users...

Hi,
thanks for Your help!!

I've tried IRrecord, still no good. I've also tried adding Samsung protocol (from Maarten Damen project). Also tried RC5 protocol on my other TV. As I said - it's seems that there is no output signal on IR LED (the diode doesn't flash when watching through camera). That's why I think the best way would be if I write my own program.

Some useful stuff You send me - thanks!! I'll get down to reading as soon as I have a while. But could You tell me, what can I read from that raw dump that I have from IRdump?
Does it tell for example: pulse IR for X time and wait for Y ?

Once again thank You for Your help.

Hi, Yes... pulseIR is On pulses PWM....delay() is wait...off...nothing...

    pulseIR(4450);//On PWM 
    delayMicroseconds(4450);//Off
    pulseIR(550);
    delayMicroseconds(1650);
    pulseIR(600);
    delayMicroseconds(1650);
    .......

Reply me if it works....check your IR LED also you must use PWM digital output...

Check out Ken Shirriff's IR library. It's very easy to use and quite stable. I beat my head over getting reliable IR signals back and forth forever before I found that.

He has a link to the code, along with some samples, on his blog.

@power7net

Yes, yes, yes :slight_smile: full success!! I used the plusIR and worked great! Three more, additional questions:

  1. And what does this tell me? E0E020DF (32 bits) and could it be converted to raw singal?
  2. Do You have any experience with RF remotes? The next step is to control my LED RGB stripe (I have a driver controlled by RF Remote)
  3. Will You be in Poland any time soon? I'd like to buy You a beer or two for all Your help :slight_smile:

@tbradt

I've tried IRremote lib - didn't work

Nice....Thanks....look....Your pulse is ....

pulseIR(4450);//On PWM Header
    delayMicroseconds(4450);//Off Header
    pulseIR(550);
    delayMicroseconds(1650); bit 1
    pulseIR(600);
    delayMicroseconds(600); bit 0
    .......

E0E0....is HEX number if you convert to binary is....1110000011100000......

If you visit my site i have a project to control IR devices from android via arduino and bluetooth module....
with extra RF module you can expand the range....