Arduino: Infrared Issue - Send RAW data

Everything related to protocols and IR codes
xefil
Posts: 6
Joined: Fri Dec 12, 2014 11:34 am

Re: Arduino: Infrared Issue - Send RAW data

Post by xefil »

Hello again!

The sequences you've sent me are not working :( :( :(

Here the code I've used to test it:

Code: Select all

#include <IRremote.h>

IRsend irsend;

unsigned int Signal_Beep_0[] = {1450,250,1350,750,450,800,1250,450,1250,850,400,1250,400,1250,400,1300,400,850,1250,850,400,1250,400,1250,400,1300,400,1250,400,1300,400,1250,400,1300,350,1300,400,1250,400}; //AnalysIR Batch Export (IRremote) - RAW
unsigned int Signal_Beep_1[] = {1400,250,1350,800,450,850,1200,450,1200,900,350,1300,400,1300,350,1300,400,850,1250,850,350,1300,400,1300,350,1300,400,1250,400,1300,400,1300,350,1300,400,1250,400,1300,350}; //AnalysIR Batch Export (IRremote) - RAW
unsigned int Signal_Beep_2[] = {1400,250,1300,800,450,850,1250,400,1200,900,400,1250,400,1300,400,1250,400,850,1200,900,400,1250,400,1300,400,1250,400,1300,400,1250,400,1250,400,1300,350,1300,400,1250,400}; //AnalysIR Batch Export (IRremote) - RAW

unsigned int Signal_OFF_3[] = {3200,600,600,650,1400,250,1350,350,1300,350,1300,400,1250,400,1250,850,400,1250,400,1250,450,1250,400,1250,400,1300,400,1250,400,1250,400,1250,450,1250,400,1250,400}; //AnalysIR Batch Export (IRremote) - RAW
unsigned int Signal_OFF_4[] = {3150,600,650,600,1400,250,1400,300,1300,350,1300,400,1250,450,1200,850,400,1250,400,1300,400,1250,400,1250,450,1250,400,1250,400,1250,450,1250,400,1250,400,1250,400}; //AnalysIR Batch Export (IRremote) - RAW

unsigned int Signal_ON_5[] = {3200,550,600,650,1400,300,1300,400,1250,400,1250,450,1250,850,350,900,1200,450,1250,400,1250,850,400,1250,400,1250,450,1250,400,1250,450,1250,400,1250,400,1250,400}; //AnalysIR Batch Export (IRremote) - RAW
unsigned int Signal_ON_6[] = {3200,600,600,600,1450,250,1350,350,1300,350,1300,400,1200,850,400,850,1250,450,1250,400,1250,850,400,1250,400,1300,400,1250,400,1250,400,1250,400,1350,350,1250,400}; //AnalysIR Batch Export (IRremote) - RAW
unsigned int Signal_ON_7[] = {3250,550,600,650,1400,250,1350,350,1250,400,1250,450,1250,850,350,850,1250,450,1250,400,1250,850,400,1250,400,1250,450,1250,400,1250,400,1300,400,1250,400,1250,400}; //AnalysIR Batch Export (IRremote) - RAW

unsigned int khz[] = {38, 40, 49, 36, 56, 33, 30, 455};


void setup()
{
 Serial.begin(9600);
}

void loop() {
  
  
  // NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
  // Automatically Generated by AnalysIR for xxxxxxxx, visit http://www.AnalysIR.com or email info@....... for further details
  // int khz=38; //NB Change this default value as neccessary to the correct modulation frequency

     
     for (int i = 0; i < 9; i++) {
       Serial.print("Sending signal at: ");
       Serial.print(khz[i]);
       Serial.println(" kHz");
       
       Serial.println("Sending signal Signal_Beep_0");
       irsend.sendRaw(Signal_Beep_0, sizeof(Signal_Beep_0)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_Beep_1");
       irsend.sendRaw(Signal_Beep_1, sizeof(Signal_Beep_1)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_Beep_2");
       irsend.sendRaw(Signal_Beep_2, sizeof(Signal_Beep_2)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_OFF_3");
       irsend.sendRaw(Signal_OFF_3, sizeof(Signal_OFF_3)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_OFF_4");
       irsend.sendRaw(Signal_OFF_4, sizeof(Signal_OFF_4)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_ON_5");
       irsend.sendRaw(Signal_ON_5, sizeof(Signal_ON_5)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_ON_6");
       irsend.sendRaw(Signal_ON_6, sizeof(Signal_ON_6)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(300);
       
       Serial.println("Sending signal Signal_ON_7");
       irsend.sendRaw(Signal_ON_7, sizeof(Signal_ON_7)/sizeof(int), khz[i]); //AnalysIR Batch Export (IRremote) - RAW
       delay(1000); 
     }     

}

Do you suggest to start using your post to record new values or do you see any problem on my sketch?

Thanks!

Simon
User avatar
AnalysIR
Site Admin
Posts: 776
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Arduino: Infrared Issue - Send RAW data

Post by AnalysIR »

I didn't check your sketch in detail. However, it is very clear that the 300ms delay is way too short and could be overloading the system(?)...change that to 5 or 10 secs.

Also change the order to ON->beep->Off...otherwise you might miss a valid signal because the unit is off. Lastly, use your remote to set the stove to different states.

If that doesnt work then it makes no sense to continue with the receiver you are using. So post back when you find another method to capture signals. If you have no other option use the "poor makers IR receiver" available via our blog.
Properman
Posts: 5
Joined: Tue Mar 04, 2014 5:05 pm
Contact:

Re: Arduino: Infrared Issue - Send RAW data

Post by Properman »

I have similar issues to xefil with my TCL aircon unit.

The code below will switch my iQ TV on and off but I'm not getting any response from the aircon unit.

Code: Select all

/*
 * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * Just open Serial Monitor and type something to send the Sony signal (3 times) from Pin9 on Mega 2560
 * ROW 15 IS BEFORE CLEANING UP THE SIGNAL AND ROW 17 IS AFTER CLEANING UP THE SIGNAL
 * ROW 31 WAS SET TO LOOP 3 TIMES (i < 3) FOR SONY SIGNALS BUT NOT REQUIRED FOR TCL
 * ROW 32 WORKS TO SWITCH ON / OFF AN IQ TV
 * ROWS 34 AND 35 WERE ORIGINAL SONY DEMO CODE, NOT USED BY ME
 *
 * http://arcfn.com
 */

#include <IRremote.h>
int khz=38; //NB Change this default value as neccessary to the correct modulation frequency
//unsigned int Signal_TCLOFF_0[] = {3040,1692,492,1060,488,1060,492,336,492,332,488,336,492,1060,488,336,492,352,488,1060,520,1028,496,332,492,1056,492,336,492,332,492,1060,492,1072,492,332,492,1060,488,1060,520,308,492,332,516,1036,488,332,496,352,488,1060,492,332,492,332,492,332,496,332,496,332,488,336,492,348,492,336,488,332,496,332,492,336,492,332,492,332,492,332,496,348,492,332,492,332,496,332,492,336,488,332,496,1060,488,332,492,352,488,1060,496,332,488,336,492,332,492,336,492,332,492,336,488,352,492,332,520,308,488,1060,492,336,488,336,488,336,492,332,496,348,488,336,492,332,496,332,492,332,492,332,496,332,492,332,496,344,492,336,492,332,496,332,492,332,492,332,492,332,496,332,520,320,492,332,496,332,496,332,488,332,496,332,492,332,520,308,488,352,492,332,496,332,488,340,488,332,496,332,520,304,496,332,488,352,492,332,492,336,488,332,520,312,492,332,492,332,492,336,488,352,492,332,492,1056,496,332,488,1060,520,1032,516,1036,488,332,496,340,488}; //AnalysIR Batch Export (IRremote) - RAW
// row above is not used for TV it is to use RAW with Aircon
unsigned int Signal_TCLOFF_0[] = {2900,1800,405,1125,405,1125,405,405,405,405,405,405,405,1125,405,405,405,405,405,1125,405,1125,405,405,405,1125,405,405,405,405,405,1125,405,1125,405,405,405,1125,405,1125,405,405,405,405,405,1125,405,405,405,405,405,1125,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,1125,405,405,405,405,405,1125,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,1125,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,405,1125,405,405,405,1125,405,1125,405,1125,405,405,405,405,405,8700};


IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 10; i++) {
      //irsend.sendNEC(0x20DF10EF, 32); //AnalysIR Batch Export (IRremote) // AnalysIR IR Protocol: NEC, Key:  OFF
      irsend.sendRaw(Signal_TCLOFF_0, sizeof(Signal_TCLOFF_0)/sizeof(int), khz); // TCL AC OFF
      //irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(5000); // send every 5 seconds for 10 attempts
    }
  }
}
As per the remarks in capitals towards the top of the sketch I used raw signal first and then used the cleaned up signal. To do this I exported the aircon off signal with AnalysIR and excluded a final 8700 pulse as there was nothing like that in the original batch export to IRremote.

I am using a TSAL6100 at less than 1 meter range (which was fine for the TV) and the signal was recorded using a TSOP 4038.

Chris, when you say some signals can't be sent with IRremote does this also apply when they are sent as RAW data? Would I need to study the latest blog post in more detail regarding Panasonic and Mitsubishi aircon units to get my TCL working with the Arduino (Mega2560)?

IRToy is working ok for the TCL off signal (and all other signals) even without cleaning up the signal. Is there anyway to clean a batch of signals or is it not really that important?
Can you please email me a copy of the PSOC 4 firmware.
User avatar
AnalysIR
Site Admin
Posts: 776
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Arduino: Infrared Issue - Send RAW data

Post by AnalysIR »

Based on a quick inspection, I couldn't see anything wrong with your code.

Please upload a saved session file, with a selection of signals recorded from your remote.
Also, please post the Make/Model # of the AC Unit & remote being tested - for future reference.

It might be worthwhile trying out IRLib instead of IRremote - but 'on paper' for this signal there should be no difference.

If the same signal works with the IR Toy & AnalysIR(make sure you export a signal that you know worked) then the suspects would be:

- IR LED circuit - but you say this works with the TV. Let's know what your emitter circuit is - connected to the Arduino, just in case. You must have the top of the IR LED pointed directly at the receiver in the AC unit.
- Modulation Frequency: you could try other frequency values 38,33,36,40,56,30, Again unlikely if it worked for the IRToy.
- Code: Haven't seen anything obvious there. However, you have to type a character in the IDE terminal window for a signal to be sent. Otherwise just comment out the IF statement in the main loop. Again, if you got it working with your TV, this shouldnt be an issue.

Not sure where the 8700 pulse originated, but it may be a trailing space, which can be left out.

I will send the PSOC4 project directly to you via email.
Properman
Posts: 5
Joined: Tue Mar 04, 2014 5:05 pm
Contact:

Re: Arduino: Infrared Issue - Send RAW data

Post by Properman »

Cheers Chris.
I downloaded IRlib yesterday before you replied and I was about to give it a go when I tried IRremote one last time. With the tip of the LED pointing directly at the air con unit at a maximum distance of about 1.7m the unit finally responded. The circuit is just a 100K resistor between ground and the LED. Now it is up an running I will look at building your constant current circuit that I have previously used to good effect with the Raspberry Pi.
Looking at IRlib it does look to be much more up to date than the better known IRremote and I would recommend users go this route.
For reference the air con unit is TCL TAC-09CHS/R and the remote control just states TCL.
Look forward to receiving the PC0S4 project in due course.
User avatar
AnalysIR
Site Admin
Posts: 776
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Arduino: Infrared Issue - Send RAW data

Post by AnalysIR »

The circuit is just a 100K resistor between ground and the LED.
That explains a lot....it should be just 100 ohms (100R). I am surprised you would get anything out of a 100K one (maybe a typo?)

Anyway, good to hear that its working out.
Properman
Posts: 5
Joined: Tue Mar 04, 2014 5:05 pm
Contact:

Re: Arduino: Infrared Issue - Send RAW data

Post by Properman »

AnalysIR wrote:
The circuit is just a 100K resistor between ground and the LED.
That explains a lot....it should be just 100 ohms (100R). I am surprised you would get anything out of a 100K one (maybe a typo?)

Anyway, good to hear that its working out.
Sorry 100R not 100K
Post Reply