How to use irrecord with 2ms sync instead of the standard 5ms?

I am trying to teach lirc on my Raspberry Pi to remote codes for my heat pump - Mitsubishi Electric MSZ-GE60VA (SG10A 1833 remote)

I run irrecord like this:

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


I get the usual jerk about button presses, etc. and do it properly.

After several dots (not always the same number) irrecord issues the following error messages:

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


Now I found elsewhere that the sampling rate might not be correct, and look at the waveform using xmode2 - which I did. I'm sure I'll have better luck if I can get irrecord to try faster, as xmode2 can.

Any ideas? (NB: I worked with the force parameter too and no difference)

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

5ms sample 5ms sample (default)

sample 2ms sample 2ms


source to share

2 answers

First try using

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


-f will force raw mode. If you're lucky enough to create a config file or list a space.

Otherwise run below command and ctrl ^ c to stop recording / stop recording.

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


the -m option should generate generated raw files. delete the first value, which is the delay, before pressing the remote button.

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

vim ~/lirc.conf
:%s!^!    !


end your ~ / lirc.conf file to get 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 copy of the original lircd.conf file

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


Copy the new config file

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


Start lirc again

sudo /etc/init.d/lirc start 


and try



check with your phone camera the LED lights up.

This works for some people ...



LIRC actually samples as fast as 13 microseconds in raspberry pi, which is the speed infrared light pulse for IR signals (38 kHz), the time you give in xmode2 is just used to build the image, every 2ms it draws either an impulse or gap in the chart.

Probably the problem is that LIRC doesn't detect your remote IR code, have you tried running irrecord with the -f option? enforce raw mode instead?

If that doesn't work, you can use mode2 to actually try to source the code by hand and create code like this: pulse time, space time, pulse time, space time, etc., expressed in microseconds.

From your graph it will be something like 6000 4000 1000 2000 1000 and so on ...

Option 2. If you can find pronto codes for your heat pump online, you can also convert them to lirc using pronto2lirc



All Articles