2019年08月06日

connect the hardware

I got a KY-022 IR receiver and a unknown type IR sender. I think the symbol S or DAT mean signal or data to be send, should connect to any GPIO pins in raspberry pi, while GND or - stand for Ground or 0 votage. VCC should be the positive votage, here in my case are both 5V.

install lircd service

I have seen people use pulseio or pigpio to control the IR. But in most case, lirc should be a default choose.

Now the system should reboot.

configure the lircd remote

One may create a remote device file /etc/lirc/lircd.conf.d/midea.lircd.conf to define the parameters/signal sequence for the remote device.

man lircd.conf to see the meaning of those configurations.

There mighe be already a configuration devinput.lircd.conf which can be removed or disabled (rename to *.dist) without any concern.

Notice the raw_codes integer sequence, to understand it, see something like the NEC/RC-5 protocol.

For the IR sender follow NEC protocol, command irrecord -d /dev/lirc0 ~/base.lircd.conf can be used to record the buttons. But in my case, the hardware do not send NEC codes, so when using irrecord, I can not complete the collection parameter stage(the one irrecord need you to randomly push buttons to get two rows of dots). People might suggest use irrecord -f to force the raw codes mode, but it still do not work for me.

So I stopped the lirc with command sudo systemctl stop lircd, and then use mode2 -d /dev/lirc0 to collect the pulse/space data myself, that is how I got the raw_codes above. The codes usually start with a pulse last for 890 ms and end with a pulse, then might be a space with randomly duration(should be the space between you to button press).

For a complex IR sender, like the one for Air Conditioners, the raw codes should be carefully analysised because when you press the same button twice, you might get different signals.

I attached following python script when plotting the signals.