Control Jivelite by rotary encoders and buttons

mini11 13 July 2022 pCP 7.0.0 Projects  •  •  •

Your display has no touch function and you want to control jivelite by hardware? Here is the solution.

How to control Jivelite by rotary encoders and pushbuttons.

Thanks to chill for the script (pirate-audio amp).



  • You can simply control jivelite by adding rotary encoders and/or pushbuttons to the GPIO’s of your Raspberry Pi.

What we need

  • A running piCorePlayer with Jivelite installed and a display connected to your Raspberry Pi
  • Some pushbuttons (normally open)
  • One or two rotary encoders (for this purpose, do not use encoders with power supply!)
  • Some jumper wires (female to bare wires)
  • Soldering iron, solder
  • Some heat shrink tubes


  • The handles with Jivelite key commands. Knowledge of these commands is an advantage.

For a complete list of Jivelite key commands—see Jivelite key commands.

  • Solder the jumper wires to rotary encoders and/or pushbuttons. Use some heat shrink tubes to get a stable connection and avoid short circuit.



  • Wire pushbuttons and rotary encoders as shown here. This example matches with the below.



If you have connected an I2S DAC, do not use the blue coloured GPIO’s. The red GPIO’s are reserved if there is an SPI display on CE1. Do not use one GPIO for multiple purposes!


Step 1 - Install extensions
  • Bring up the pCP web interface.
    • On [Main Page] scroll down to “Additional functions” and click on the [Extensions] button. Wait for green ticks.


  • Click on the [Available] tab, in the “Available extensions in the piCorePlayer repository” section.


  • Load the nano.tcz extension.
  • Load the pcp-sbpd.tcz extension.
  • Check if the pigpio.tcz is installed. If not, load the pigpio.tcz extension.
Step 2 - Make a
  • Login to your RPi via ssh (software=putty – user: tc, password: piCore) and enter the following command:
sudo nano /home/tc/
  • Copy the following text and paste it into an empty file:


# start pigpiod daemon
pigpiod -t 0 -f -l -s 10

# wait for pigpiod to initialize - indicated by 'pigs t' exit code of zero

count=10 # approx time limit in seconds
while ! pigs t >/dev/null 2>&1 ; do
	if [ $((count--)) -le 0 ]; then
		printf "\npigpiod failed to initialize within time limit\n"
		exit 1
#	printf "\nWaiting for pigpiod to initialize\n"
	sleep 1
printf "\npigpiod is running\n"

# load uinput module - required to be able to send keystrokes
# then set the permission to group writable, so you don't need to run sbpd with root permissions
sudo modprobe uinput
sudo chmod g+w /dev/uinput

# The full list of Jivelite key commands can be found here:

# button 1						# button-section, defines the GPIO and key-commands
SW1=5 							# GPIO (BCM, not Board)
SH1=KEY:KEY_1					# key-command for SHORT press (here: preset 1)
LO1=KEY:KEY_2					# key-command for LONG press (here: preset 2)
LMS1=250 						# milliseconds for long press

# button 2

# button 3

# button rotary 1
SH4=KEY:KEY_SPACE				# key-command for SHORT press(play/pause)
LO4=KEY:KEY_LEFTBRACE			# key-command for LONG press(special menu)

# button rotary 2
SH5=KEY:KEY_ENTER				# key-command for SHORT press(enter, OK)
LO5=KEY:KEY_ESC					# key-command for LONG press(back)

# CMD="sbpd -v -f /home/tc/sbpd_commands.cfg \
CMD="sbpd -v \
b,$SW1,$SH1,2,0,$LO1,$LMS1 \	# b=button, $SW1=switchnumber of button-section
b,$SW2,$SH2,2,0,$LO2,$LMS2 \
b,$SW3,$SH3,2,0,$LO3,$LMS3 \
b,$SW4,$SH4,2,0,$LO4,$LMS4 \
b,$SW5,$SH5,2,0,$LO5,$LMS5 \
e,22,27,VOLU,2 \				# e=encoder, 22 and 27 are GPIO
e,23,24,KEY:KEY_UP-KEY_DOWN,4 "	# e=encoder, 23 and 24 are GPIO

echo $CMD
$CMD > /dev/null 2>&1 &
  • Save your changes and exit nano (Ctrl+X and confirm by pressing y).
  • Make executable:
sudo chmod +x /home/tc/
Step 3 - User command in pCP web-gui
  • Go to pCP web interface and click [Tweaks] tab.
  • Scroll to section User commands and add
  • to user command #1 (bottom of the ‘Tweaks’ page), then click [Save].


  • That’s it. After a reboot, your rotary encoders and pushbuttons should work as expected.

Additional hints

  • The script is an example. You can change the GPIO’s in “button sections” for your purpose.
  • For rotary encoders, edit the GPIO’s in the command section of the
  • If your rotary encoders work in wrong direction, swap the GPIO wiring.
  • Most rotary encoders have a pushbutton. You can use it to trigger a key command.
  • The numbers after SW1 – SW 5= are the GPIO of your RPi (see wiring table above).
  • Every button triggers two jive actions (short and long press, SH and LO).
  • The quantity of buttons is only limited by quantity of available GPIO’s.
  • The key command KEY:KEY_1 triggers a preset. For that purpose, you need to add presets in LMS Web interface for this player (settings/player/presets).
  • Only commands by rotary? Do not use Grid Skins. They need additional left/right key commands.

More information

The Software and Information is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.
Raspberry Pi is a trademark of the Raspberry Pi Foundation.