I didn’t found any instructions for the mouse emulation so I wanted to share the outcome of reading different pages accross the internet.
Partially adapted from:
Volumio2 basic remote control and mouse emulation using lirc.
Any working remote,
TSOP4838 receiver or similiar,
100 Ohm resistor,
0,1µF capacitor ,
Volumio with Touchscreen plug-in installed on your RPi.
(Check datasheet for pinning of your TSOP first!!!)
- Connect one side of 100 Ohm to V+ of TSOP (TSOP4838 => Pin3).
- Connect other side of 100 Ohm to either 3.3V or 5V of RPi (should work both).
- Connect one side of capacitor to TSOP GND (Pin2) and other side to TSOP V+ (Pin3).
- Connect TSOP Data (Pin1) to any unused RPi GPIO. It can be any GPIO,
but consider used pins of add-on boards such as sound cards etc. (see vendor
documentation). Remember the logical GPIO number (!Not the physical pin
Prepare volumio OS:
sudo apt-get update sudo apt-get install lirc
- Edit /boot/config.txt:
Add the following lines at end of config.txt:
#... dtoverlay=lirc-rpi dtparam=gpio_out_pin=26 dtparam=gpio_in_pin=17 dtparam=gpio_in_pull=down
Important for receiving is the line dtparam=gpio_out_pin=…
Enter the GPIO number from section Prepare Hardware step (4.).
(In my case, I choosed pin 26 because it does not conflict
with my Hifiberry Amp+)
- Edit hardware.conf of lirc:
sudo nano /etc/lirc/hardware.conf
modify the file with the following content:
#... LIRCD_ARGS="--uinput" # Enable the lirc mouse deamon START_LIRCMD=true #... DEVICE="/dev/lirc0" MODULES="lirc_rpi" # ... # Default configuration files for your hardware if any LIRCD_CONF="" LIRCMD_CONF="/etc/lirc/lircmd.conf"
Setting of LIRCMD_CONF=… is only needed if you want to
enable lirc mouse emulation.
- Stop lirc deamon and learn commands of your favourite remote
sudo /etc/init.d/lirc stop
irrecord -n -d /dev/lirc0 /home/volumio/lircd.conf
(follow instructions on screen, names of the keys can be your choice)
- Copy previously recorded lircd.conf to /etc/lirc
cp /home/volumio/lircd.conf /etc/lirc/lircd.conf
- Start lirc deamon:
sudo /etc/init.d/lirc start
- Check if remote works by runnig:
…and press some buttons, it should print the button names
that you have given under step (2.)
- Create .lircrc in /home/volumio
See content of my .lircrc:
begin prog = irexec button = power config = shutdown -h now end # volumio direct control begin prog = irexec button = mute config = volumio volume toggle end begin prog = irexec button = volume_up config = volumio volume plus end begin prog = irexec button = volume_down config = volumio volume minus end begin prog = irexec button = seek_forward config = volumio seek plus end begin prog = irexec button = seek_backward config = volumio seek minus end begin prog = irexec button = windows config = volumio random end begin prog = irexec button = tv_recordings config = volumio repeat end begin prog = irexec button = play config = volumio play end begin prog = irexec button = stop config = volumio stop end begin prog = irexec button = pause config = volumio toggle end begin prog = irexec button = skip_forward config = volumio next end begin prog = irexec button = skip_backward config = volumio previous end begin prog = irexec button = channel_up config = volumio next end begin prog = irexec button = channel_down config = volumio previous end
(the names for “button =” must match the names that you
provided in the irrecord session under step (2.)
- Add irexec to rc.local:
sudo nano /etc/rc.local
see my rc.local:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. (sleep 3; sudo -u volumio irexec -d )& exit 0
Now volumio should be able to be controlled by your remote.
To enable the mouse emulation follow additional steps.
My remote has arrow buttons for mouse movement
and a center OK button for left click.
Alternatively use your number buttons:
- Center 5 for left click.
- 2, 4, 6, 8 for North, West, East, South.
- If you like: 1, 3, 7, 9 for diagonal movement such as NW, NE, SW, SE
- Edit /etc/lirc/lircmd.conf (again, log in via ssh):
sudo nano /etc/lirc/lircmd.conf
See my file:
To find out how to get a proper configuration file please read:
lircmd config file
ACCELERATOR start max multiplier
ACCELERATOR 2 30 5
#TOGGLE_ACTIVATE * ok
MOVE_N * up
#MOVE_NE * 3
MOVE_E * right
#MOVE_SE * 9
MOVE_S * down
#MOVE_SW * 7
MOVE_W * left
#MOVE_NW * 1
#MOVE_IN * CH+
#MOVE_OUT * CH-
#BUTTON1_TOGGLE * 5
#BUTTON1_TOGGLE * RADIO
#BUTTON2_TOGGLE * VOL+
#BUTTON3_TOGGLE * SOURCE
BUTTON1_CLICK * ok
#BUTTON1_CLICK * Asterix
#BUTTON3_CLICK * #
BUTTONx_CLICK, BUTTONx_UP, BUTTONx_DOWN are also possible[/code]
- Again, after each “*” enter the name of the buttons
from your irrecord session from step (2.).
- “*” stands for any remote that is recognized by lirc.
- TOGGLE_ACTIVATE: decide if you want to use a special
button to enable/disable mouse emulation.
In my case it is commented out and therefore always enabled.
- Modify ACCELERATOR to adjust the behavior of movements to your needs.
- You may comment in MOVE_NE etc. to enable diagonal movements.
- Modify X server configuration. Create a file:
sudo nano /usr/share/X11/xorg.conf.d/80-lircmouse.conf
(name of the file should start with a number and MUST end with .conf;
the rest is your choice)
See content of my file:
Section "InputDevice" Identifier "LIRC-Mouse" Driver "mouse" Option "Protocol" "IntelliMouse" Option "SendCoreEvents" Option "Buttons" "5" Option "ZAxisMapping" "4 5" EndSection
(content from lirc.org)
The remote should now work as expected:
- Basic remote control for volumio.
- Mouse emulation