Pages: [1]   Go Down
Author Topic: IR receiver , unusual remote DVD control  (Read 902 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello ,
i have problem with my IR receiver . I'm trying to construct project which can control motor through remote DVD control . I found this libraby for IR remote http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html but I'm trying to "tune" with my remote DVD control. I found similar type of it ( i have Philips DVP5140 but the remote control of Philips DVP-5982 looks like equally ). But the bigest problem with library is that when I try to send signals to IR receiver (connect with arduino) I receive zero ("0") ( I receive this for all remote control which I have :
I have this IR receiver http://catalog.osram-os.com/catalogue/catalogue.do?favOid=00000002000246c8001c0023&act=showBookmark
Code:
/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}
and it doesnt matter what i press :

Greetings from Czech republic and sorry for my english. Thank you in advance.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the IRRemote library doesn't recognize the encoding scheme it will provide only the raw pulse times.  Here is an article about using unknown remotes:

http://www.arcfn.com/2010/01/using-arbitrary-remotes-with-arduino.html
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried it , but the result is interesting for me :

I recived different values but I pressed only ONE button. That means what ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And when I use different remote control I received first value diferent but when I keep button pressed I receive the same value for rest of value :
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some remotes send the same code repeatedly.  Some send a "repeat" code to indicate that the same button is held down.  You write your code to do what you want with the information you get.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I did it and I have some "number of button" and I also know which button was pressed .
Code:
unsigned long hash = decodeHash(&results);
    Serial.print(hash); //additions for control
    if(hash == 3398190446) // this is number for button 1
    {     
      digitalWrite(3,HIGH);     
     
    }else if ( hash == 3717434288 ) // this is number for button 2
      {       
        digitalWrite(3,HIGH);     
     }
     else {
        digitalWrite(3,LOW);
        }

But I need know how I can recongnize that the button is still pressed (the problem is that then remote control send different "number" and I dont know how I "keep the light on"). Can you suggest any solution.
Logged

IRL
Offline Offline
Full Member
***
Karma: 0
Posts: 146
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

get a generic remote control
Logged

I also have PIC related web domain.

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am sorry but I dont understand what you write . Can you explain it a bit ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can somebody help me ? I have spent with it almost 3 hours and I'm exhausted . I work towards this one :
Code:
unsigned long hash = decodeHash(&results);
    Serial.print(hash);
    if(hash != 1253111734){
      volba = hash;
      }
    if(hash == 1253111734 && volba == 3398190446){   
      digitalWrite(3,HIGH);
      }else if(hash == 1253111734 && volba == 3717434288){   
      digitalWrite(3,HIGH);
      }
    irrecv.resume();
but I still don't know where I should place digitalWrite(3,LOW) . I tried a few possibilities but no one work as I want . Idea is simply = when the button is pushed - LED turn on and when the button is not pushed - LED off .
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Idea is simply = when the button is pushed - LED turn on and when the button is not pushed - LED off .

Unfortunately the remote doesn't send a message for "The button is not pushed".  Perhaps you should restart a timer each time you get the "Button is pressed" message and, if the time runs out, turn off the LED.

Code:
unsigned long LastTimeButtonWasPressed;

void loop()
    {
    if (received a button pressed message)
            {
            turn on LED;
            buttonIsPressed = true;
            LastTimeButtonWasPressed = millis();
            }

    if (buttonIsPressed && millis() - LastTimeButtonWasPressed > 100)
         {
         turn off LED;
         buttonIsPressed = false;
         }
    }
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

WOW it works. Although when the LED should turn on then LED blinks but it doesn't matter ( it may be caused complexity of code ). For my purpose is it sufficient , at least I think.Thank you for your time and your very important advice .
Logged

Pages: [1]   Go Up
Jump to: