Erratic code capture in AnalysIR

Everything related to protocols and IR codes
Post Reply
pungbricks
Posts: 3
Joined: Thu Jun 25, 2020 5:53 am

Erratic code capture in AnalysIR

Post by pungbricks »

I’m trying to use AnalysIR to capture a string of around 12 codes which are sent in relatively quick succession by a remote control to unlock the region code in a DVD player. I have configured an Arduino Uno R3 to use two photo receivers as shown in the startup guide. I also loaded the sketch “AnalysIR _Firmware_801” (I hope this is the correct sketch, but on loading it reports low RAM memory). When I press the remote key which sends the string of codes I get inconsistent reports, sometimes four codes are reported in AnalysIR history log, other times six codes, and the protocol is shown as “Japanese”, 48 bit. However if I run Ken Shirriff’s IRrecvDumpV2 with a serial port speed of 500000bps it logs 12 codes (albeit unknown protocol, 32 bit). If I then import these 12 codes into AnalysIR they are shown as Japanese protocol, 48 bit.

It appears to me that up to 50% of the codes are being missed when attempting to read the codes direct into AnalysIR via AnalysIR_Firmware_801. Having looked at AnalysIR I’m wondering if the serial port speed (115200) may be a factor? For example if it has not finished reporting one code before another is received then possibly it cannot stay in sync?
Please could anyone advise/confirm what my be causing this and also whether I have configured something incorrectly etc?

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

Re: Erratic code capture in AnalysIR

Post by AnalysIR »

but on loading it reports low RAM memory
This is operating as designed...we want to use as much SRAM as possible for buffering & the IDE just provides a warning.

It is likely that you are running out of buffer. Once the buffer is full, it is then sent over serial to the PC. If your signal continues to arrive during this time then some parts may be lost. Another possibility is that your particular signal coincides with the SIGNALGAP setting (try point 4 below)

The use case you describe is rare.

NB: Try option 4 below first!

Workarounds:
1. IF you use another MCU...like an Arduino mega2560 you can assign more SRAM to the buffer. Similarly for any supported 32-bit platforms DUE, Teensy, ESP8266/ESP32, particle photon. They all have lots more SRAM available. We have complete ESP systems available in our Shop.
2. Alternatively, our LearnIR product uses a lossless compression technique, which can record very long sequences of signals - should be able to capture this.
3. If you don't have any of the above to hand, you could try upping the BAUD rate to see if you can get the buffer uploaded before the next signal part arrives. (You can override the BAUD rate in the ini file. If changed you need to restart AnalysIR. The BAUD rate is defined near the end of the file. Use Menu->File->Explore to find it - AnalysIR.ini). Some Arduinos will support 1mbps or even 2mbps depending on original vs clone.
4. try changing the following line in the firmware, as below.

Code: Select all

#define SIGNALGAP 125000 //determines gap between signals (typical range 100000->125000)
change to 
#define SIGNALGAP 5000000 //determines gap between signals (typical range 100000->125000)

pungbricks
Posts: 3
Joined: Thu Jun 25, 2020 5:53 am

Re: Erratic code capture in AnalysIR

Post by pungbricks »

Thanks very much for your suggestions:
you could try upping the BAUD rate
I tried increasing the serial port speed, but on start up I receive a popup advising that the maximum allowed value is 125000.
#define SIGNALGAP 5000000
I tried SIGNALGAP = 500000 but it further reduces the captured codes to 2 or even 1. I tried adjusting SIGNALGAP in different directions but the default value of 125000 appears to report the most codes (6-8).

IF you use another MCU...like an Arduino mega2560 you can assign more SRAM to the buffer
I already have a mega2560 on order and will try this once it has been delivered to me. Are you able to advise how/where I assign more SRAM?
Alternatively, our LearnIR product uses a lossless compression technique
I will definitely check this option on your website.
The use case you describe is rare.
Not sure I fully understand what you mean: Do you mean that trying to capture a string of codes is rare? Or something else?



Thanks again for your suggestions, I'll let you know how I progress.

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

Re: Erratic code capture in AnalysIR

Post by AnalysIR »

I tried SIGNALGAP = 500000
you need an extra zero

Code: Select all

#define SIGNALGAP = 5000000 
or to be safer use

Code: Select all

#define SIGNALGAP = 5000000UL //unsigned long value 

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

Re: Erratic code capture in AnalysIR

Post by AnalysIR »

For the Arduino 2560, set the following to true & the other platforms to false.

Code: Select all

//set true for Microcontroller system being used, set all others to false
#define Arduino328 false   //Any standard Arduino - Duemilenova, Nano or compatible with ATMega328x @16Mhz
#define ArduinoUNO false//Any  Arduino - UNO @16Mhz
#define ArduinoLeonardo false  //Select this for for Arduino Yún & Arduino (pro)Micro also, when connected via USB as the Yún is also a Leonardo
#define ArduinoMega1280 true//Also Mega2560 - untested
#define ArduinoDUE false         //
#define ArduinoYUN false         //
#define ArduinoZero false         //
#define ArduinoM0 false         //
#define MSP430F5529 false        //
#define TivaC false              //
#define FubarinoMini false        // 
#define Teensy3 false    //tested on teensy 3.1, but should also work for Teensy 3.0
#define Moteino false    //uses D3 for IR Receiver and therefore no carrier measurement possible
//............................................................................................
Then you can configure the SRAM buffer, via the maxpulses definition below (the default should be fine...but can be increased more if needed)

Code: Select all

#elif ArduinoMega1280
#define pin2HIGH (PINE & 0b00010000) //Port E bit 4
#define maxPULSES 1024*3 //even More RAM is available on Megas...can increase this for longer signals if neccessary
Not sure I fully understand what you mean: Do you mean that trying to capture a string of codes is rare? Or something else?
Because you are trying to programme a DVD, which seems to have an unusual pattern & this issue has not been raised in many years :)

One thing you could do is to email me a saved session file ( to info@......), of what you get in AnalysIR via Menu->File->Save Session

Another thing to try is the following sketch: https://www.analysir.com/blog/2014/03/1 ... s-arduino/ and email me the output

pungbricks
Posts: 3
Joined: Thu Jun 25, 2020 5:53 am

Re: Erratic code capture in AnalysIR

Post by pungbricks »

thanks, i have sent you a message.


Post Reply