How possible 16 IR command store in EEPROM

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
wnc
 
Posts: 38
Joined: Tue May 08, 2012 9:16 am

How possible 16 IR command store in EEPROM

Post by wnc »

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

tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: How possible 16 IR command store in EEPROM

Post by tldr »

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.

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

Re: How possible 16 IR command store in EEPROM

Post by wnc »

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?

User avatar
corwyn
 
Posts: 14
Joined: Mon Nov 05, 2012 8:38 pm

Re: How possible 16 IR command store in EEPROM

Post by corwyn »

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)

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

Re: How possible 16 IR command store in EEPROM

Post by wnc »

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?

User avatar
corwyn
 
Posts: 14
Joined: Mon Nov 05, 2012 8:38 pm

Re: How possible 16 IR command store in EEPROM

Post by corwyn »

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
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: How possible 16 IR command store in EEPROM

Post by adafruit_support_mike »

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.

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

Re: How possible 16 IR command store in EEPROM

Post by wnc »

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.
http://forums.adafruit.com/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 [email protected] : Can you explain more about your concepts or write simple code for above array?
Because I have limited knowledge of programming, honestly speaking.

Regards

User avatar
corwyn
 
Posts: 14
Joined: Mon Nov 05, 2012 8:38 pm

Re: How possible 16 IR command store in EEPROM

Post by corwyn »

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.

tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: How possible 16 IR command store in EEPROM

Post by tldr »

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.

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

Re: How possible 16 IR command store in EEPROM

Post by wnc »

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 9:16 am

Re: How possible 16 IR command store in EEPROM

Post by wnc »

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

tldr
 
Posts: 466
Joined: Thu Aug 30, 2012 1:34 am

Re: How possible 16 IR command store in EEPROM

Post by tldr »

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.

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

Re: How possible 16 IR command store in EEPROM

Post by wnc »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”