Skip to content

Rotary Encoders

project-owner edited this page Feb 23, 2020 · 20 revisions

Rotary encoders (RE) look a bit awkward on the modern devices which we usually used to control from touchscreens. But I found it more convenient and intuitive to use RE for volume control than touchscreen. The latter is good for visual feedback of your RE actions. Also when the touchscreen is in screensaver mode and volume control UI component is not visible then RE is also the best way to change the volume.

The Rotary Encoders which were used for Peppy player can be connected directly to the Raspberry Pi's GPIO pins. Each RE needs four GPIO pins. One of these pins is Ground and the rest are signal pins. There is no need to connect positive power voltage to the RE as GPIO pins in Raspberry Pi can be programmatically configured to use pull-up resistors which connect the pin to the positive voltage through resistor.

The following diagram shows which GPIO pins were used for this connection. The GPIO pins which are not in use by another components and which are close to each other were selected. It's easier to make connection cable when the pins/wires are grouped together.

re-1

The RE used for Peppy player have push-button functionality. One push-button serves for mute and the other for menu item selection functionality. Each push-button has two contacts - one for Ground and the other for Signal. Therefore to simplify the connection cable just one Ground signal from GPIO can be used and two Ground pins can be connected to each other on the RE itself. You can see that connection (copper wire) between Ground pins in the following image.

Two black aluminum knobs attached to the REs provide nice inertia while adjusting the volume level or tuning radio station because of their heavy weight.

re-2

The pin assignment and jitter filter value can be changed either directly in the config.txt file or using the Configuration Web UI.

[gpio]
use.rotary.encoders = True
rotary.encoder.volume.up = 16
rotary.encoder.volume.down = 26
rotary.encoder.volume.mute = 13
rotary.encoder.navigation.left = 6
rotary.encoder.navigation.right = 12
rotary.encoder.navigation.select = 5
rotary.encoder.jitter.filter = 1

re-config

<<Previous | Next>>

Contents

Clone this wiki locally