Skip to content

IR remote control miZy setup

probonopd edited this page Apr 14, 2018 · 3 revisions

IR receiver setup for miZy

IR setup mizy

You can use a standard expansion board (I use it for tests) - and you can also make IR setup mizy

use orange_pi_zero_miZy-music_box-mpd-net-SPI-beta_test from https://github.com/hyphop/miZy/releases

Connect to miZy

ssh root@10.1.1.1

Check the kernel modules needed to operate the IR remote control

lsmod | grep ir

ir_lirc_codec           3685  0 
ir_nec_decoder          1556  0 
lirc_dev                7846  1 ir_lirc_codec
rc_core                12751  4 ir_nec_decoder,ir_lirc_codec,sunxi_cir
sunxi_cir               1601  0 

if they are not loaded then run

ir.setup

if everything is OK then we should see

rc-core
sunxi-cir
lirc_dev
ir-lirc-codec
ir-nec-decoder

Checking and setting the remote

First, stop the running IR daemon with ir.daemon kill

Test the receiver

ir.test

Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "sunxi-ir"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 152 (KEY_SCREENLOCK)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    500
    Repeat code 1 (REP_PERIOD)
      Value    125
Properties:
Testing ... (interrupt to exit)

Now we go to the remote and start to press the keys one by one to press all the buttons.

It should give a result like

Event: time 1518168150.690725, type 4 (EV_MSC), code 4 (MSC_SCAN), value b2dc
Event: time 1518168150.690737, -------------- SYN_REPORT ------------
Event: time 1518168152.644422, type 4 (EV_MSC), code 4 (MSC_SCAN), value b288
Event: time 1518168152.644431, -------------- SYN_REPORT ------------
Event: time 1518168153.132177, type 4 (EV_MSC), code 4 (MSC_SCAN), value b282
Event: time 1518168153.132186, -------------- SYN_REPORT ------------
Event: time 1518168154.052017, type 4 (EV_MSC), code 4 (MSC_SCAN), value b2ca
Event: time 1518168154.052026, -------------- SYN_REPORT ------------
Event: time 1518168154.690017, type 4 (EV_MSC), code 4 (MSC_SCAN), value b299
Event: time 1518168154.690026, -------------- SYN_REPORT ------------
Event: time 1518168155.252939, type 4 (EV_MSC), code 4 (MSC_SCAN), value b2ce
Event: time 1518168155.252948, -------------- SYN_REPORT ------------
Event: time 1518168155.820354, type 4 (EV_MSC), code 4 (MSC_SCAN), value b2c1
Event: time 1518168155.820363, -------------- SYN_REPORT ------------
Event: time 1518168156.527590, type 4 (EV_MSC), code 4 (MSC_SCAN), value b2d2
Event: time 1518168156.527599, -------------- SYN_REPORT ------------
Event: time 1518168157.178380, type 4 (EV_MSC), code 4 (MSC_SCAN), value b2c5
Event: time 1518168157.178389, -------------- SYN_REPORT ------------
Event: time 1518168157.872560, type 4 (EV_MSC), code 4 (MSC_SCAN), value b29a
Event: time 1518168157.872569, -------------- SYN_REPORT ------------
Event: time 1518168158.599942, type 4 (EV_MSC), code 4 (MSC_SCAN), value b281
Event: time 1518168158.599952, -------------- SYN_REPORT ------------
Event: time 1518168160.026597, type 4 (EV_MSC), code 4 (MSC_SCAN), value b280
Event: time 1518168160.026607, -------------- SYN_REPORT ------------

If you can see events, then the receiver is working

IR Daemon

read the built-in help - for the IR daemon - just run

ir.daemon --help

ir.daemon - simple ir daemon

ABOUT
	run cmd by code, work without lircd 

USAGE
	[verbose=1] ir.daemon [test|monitor]

EXAMPLE	

	ir.daemon			- run in daemon mode & restart reconfig old process
	ir.daemon test			- test mode
	ir.daemon monitor		- full monitor
	ir.daemon config		- print config
	daemon= verbose=1 ir.daemon	- debug foreground mode
	ir.daemon kill			- stop daemon

CONFIG FILES

	/tmp/ir.daemon.pid		- pid file
	./ir.daemon.conf 		- config 
	./ir.daemon.conf.example	- config example
	/etc/ir.daemon.conf		- config

CONFIG SYNTAX

	# comment
	# CODE CMD 		# comment
	83e303 echo START	# START/STOP
	83e330 play start.ogg 	# PLAY

REQUIRE
	evtest

Remote setup

Run ir.daemon test and now we press the buttons one by one. We can see the codes (scancode) for the buttons

b2dc
b288
b282
b2ca
b2ce
b2d2
b2c5
b29a
b281
b280

further we put them in /etc/ir.daemon.conf

the syntax is /etc/ir.daemon.conf

each line has the form

IR_CODE CMD

where IR_CODE code for the button of the console, and CMD is the usual linux command that is called when the key is pressed with this code

comments #

use the built-in editor nano /etc/ir.daemon.conf

example /etc/ir.daemon.conf

ir.daemon config - config output

## rc config two

b2dc echo START		# START/STOP
b288 audio.vol.toggle	# MUTE
b282 echo HOME		# HOME
b2ca mpc volume +	# UP
b299 mpc prev	        # LEFT
b2ce mpc play   	# SET/OK
b2c1 mpc next	        # RIGHT
b2d2 mpc volume -	# DOWN
b2c5 wifi.toggle	# MENU
b29a echo BACK		# BACK
b281 audio.vol.down	# VOL DOWN
b280 audio.vol.up	# VOL UP

Test the config

daemon=0 verbose=1 ir.daemon

push the buttons and check how it works)

if everything works as it should then run IR daemon ir.daemon

Simultaneous use of several remotes

IR setup mizy

here we have no problems - I have just two different remote controllers (they use different codes) and therefore you need to duplicate the command for each - for example:

root@miZy:~# ir.daemon config | grep LEFT

83e363 mpc prev # LEFT
b299 mpc prev	# LEFT