How to use irrecord with 2ms timing instead of the default 5ms?

Phil picture Phil · Mar 26, 2014 · Viewed 15.8k times · Source

I'm trying to teach lirc on my Raspberry Pi the remote-codes for my heat pump - a Mitsubishi Electric MSZ-GE60VA (remote is SG10A 1833)

I run irrecord as follows:

sudo /etc/init.d/lirc stop
irrecord -d /dev/lirc0 heatpump

I get the usual cruft about pushing buttons, etc, and duly do so.

After several dots (not always the same number), irrecord bails with the following error message:

irrecord: could not find gap.
irrecord: gap not found, can't continue

Now, I've found elsewhere that the sample rate might be wrong, and to look at the waveform using xmode2 - which I've done. I'm pretty sure I'd have more luck if I could get irrecord to sample faster, as xmode2 can.

Any ideas? (NB: I've run with the force option too, and no difference)

Here are my results using xmode2 - you can see the 5ms sample can't really make heads or tails of the signal, but the 2ms sample can.

5ms sample http://jnawk.net.nz/5ms.png 5ms sample (default)

2ms sample http://jnawk.net.nz/2ms.png 2ms sample

Answer

user3731768 picture user3731768 · Jun 12, 2014

First,try to use

irrecord -f -d /dev/lirc0 ~/lirc.conf

-f will force the raw mode. If you're lucky that will generate the config file or at list the gap.

Otherwise, launch the command below and ctrl^c to stop escape / stop recording.

mode2 -m -d /dev/lirc0 > ~/lirc.conf

the -m option should generate formated raws. remove the first value which is the delay before you pressed the remote button.

if you don't use the -m option you can do it with VI.

vim ~/lirc.conf
:%s/^.\{5}
:%s!^!    !
:%s/\n/

complete the ~/lirc.conf file to obtain something like :

begin remote

   name  MY_REMOTE
   flags RAW_CODES
   eps            30
   aeps          100

   frequency    38000
# note ensure the modulation frequency above correctly matches your remote, default is set to 38kHz
# you can also try other common frequencies (36000,40000,56000) if you are unsure

       begin raw_codes

           name MY_TEST
...<<PUT THE RAW CODE HERE >>...  

    end raw_codes
end remote

No TAB, only spaces in the file.

Make a backup of the original lircd.conf file

sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

Copy over your new configuration file

sudo cp ~/lircd.conf /etc/lirc/lircd.conf

Start up lirc again

sudo /etc/init.d/lirc start 

and try it

irsend SEND_ONCE MY_REMOTE MY_TEST 

check with your phone camera the led is lighting.

This works for some people...