How possible 16 IR command store in EEPROM

by wnc on Sun Nov 11, 2012 11:15 am

Hi
I came across that 16 IR command are stored in 256Byte PIC EEPROM which is applied IRMimic Trainable IR Remote Transmitter.
http://www.tauntek.com/irmimic-learning ... mitter.htm

I know that some command has 64 pulse, 96 pulse etc. It means 64 integer, 96 integer etc.
One integer occupy 16bit (2byte). How it is done in PIC?
Actually I am interested how it can be done in Arduino Uno EEPROM. I am searching around but found simple code to store a data.

Anybody has any idea how it can be done in Arduino?

Regards
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: How possible 16 IR command store in EEPROM

by tldr on Sun Nov 11, 2012 5:11 pm

you'll want the eeprom library. the leonardo has a 1k eeprom.

if you will know the codes you want at compile time, you can store them in flash.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: How possible 16 IR command store in EEPROM

by wnc on Sun Nov 11, 2012 7:42 pm

Hi tldr
Thanks for reply. Basically i know how to store a data in EEPROM.
The question here is that how to store huge amount of such data,
say 16x64pulse store in 512byte EEPROM?
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: How possible 16 IR command store in EEPROM

by Corwyn on Fri Nov 16, 2012 11:13 pm

Are the pulses really integers? I would expect them to be on/off. In other words store a 96 pulse command as 96 BITS (12 Bytes)
User avatar
Corwyn
 
Posts: 14
Joined: Mon Nov 05, 2012 7:38 pm

Re: How possible 16 IR command store in EEPROM

by wnc on Sat Nov 17, 2012 4:58 am

Yes you have good point. But each pulse on/off time are different.
For example, 320μS on/ 720μS off and 320μS on/1440μS off.
How to save those pulse in 1byte?
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: How possible 16 IR command store in EEPROM

by Corwyn on Sat Nov 17, 2012 8:16 pm

What else do you know about the timings? Are they all divisible by 10? by 8? Are there only a few values? There are a number of techniques for encoding data to make it smaller, but the exact nature of the data is important.
User avatar
Corwyn
 
Posts: 14
Joined: Mon Nov 05, 2012 7:38 pm

Re: How possible 16 IR command store in EEPROM

by adafruit_support_mike on Sat Nov 17, 2012 10:16 pm

The documents at the tauntek website say the device "captures roughly one half second of IR activity", so I'd guess it's taking samples every 4 milliseconds and storing them as an array of 128 bits (16 bytes, 1/16th of the available memory).

That would be the simplest way to 'learn' a wide variety of signals.. the circuit doesn't bother trying to identify or interpret the samples, it just records them and plays them back in the same order.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7029
Joined: Thu Feb 11, 2010 1:51 pm

Re: How possible 16 IR command store in EEPROM

by wnc on Sun Nov 18, 2012 4:30 am

I tried decode IR signals using IRremote.h library and it did not work for my remote control (both sharp TV and Pioneer player).
http://www.arcfn.com/2009/08/multi-prot ... brary.html

Finally I found the code from Adafruit tutorial and it works for my remotes. I think it will work for others as well.
viewtopic.php?f=25&t=33766

The reason why I raised this question is that if we have answers, it will be benefit for all uses.
After I decode the IR signals, following adafruit codes, I got below array of time.
int sharpon[]={
320, 1740,
320, 720,
320, 720,
320, 720,
320, 720,
320, 720,
320, 1740,
320, 1740,
320, 720,
320, 1740,
320, 720,
320, 720,
320, 720,
320, 1740,
320, 720,
320, 45320,
320, 1740,
320, 720,
320, 720,
320, 720,
320, 720,
320, 1740,
320, 720,
320, 720,
320, 1740,
320, 720,
320, 1740,
320, 1740,
320, 1740,
320, 720,
320, 1740,
320, 43240,
320, 1740,
320, 720,
320, 720,
320, 720,
320, 720,
320, 720,
320, 1740,
320, 1740,
320, 720,
320, 1740,
320, 720,
320, 720,
320, 720,
320, 1740,
320, 720,
320, 45740,
320, 1740,
320, 720,
320, 720,
320, 720,
320, 720,
320, 1740,
320, 720,
320, 720,
320, 1740,
320, 720,
320, 1740,
320, 1740,
320, 1740,
320, 720,
320, 1740,
320, 0};
all are in uSec for one button.
Then how to save those array in EEPROM in 16byte address. Because IRMimic EEPROM is 256byte and can learn 16 buttons.
To mstone@yawp.com : Can you explain more about your concepts or write simple code for above array?
Because I have limited knowledge of programming, honestly speaking.

Regards
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: How possible 16 IR command store in EEPROM

by Corwyn on Sun Nov 18, 2012 9:39 am

The 320s are all the same, so can be saved in 1 int (or possibly a byte) or use the solution below.
The other values only have 5-6 values, number them, save them as a half-byte, and use a table lookup to encode/decode.

That is one way, assuming that you have a representative sample.
User avatar
Corwyn
 
Posts: 14
Joined: Mon Nov 05, 2012 7:38 pm

Re: How possible 16 IR command store in EEPROM

by tldr on Sun Nov 18, 2012 12:54 pm

this will probably break in horrible ways for other remotes. (the only thing i ever do with a remote is hide it so no one can turn on the tv.)

you can save the pulse lengths in a short table.

Code: Select all
uint16_t pulselength[] = {320, 720, 1740};

then make a table with the pulse pattern, saved as a list of indices into the pulselength table. since the pulselength table has only three entries, you only need 2 bits to store each index, so you can store 8 indices in a 16 bit integer.

Code: Select all
uint16_t pulsepattern[] = {0x2111,  // 320, 1740, 320, 720, 320, 720, 320, 720
                           0x1211,  // 320, 720, 320, 1740, 320, 720, 320, 720
                           0x2122,  // 320, 1740, 320, 720, 320, 1740, 320, 1740
                           0x2123}  // 320, 1740, 320, 720, 320, 1740, end


pulse lengths need only be stored once. that's six bytes. the code you gave as an example can be stored in 8 bytes.

i would suggest having a look at the tv-b-gone forum for ideas pertaining to data compression.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: How possible 16 IR command store in EEPROM

by wnc on Sun Nov 18, 2012 10:57 pm

Hi tldr
Thanks for the info. It is very good example. And i saw tv b gone tutorial.
It is very educational.i will study firmware which may be applicable for my project.
Regards
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: How possible 16 IR command store in EEPROM

by wnc on Wed Nov 21, 2012 10:39 am

I have a look the firmware and I know that language used is beyond my knowledge. (is it C or C++ or what??)
I learn "Arduino language" and familiar with (not excel). And that's all I know.
If someone has already written the code of "storing IR pulse in compressed form", please can you share with us.
Or any example code or link or and guide also welcome.

regards
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am

Re: How possible 16 IR command store in EEPROM

by tldr on Thu Nov 22, 2012 12:43 pm

don't wish to frighten you, but the arduino language is c++.

have a look at the adafuit tutorial for their i/r sensor. it describes a compression technique similar to what i suggested, except that it's about 50% compressier.
"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
tldr
 
Posts: 464
Joined: Thu Aug 30, 2012 12:34 am

Re: How possible 16 IR command store in EEPROM

by wnc on Thu Nov 29, 2012 9:58 am

Hi
TV Be Gone's Firmware is written in C or C++?
And appreciate it if one can provide me the link of that language to download so that I can learn their code.
I am willing to learn it.
wnc
 
Posts: 38
Joined: Tue May 08, 2012 8:16 am