MuPiBox Documentation MuPiBox NG

Buttons, LEDs and rotary encoder

Connect and configure hardware buttons for playback and volume, lit buttons, the power LED and a volume rotary encoder on GPIO pins (BCM).

Under Hardware → Buttons you connect your own buttons, LEDs and a rotary encoder to the box. There is no fixed pin assignment – you enter the BCM numbers of the GPIOs you use.

Hardware buttons

With Enable hardware buttons five functions are available: play/pause, previous, next, volume up, volume down. Per button:

SettingMeaning
activeswitch the button on or off
GPIO pin (BCM)e.g. 22 for GPIO 22 (physical pin 15)
Pullinternal pull-up, pull-down or none
Active lowa press pulls the pin to ground (usual with pull-up)
Debounce (ms)filters the bouncing of mechanical switches
LEDoptional lighting of the button on its own pin

Wiring (default): button between the GPIO pin and ground (GND), choose pull-up and active low in the admin interface. No extra resistor is needed then.

Power LED

Glows while MuPiBox is running. On the MuPiHAT+ BCM 13 (connector J15) is preset; pin and active low can be changed. Its brightness can follow the display (see Display & power); in standby it glows with the standby brightness.

If fan (BCM 12) and LED (BCM 13) are on hardware PWM (dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4), the box dims smoothly; otherwise it only switches on and off.

Volume rotary encoder

A rotary encoder with two channels: CLK/A and DT/B to two free BCM GPIOs, the common terminal to ground.

SettingMeaning
CLK / A GPIO, DT / B GPIOthe two signal pins
Pullusually pull-up
Debounce (ms)keep it small (a few ms), otherwise detents get lost
Reverse directionif turning right makes it quieter

Turning changes the volume directly, limited by the maximum volume. A push button in the encoder can be entered as a normal button (e.g. play/pause).

Interactions

  • A pin can belong to only one function; the admin interface rejects duplicate pins.
  • The MuPiHAT pins (BCM 2, 3, 4, 17, with audio 16, 18, 19, 21) are off limits.
  • The power button is not one of these buttons – it runs through the kernel, see MuPiHAT or the GPIO reference.
  • Parental control applies to buttons too.