Pages: [1]   Go Down
Author Topic: Help please with IR remote control.  (Read 981 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I need help please with the IR remote control routine. So far I can get the key values from only one IR remote control. However, when I tried with a universal remote control and many others and I can't get any values from all those.

The IR receiver is attached to Arduino's pin 12. This is the code I am using:

Code:
#include <IRremote.h>
int device = 0;
int command = 0;

int RECV_PIN = 12;   //set to pin connected to IR decoder

IRrecv irrecv(RECV_PIN);

decode_results results;

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

void loop() {
 
  if(getIR()) {
    Serial.print("device number  ");
    Serial.println(device);
    Serial.print("key code   ");
    Serial.println(command);
    Serial.println();
  }
}


boolean getIR() {
  boolean valid = 0;
  if (irrecv.decode(&results)) {   
    device =  results.value >>24;
    command = lowByte(results.value - device);  //evaluates to 147
    irrecv.resume(); // Receive the next value

    if (device == 28) {   // 28 is decimal for 1C of 1C E350AF
      valid = 1;
    }
    else(valid = 0);
  }
  return (valid);
}

I need to make it work with the universal IR remote control. What am I doing wrong?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8084
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like you have not selected the right device code in your universal remote.
Logged

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

Dublin, Ireland
Offline Offline
Sr. Member
****
Karma: 12
Posts: 387
AnalysIR - IR Analyzer & Decoder for Arduino & MCUs
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

why not print out results.value via serial and debug from there...
Logged

Blog: http://www.AnalysIR.com/blog/     Twitter: @AnalysIR
Read ==> 10 common pitfalls with Infrared Remote Control :  http://bit.ly/1cvd0a

BCC AZ USA
Offline Offline
God Member
*****
Karma: 21
Posts: 930
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use the IR Dump example sketch to find out the device codes for your universal remote.  The device codes may be different depending on the device selected on the universal remote.  In other words, the device code for a VCR will be different from the code for a TV.  Then put the device code here: if (device == 28) {   // 28 is decimal for 1C of 1C E350AF. 
Logged

India
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Student
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello sir,

i am working on project  " IR remote controlled 6 switches". but, for convenient i am doing by any TV remote.

means, if i pressed power button of any TV remote then it will turn on 1st switch only and if pressed again then turn off.

so my 6 switches are correspond to following button of any TV remote(any means most of famous TV);-

1.power
2.mute
3.channel up
4.channel down
5.volume up
6.volume down

Now, for this as you got , i need list of this six button IR hex code for all famous TV brands.

So, please help me to find these code list else tedious work is to collect all remote , decode them and use them.
But, why reinvent wheel, if it is already invented by someone.

I may pay for list too.
Logged

Arduino is Awesome.....

Dublin, Ireland
Offline Offline
Sr. Member
****
Karma: 12
Posts: 387
AnalysIR - IR Analyzer & Decoder for Arduino & MCUs
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@jeny
I think the previous post to yours provides the best answer. Get a unversal remote and capture them for yourself, at least to prove the concept, for  TVs you have access to.

If its going to be a commercial product, proceed with caution & contact one of the main players to purchase their database.

There are some sites that have 'open' IR codes databases.

Try searching for LIRC and also remotecentral.com & hi-firemote.com

Its a lot of work to get a comprehensive database. If its a student project, might be a good idea to limit the scope.
Logged

Blog: http://www.AnalysIR.com/blog/     Twitter: @AnalysIR
Read ==> 10 common pitfalls with Infrared Remote Control :  http://bit.ly/1cvd0a

India
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Student
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried to understand LIRC and also remotecentral.com & hi-firemote.com, but confused....

Ok, few basic i need to be clarified from you,

1.Is any IR protocol based remote buttons have unique IR hex code, eg LG TV power button gives me hex code 20DF10EF and it was also same as in LIRC database, is it unique among other TV brand power button?

2.Is all LG brand TV controlled via any LG TV remote? means i will decode one remote of any LG TV and expecting, it will work on most of LG TV.


How to extract code from LIRC?
Logged

Arduino is Awesome.....

Dublin, Ireland
Offline Offline
Sr. Member
****
Karma: 12
Posts: 387
AnalysIR - IR Analyzer & Decoder for Arduino & MCUs
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1.Is any IR protocol based remote buttons have unique IR hex code, eg LG TV power button gives me hex code 20DF10EF and it was also same as in LIRC database, is it unique among other TV brand power button?
It should be, but not guaranteed.

Quote
2.Is all LG brand TV controlled via any LG TV remote? means i will decode one remote of any LG TV and expecting, it will work on most of LG TV.
No


Quote
How to extract code from LIRC?
You need to study it...

Search for "sb projects IR"....its agreat site that will explain a lot about the make up of IR signals. You will be able to answer your questions above, after doing some research there.
Logged

Blog: http://www.AnalysIR.com/blog/     Twitter: @AnalysIR
Read ==> 10 common pitfalls with Infrared Remote Control :  http://bit.ly/1cvd0a

Pages: [1]   Go Up
Jump to: