Pinguino Forum

Full Version: Pinguino 4550 - IR Remote Control Decoding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am trying to remotely control a couple of digital outputs individually in my Pinguino 4550 by the sketch stated below which is already based on decoding example developed by Regis,   but unfortunately not working!.. don't know what is wrong.
I am pretty sure of all the connections but not wizard in C programming.
Please, any help will be appreciated:

/*
* DecodeRemote: demonstrates decoding IR codes from a remote control
* An IR detector/demodulator must be connected to the input IRSENSOR.
* Version 0.1 March, 2014
* Author : Regis Blanchot
*/

#define IRSENSOR 0 // pin 0 the input pin from IR sensor
int ledpin1 = 1;
int ledpin2 = 2;

char brand[][10] = {"UNKNOWN", "NEC", "SONY", "RC5", "RC6", "DISH", "SHARP", "PANASONIC", "JVC", "SANYO", "MITSUBISHI"};

decode_results results; // Results returned from the decoder

void setup()
{
pinMode(ledpin1,OUTPUT);
pinMode(ledpin2,OUTPUT);

IRremote.enableIRIn(IRSENSOR); // Start the receiver
IRremote.blink(true); // Built-in led will blink at reception

Serial.begin(9600);
}

void loop()
{
if (IRremote.decode(&results)==DECODED)
{
if (results.decode_type>10)
results.decode_type = 0;

Serial.print(" Decoded ");
Serial.printNumber(results.value,HEX);
Serial.print(" (type ");
Serial.print(brand[results.decode_type]);
Serial.print(")\r\n");

if (results.value == 0xF274ADF) {
digitalWrite(ledpin1,HIGH);
}
if (results.value == 0x56C403) {
digitalWrite(ledpin2,HIGH);
}
}

IRremote.resume(); // Ready to receive the next value
}
(30-05-2017, 12:46 AM)Aldeen19 Wrote: [ -> ]I am trying to remotely control a couple of digital outputs individually in my Pinguino 4550 by the sketch stated below which is already based on decoding example developed by Regis,   but unfortunately not working!.. don't know what is wrong.
I am pretty sure of all the connections but not wizard in C programming.
Please, any help will be appreciated:

/*
* DecodeRemote: demonstrates decoding IR codes from a remote control
* An IR detector/demodulator must be connected to the input IRSENSOR.
* Version 0.1 March, 2014
* Author : Regis Blanchot
*/

#define IRSENSOR 0 // pin 0 the input pin from IR sensor
int ledpin1 = 1;
int ledpin2 = 2;

char brand[][10] = {"UNKNOWN", "NEC", "SONY", "RC5", "RC6", "DISH", "SHARP", "PANASONIC", "JVC", "SANYO", "MITSUBISHI"};

decode_results results; // Results returned from the decoder

void setup()
{
pinMode(ledpin1,OUTPUT);
pinMode(ledpin2,OUTPUT);

IRremote.enableIRIn(IRSENSOR); // Start the receiver
IRremote.blink(true); // Built-in led will blink at reception

Serial.begin(9600);
}

void loop()
{
if (IRremote.decode(&results)==DECODED)
{
if (results.decode_type>10)
results.decode_type = 0;

Serial.print(" Decoded ");
Serial.printNumber(results.value,HEX);
Serial.print(" (type ");
Serial.print(brand[results.decode_type]);
Serial.print(")\r\n");

if (results.value == 0xF274ADF) {
digitalWrite(ledpin1,HIGH);
}
if (results.value == 0x56C403) {
digitalWrite(ledpin2,HIGH);
}
}

IRremote.resume(); // Ready to receive the next value
}
Aldeen
 when i get home tonight i will help you
fred
Thank you Fred that's kind of you and I'll be waiting.
(01-06-2017, 04:03 PM)Aldeen19 Wrote: [ -> ]Thank you Fred that's kind of you and I'll be waiting.

Code:
/*
* DecodeRemote: demonstrates decoding IR codes from a remote control
* An IR detector/demodulator must be connected to the input IRSENSOR.
* Version 0.1 March, 2014
* Author : Regis Blanchot
*/

int RECV_PIN = 2;   // can be any digital pin

decode_results results;

void setup()
{    
   pinMode(11,OUTPUT);
   pinMode(12,OUTPUT);
     
   IRremote.enableIRIn(RECV_PIN);
  IRremote.blink(TRUE);

}

void loop()
{  
   if (IRremote.decode(&results))
   {
   
       if (results.value == 0xF274ADF) {  // button 1
   digitalWrite(11,HIGH);  
   
 }
 if ( results.value == 0x56C403) {   //// button stop
 digitalWrite(12,HIGH);
 
 
 }
       IRremote.resume(); // Receive the next value
   }
}
Aldeen
 try this i used my own code and it worked.
fred
derf158
(01-06-2017, 04:03 PM)Aldeen19 Wrote: [ -> ]Thank you Fred that's kind of you and I'll be waiting.

Code:
/*
* DecodeRemote: demonstrates decoding IR codes from a remote control
* An IR detector/demodulator must be connected to the input IRSENSOR.
* Version 0.1 March, 2014
* Author : Regis Blanchot
*/

int RECV_PIN = 2;   // can be any digital pin

decode_results results;

void setup()
{    
   pinMode(11,OUTPUT);
   pinMode(12,OUTPUT);
     
   IRremote.enableIRIn(RECV_PIN);
  IRremote.blink(TRUE);

}

void loop()
{  
   if (IRremote.decode(&results))
   {
   
       if (results.value == 0xF274ADF) {  // button 1
   digitalWrite(11,HIGH);  
   
 }
 if ( results.value == 0x56C403) {   //// button stop
 digitalWrite(12,HIGH);
 
 
 }
       IRremote.resume(); // Receive the next value
   }
}
Aldeen
 try this i used my own code and it worked.
fred
----------------------------------------------------------------------------

Fred,

I have already attempted every possible programming format I could ever think of, changed various pins, changed various number decoding systems from hex into decimal and binary before I asked for help.. and now after trying your sketch the LEDs are still OFF and not responding.. I am frustrated.
 
More specifically, by watching the serial terminal I figured out that my Pinguino is actually decoding the incoming signals but not executing the 'if' conditions of turning LEDs ON !!?.. as if there is something wrong with the firmware of 4550 or in the IR library included.

For your information; My Pinguino is self-made 4550 clocked 20MHz, IDE is v11Beta4 compiler type is SDCC,  using Hyper Terminal app of Windows XP SP3 for watching the serial port,   IR sensor is TSOP38238 and the remote TX unit is of unknown brand.   Please see attached photo and tell me what you think ?
(02-06-2017, 07:20 PM)Aldeen19 Wrote: [ -> ]derf158
(01-06-2017, 04:03 PM)Aldeen19 Wrote: [ -> ]Thank you Fred that's kind of you and I'll be waiting.

Code:
/*
* DecodeRemote: demonstrates decoding IR codes from a remote control
* An IR detector/demodulator must be connected to the input IRSENSOR.
* Version 0.1 March, 2014
* Author : Regis Blanchot
*/

int RECV_PIN = 2;   // can be any digital pin

decode_results results;

void setup()
{    
   pinMode(11,OUTPUT);
   pinMode(12,OUTPUT);
     
   IRremote.enableIRIn(RECV_PIN);
  IRremote.blink(TRUE);

}

void loop()
{  
   if (IRremote.decode(&results))
   {
   
       if (results.value == 0xF274ADF) {  // button 1
   digitalWrite(11,HIGH);  
   
 }
 if ( results.value == 0x56C403) {   //// button stop
 digitalWrite(12,HIGH);
 
 
 }
       IRremote.resume(); // Receive the next value
   }
}
Aldeen
 try this i used my own code and it worked.
fred
----------------------------------------------------------------------------

Fred,

I have already attempted every possible programming format I could ever think of, changed various pins, changed various number decoding systems from hex into decimal and binary before I asked for help.. and now after trying your sketch the LEDs are still OFF and not responding.. I am frustrated.
 
More specifically, by watching the serial terminal I figured out that my Pinguino is actually decoding the incoming signals but not executing the 'if' conditions of turning LEDs ON !!?.. as if there is something wrong with the firmware of 4550 or in the IR library included.

For your information; My Pinguino is self-made 4550 clocked 20MHz, IDE is v11Beta4 compiler type is SDCC,  using Hyper Terminal app of Windows XP SP3 for watching the serial port,   IR sensor is TSOP38238 and the remote TX unit is of unknown brand.   Please see attached photo and tell me what you think ?
Aldeen,
 I will try this on V11 i am using V12 i use the hex value on thing to note in irremote.c a value needs to be changed see  the code i changed 50 to 26

Code:
// nb cycles for 50us
   _tmr_reload_val = ( System_getPeripheralFrequency() / 1000 / 1000 ); // 1us = 12 cycles @ 48MHz
    _tmr_reload_val *= 26; // 50us = 50 * 12 cy @ 48MHz
  // _tmr_reload_val *= 50; // 50us = 50 * 12 cy @ 48MHz
   _tmr_reload_val = 0xFFFF - _tmr_reload_val;
[quote pid='12598' dateline='1496425705']
Aldeen,
 I will try this on V11 i am using V12 i use the hex value on thing to note in irremote.c a value needs to be changed see  the code i changed 50 to 26

Code:
// nb cycles for 50us
   _tmr_reload_val = ( System_getPeripheralFrequency() / 1000 / 1000 ); // 1us = 12 cycles @ 48MHz
   _tmr_reload_val *= 26; // 50us = 50 * 12 cy @ 48MHz
  // _tmr_reload_val *= 50; // 50us = 50 * 12 cy @ 48MHz
   _tmr_reload_val = 0xFFFF - _tmr_reload_val;

[/quote]

Fred, thank you for your prompt reply.
I tried changing 50 to 26 which is included in the file IRremote.c - located in the path : C:\Pinguino\v11\p8\include\pinguino\libraries but no change!  I feel sad.
(02-06-2017, 08:20 PM)Aldeen19 Wrote: [ -> ][quote pid='12598' dateline='1496425705']
Aldeen,
 I will try this on V11 i am using V12 i use the hex value on thing to note in irremote.c a value needs to be changed see  the code i changed 50 to 26

Code:
// nb cycles for 50us
   _tmr_reload_val = ( System_getPeripheralFrequency() / 1000 / 1000 ); // 1us = 12 cycles @ 48MHz
   _tmr_reload_val *= 26; // 50us = 50 * 12 cy @ 48MHz
  // _tmr_reload_val *= 50; // 50us = 50 * 12 cy @ 48MHz
   _tmr_reload_val = 0xFFFF - _tmr_reload_val;

Fred, thank you for your prompt reply.
I tried changing 50 to 26 which is included in the file IRremote.c - located in the path : C:\Pinguino\v11\p8\include\pinguino\libraries but no change!  I feel sad.
[/quote]

Aldeen,
 i just tried the irremote in V11 with the change from 50 to 26 it works. did you decode the ir remote you have?
(03-06-2017, 12:16 AM)derf158 Wrote: [ -> ]
(02-06-2017, 08:20 PM)Aldeen19 Wrote: [ -> ][quote pid='12598' dateline='1496425705']
Aldeen,
 I will try this on V11 i am using V12 i use the hex value on thing to note in irremote.c a value needs to be changed see  the code i changed 50 to 26

Code:
// nb cycles for 50us
   _tmr_reload_val = ( System_getPeripheralFrequency() / 1000 / 1000 ); // 1us = 12 cycles @ 48MHz
   _tmr_reload_val *= 26; // 50us = 50 * 12 cy @ 48MHz
  // _tmr_reload_val *= 50; // 50us = 50 * 12 cy @ 48MHz
   _tmr_reload_val = 0xFFFF - _tmr_reload_val;

Fred, thank you for your prompt reply.
I tried changing 50 to 26 which is included in the file IRremote.c - located in the path : C:\Pinguino\v11\p8\include\pinguino\libraries but no change!  I feel sad.

Aldeen,
 i just tried the irremote in V11 with the change from 50 to 26 it works. did you decode the ir remote you have?
[/quote]

Fred,
With 26 uSec setting, now decoding has stopped although the USER led flashes with incoming signals. 
I tried even with a different remote unit it still the same, no decoding .. what does that suppose to mean?
(03-06-2017, 01:01 PM)Aldeen19 Wrote: [ -> ]
(03-06-2017, 12:16 AM)derf158 Wrote: [ -> ]
(02-06-2017, 08:20 PM)Aldeen19 Wrote: [ -> ][quote pid='12598' dateline='1496425705']
Aldeen,
 I will try this on V11 i am using V12 i use the hex value on thing to note in irremote.c a value needs to be changed see  the code i changed 50 to 26

Code:
// nb cycles for 50us
   _tmr_reload_val = ( System_getPeripheralFrequency() / 1000 / 1000 ); // 1us = 12 cycles @ 48MHz
   _tmr_reload_val *= 26; // 50us = 50 * 12 cy @ 48MHz
  // _tmr_reload_val *= 50; // 50us = 50 * 12 cy @ 48MHz
   _tmr_reload_val = 0xFFFF - _tmr_reload_val;

Fred, thank you for your prompt reply.
I tried changing 50 to 26 which is included in the file IRremote.c - located in the path : C:\Pinguino\v11\p8\include\pinguino\libraries but no change!  I feel sad.

Aldeen,
 i just tried the irremote in V11 with the change from 50 to 26 it works. did you decode the ir remote you have?

Fred,
With 26 uSec setting, now decoding has stopped although the USER led flashes with incoming signals. 
I tried even with a different remote unit it still the same, no decoding .. what does that suppose to mean?
[/quote]
Aldeen,
 if you change the 26usec back to 50usec can you see it on your hyper terminal? Do you have an Arduino board to try your IR receiver and  remote?
Pages: 1 2