Using Iguanaworks and IrDroid USB-INFRARED devices with LIRC under UBUNTU for Infrared Automation

April 9, 2023   

TL;DR:

I finally achieved using both Iguanaworks and IrDroid USB-INFRARED devices with LIRC under ubuntu 22.04.

This blog describes how I did this.

History

I was using IrDroid (Bulgaria) USB IR Transceiver ( https://irdroid.com/irdroid-usb-ir-transceiver/ ) with LIRC for many years to automate my infrared remote control operations at home.

The device looks like this

I think this device is probably a clone of “ir_toy” ( http://dangerousprototypes.com/docs/USB_IR_Toy_v2 ), which is unfortunately can not be ordered from seedstudio anymore.

For my recent testing of STB and TV’s, I needed more of this device, but unfortunately it is sold from Paypal only and Paypal is blocked in Turkey since a few years now.

So I couldn’t buy it and start looking for alternatives.

One promising alternative I found is from Iguanaworks (USA). The device is here: https://www.iguanaworks.net/products/usb-ir-transceiver/

As described in this page, this device has two models:

  • dual socket : This one has a built in receiver
  • socket-receive : This one doesn’t have any built-in receiver or transmitter.

when I wanted to buy one, dual-socket one was out-of-stock. So I bought “socket-receive” model.

Initially, I made a mistake and I thought that device has a built-in transmitter. But actually this model doesn’t have any receiver or transmitter, you need to buy seperate receiver and transmitter ( emitter) cables.

So I ended up making two orders:

Problem-1: Iguanaworks WIKI

IMHO, the WIKI on iguanaworks website is outdated and misleading.

It doesn’t describe clearly that on modern linux kernels ( 5.0+ ) , the device just works out-of-box, and leads you to think that you need to use their “iguanaIR” software ( daemon + client ) on your host.

Actually it is not, the device just works out-of-the-box on ubuntu 22.04.

I tried both kernel 5.15.x and 6.2.x kernels, and it is already supported:

stulluk ~ $  grep -i "iguana" /boot/config-5.15.0-67-generic 
CONFIG_IR_IGUANA=m
stulluk ~ $  grep -i "iguana" /boot/config-6.2.10-060210-generic 
CONFIG_IR_IGUANA=m
stulluk ~ $ 

Note: Same is valid for ir_toy clones, such as IrDroid:

stulluk ~ $  grep -i "ir_toy" /boot/config-*
/boot/config-5.15.0-67-generic:CONFIG_IR_TOY=m
/boot/config-6.2.10-060210-generic:CONFIG_IR_TOY=m
stulluk ~ $ 

So you don’t have to install anything other than “LIRC” on your ubuntu based host, it will just work.

The important part is the configuration of LIRC and your user groups.

How to reproduce a working environment with ubuntu 22.04 and Iguanaworks USB IR Transceiver

  • Make sure you did not add PPA of Iguanaworks and you did not installed their “iguanaIR” software
  • Make sure you did NOT blacklisted “iguanair” kernel driver:
stulluk ~ $  grep -i "iguana" /etc/modprobe.d/*
/etc/modprobe.d/iguanair.conf:#blacklist iguanair
stulluk ~ $ 
  • Make physical connections as follows:

  • insert the device to your PC and check for /dev/lirc :
stulluk ~ $  ls -la /dev/lirc0 
crw-rw---- 1 root video 237, 0 Nis  9 23:08 /dev/lirc0
stulluk ~ $ 

As you see above, the device node is in “video” group. So you need to add your username to this group. Additionally, in order to use “IrScrutinizer” application (see below for reason ) , you also need to add your user to “dialout” group:

stulluk ~ $  sudo usermod -aG dialout stulluk 
stulluk ~ $  sudo usermod -aG video stulluk 
stulluk ~ $  groups 
stulluk adm tty dialout cdrom sudo dip video plugdev lpadmin lxd sambashare docker vboxusers
stulluk ~ $  

And after this, reboot your PC !!!

  • After reboot, modify /etc/lirc/lirc_options.conf as follows:
stulluk ~ $  cat /etc/lirc/lirc_options.conf 
# These are the default options to lircd, if installed as
# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8)
# manpages for info on the different options.
#
# Some tools including mode2 and irw uses values such as
# driver, device, plugindir and loglevel as fallback values
# in not defined elsewhere.

[lircd]
nodaemon        = False
driver          = default
device          = auto
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
plugindir       = /usr/lib/x86_64-linux-gnu/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600
#effective-user =
listen         = 8765
#connect        = host[:port]
#loglevel       = 6
#release        = true
#release_suffix = _EVUP
#logfile        = ...
#driver-options = ...

[lircmd]
uinput          = False
nodaemon        = False

# [modinit]
# code = /usr/sbin/modprobe lirc_serial
# code1 = /usr/bin/setfacl -m g:lirc:rw /dev/uinput
# code2 = ...


# [lircd-uinput]
# add-release-events = False
# release-timeout    = 200
# release-suffix     = _EVUP
stulluk ~ $  sudo systemctl restart lircd
stulluk ~ $  sudo systemctl status lircd
● lircd.service - Flexible IR remote input/output application support
     Loaded: loaded (/lib/systemd/system/lircd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-04-10 00:07:55 +03; 6s ago
TriggeredBy: ● lircd.socket
       Docs: man:lircd(8)
             http://lirc.org/html/configure.html
   Main PID: 5552 (lircd)
      Tasks: 2 (limit: 76306)
     Memory: 604.0K
        CPU: 3ms
     CGroup: /system.slice/lircd.service
             └─5552 /usr/sbin/lircd --nodaemon

Nis 10 00:07:55 u22 systemd[1]: Started Flexible IR remote input/output application support.
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Notice: Driver API version: 3
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Notice: Driver  version: 0.10.0
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Notice: Driver  info: See file:///usr/share/doc/lirc/plugindocs/default.html
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Info: lircd:  Opening log, level: Info
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Notice: Using systemd fd
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Warning: Running as root
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Info: Using remote: hiremco-old.
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Info: Using remote: hiremco.
Nis 10 00:07:55 u22 lircd-0.10.1[5552]: Notice: lircd(default) ready, using /var/run/lirc/lircd
stulluk ~ $ 

Critical setting here is : “driver = default” that means to use default “devinput” driver from kernel, and everything just works fine.

Don’t forget to restart systemd unit after making these modifications.

Note: I uncommented “listen = 8765” part to be able to use irsend over LAN for my automation scripts.

Receiver hardware testing

Enter this command on your terminal:

mode2 --raw --device /dev/lirc0

Just point your IR RCU to receiver cable, and press some button:

stulluk ~ $  mode2 --raw --device /dev/lirc0 
Using raw access on device /dev/lirc0
Using device: /dev/lirc/0
code: 0xffffff00
code: 0xb3220001
code: 0xe6100000
code: 0x4c020001
code: 0x3c060000
code: 0x4c020001
code: 0xe3010000
code: 0x4c020001
....

Actually, now you are ready to learn some RCU keycodes, but I want to mention some more details about my problems here:

Problem-2: LIRC irrecord bugs

When you want to “learn” some IR RCU code via LIRC, most of the references on the net points you to a cli application called “irrecord” : https://www.lirc.org/html/irrecord.html

However, after above setup, when I run irrecord, I get two issues which I could not solved:

  • Something went wrong: Cannot decode data

Solution: Use IrScrutinizer !

After reading above suggestion in the comments from Bengt Martensson , I decided to see his works, and decided to try IrScrutinizer with Iguanaworks USB IR Transceiver:

  • learning the RCU :

In order to export compatible with LIRC, you need to select OPTIONS -> EXPORT FORMATS -> LIRC from the top bar.

Final hiremco.conf file

I tried this with two RCU’s but I am putting my final RCU config file here for reference:

stulluk ~ $  cat /etc/lirc/lircd.conf.d/hiremco.conf 
# IrScrutinizer parametric export
#
# Creating tool: IrScrutinizer version 2.4.0
# Creating user: stulluk
# Creating date: Sat Apr 08 22:50:14 CEST 2023
# Encoding: WINDOWS-1252
#
# Manufacturer: hiremco
# Model: v10
# Displayname: hiremco
# Device Class: Device Class
# Remotename: new
#

# Protocol name: NEC
begin remote
	name		hiremco
	bits		32
	flags		SPACE_ENC|CONST_LENGTH
	eps		30
	aeps		100
	zero		564	564
	one		564	1692
	header		9024	4512
	ptrail		564
	gap		108000
	frequency	38400
	begin codes
		KEY_POWER	0x00000000807F807F
		KEY_MUTE	0x00000000807F48B7
		
		KEY_RED		0x00000000807F8A75
		KEY_GREEN	0x00000000807F4AB5
		KEY_YELLOW	0x00000000807FCA35
		KEY_BLUE	0x00000000807F2AD5
		
		KEY_REWIND	0x00000000807FA25D
		KEY_FORWARD	0x00000000807F38C7
		KEY_PREVIOUS	0x00000000807FF807
		KEY_NEXT	0x00000000807FE21D
		
		KEY_AUDIO	0x00000000807F18E7	
		KEY_PLAY	0x00000000807F22DD
		KEY_STOP	0x00000000807F629D
		KEY_RECORD	0x00000000807F30CF

		KEY_XTREAM	0x00000000807FC23D
		KEY_IPTV	0x00000000807F6A95
		KEY_YOUTUBE	0x00000000807FEA15
		KEY_FREE	0x00000000807F926D
		
		KEY_MENU	0x00000000807F5AA5
		KEY_EXIT	0x00000000807F728D

		KEY_UP		0x00000000807FE817
		KEY_LEFT	0x00000000807F42BD
		KEY_OK		0x00000000807FA857
		KEY_DOWN	0x00000000807F58A7
		KEY_RIGHT	0x00000000807F827D
		
		KEY_SAT		0x00000000807FDA25
		KEY_INFO	0x00000000807F6897
		
		KEY_VOLUMEUP	0x00000000807FB04F
		KEY_VOLUMEDOWN	0x00000000807F28D7
		
		KEY_FAV		0x00000000807FAA55
		KEY_RECALL	0x00000000807FC03F
		
		KEY_PAGEUP	0x00000000807F02FD
		KEY_PAGEDOWN	0x00000000807F7887
		
		KEY_1		0x00000000807F00FF
		KEY_2		0x00000000807FE01F
		KEY_3		0x00000000807F609F
		KEY_4		0x00000000807F20DF
		KEY_5		0x00000000807FD02F
		KEY_6		0x00000000807F50AF
		KEY_7		0x00000000807F10EF
		KEY_8		0x00000000807FF00F
		KEY_9		0x00000000807F708F
		KEY_0		0x00000000807FC837
				
		KEY_EPG		0x00000000807F08F7
		KEY_TVRADIO	0x00000000807F906F
	end codes
end remote
stulluk ~ $  

So if you want to automate this RCU for testing, you just need to copy this file under “/etc/lirc/lircd.conf.d” and “sudo systemctl restart lircd” .

Transmitting / Emitting / Sending IR Signals with Iguanaworks USB IR Transceiver

Now you are ready to send some IR signals:

irsend send_once hiremco KEY_VOLUMEUP

Easy right? But I found that, the emitter signal power was way below compared to IrDroid so I asked to Iguanaworks support about it. They kindly replied me as follows:

The transmit power is fixed, but if you are not using a stereo->mono adapter on the wired IR emitter and you transmit on both channels (1&2) then the output on channel 2 is shorted and that shunts most of the power away. The solution is either to only transmit on channel 1 or use a stereo->mono adapter. I believe the LIRC + kernel driver should support this with the command

irsend SET_TRANSMITTERS 1

But if you have issues, that defintely work with the igdaemon + lirc iguanair driver.

So I simply tried:

irsend SET_TRANSMITTERS 1

And now the emitter signal power was much higher than before. Cool.

Recovering power back to low state:

irsend SET_TRANSMITTERS 1 2 3 4

Note: But I find that the diode they used is a narrow angle one and it is a single diode. Compared to IrDroid ( 3 diodes with wide angle ), this is a little downside of this device.

Anyway, it is also now possible to use irsend over network:

irsend -a 192.168.1.25:8765 send_once hiremco KEY_VOLUMEUP

Closing words

I think I achieved what I needed and I can use these Iguanaworks USB IR Transceivers for many years if they do not fail.

However, if you can use PayPal and be able to order IrDroid, it may be more powerful and cheaper solution.

I also would like to mention some other devices that I found as an alternative:

Some other device that I found interesting but not sure if it supports LIRC: https://www.analysir.com/blog/product/learnir-advanced-infrared-learner-module/


Happy infrared automation :)



comments powered by Disqus