[PLUGIN] RotaryEncoder II

@M1ck I’ve changed DT GPIO 17 to GPIO 5. When I tried to update the plugin to change the value “PIN B GPIO” to 5, the plugin didn’t save it.

So I edited “/data/configuration/system_hardware/rotaryencoder2/config.json” to change the value. After I reboot the Raspberry, the value in PIN B GPIO update correctly to “5”.

What I get now for : journalctl | grep -i encoder*

Dec 10 19:26:53 litra kernel: bcm2835-codec bcm2835-codec: Loaded V4L2 encode
Dec 10 19:27:28 litra volumio[825]: info: Loading plugin "rotaryencoder2"...
Dec 10 19:27:29 litra sudo[1026]:  volumio : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/dtoverlay rotary-encoder pin_a=22 pin_b=5 relative_axis=true steps-per-period=2
Dec 10 19:27:29 litra kernel: rotary-encoder rotary@16: gray

But still the volume control doesn’t work.

Rotary encoder settings:

PS : Sorry I forgot to mention I use Spotify Plugin.

can you give these gpio numbers a try.
what plugin version are you using?

can you try not to make multiple posts, otherwise it will be a bit unclear :wink:
@Wheaten

Rotary Encoder II version is 1.0.15

I just tried this, when I turned down the volume, it looks like the sound did turn down and then the raspberry shutdown.

`

What I get for journalctl | grep -i encoder*

Dec 10 19:53:53 litra kernel: bcm2835-codec bcm2835-codec: Loaded V4L2 encode
Dec 10 19:54:24 litra volumio[814]: info: Loading plugin "rotaryencoder2"...
Dec 10 19:54:25 litra sudo[975]:  volumio : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/dtoverlay rotary-encoder pin_a=23 pin_b=24 relative_axis=true steps-per-period=2
Dec 10 19:54:26 litra kernel: rotary-encoder rotary@17: gray
Dec 10 19:57:30 litra volumio[814]: info: CALLMETHOD: system_hardware rotaryencoder2 updateEncoder [object Object]
Dec 10 19:57:30 litra volumio[814]: info: CoreCommandRouter::executeOnPlugin: rotaryencoder2 , updateEncoder
Dec 10 19:57:30 litra sudo[1672]:  volumio : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/dtoverlay rotary-encoder pin_a=23 pin_b=24 relative_axis=true steps-per-period=2
Dec 10 19:57:30 litra kernel: rotary-encoder rotary@17: gray

I found at that my config.json at data/plugins/system_hardware/rotaryencoder2 doesn’t seems to save my values:


    "enabled0": {
        "type": "boolean",
        "value": false
      },
    "rotaryType0": {
      "type": "number",
      "value": 0
    },
    "pinA0": {
      "type": "string",
      "value": ""
    },
    "pinB0": {
      "type": "string",
      "value": ""
    },
    "dialAction0": {
      "type": "number",
      "value": 0
    },
    "socketCmdCW0": {
      "type": "string",
      "value": ""
    },
    "socketDataCW0": {
      "type": "string",
      "value": ""
    },
    "socketCmdCCW0": {
      "type": "string",
      "value": ""
    },
    "socketDataCCW0": {
      "type": "string",
      "value": ""
    },
    "pinPush0": {
      "type": "number",
      "value": 0
    },
    "pinPushDebounce0": {
      "type": "number",
      "value": 0
    },
    "pushState0": {
      "type": "boolean",
      "value": false
    },
    "pushAction0": {
      "type": "number",
      "value": 0
    },
    "socketCmdPush0": {
      "type": "string",
      "value": ""
    },
    "socketDataPush0": {
      "type": "string",
      "value": ""
    },
    "longPushAction0": {
      "type": "number",
      "value": 0
    },
    "socketCmdLongPush0": {
      "type": "string",
      "value": ""
    },
    "socketDataLongPush0": {
      "type": "string",
      "value": ""
    },
    "delayLongPush0": {
      "type": "string",
      "value": "1500"
    },
    "doublePushAction0": {
      "type": "number",
      "value": 0
    },
    "socketCmdDoublePush0": {
      "type": "string",
      "value": ""
    },
    "socketDataDoublePush0": {
      "type": "string",
      "value": ""
    },
    "delayDoublePush0": {
      "type": "string",
      "value": "700"
    },
    "enabled1": { ... ... . ...
.... .... ... ...

Is this normal?

I changed it with the one with correct values. But when I use the rotary, the raspberry shutdown.

no that is not normal, in my system the changes are saved and will not just reboot.
maybe uninstall the plugin and do it again with the correct setting and then reboot and check.

@LaitEau

Leo,need to ask.
Are you sure that the encoder is connected properly.
With the pi like that Pin1,2 are on the bottom, but you connected the encoder to the top of the AMP100 GPIO21, which is now being used as 3.3V?
image

Ooops, you mean I have to reverse by 360 degrees my pins connected to the amp100 like this?

Yeah I doubt that hifiberry crossed all lines on the PCB. Couldn’t find any information on it, besides this.
look at the square marker (all others are round) , indicating pin 1.

2 Likes

Yes, your last picture is correct. Look at the square markers.

Thank you for this info, my pins were totally wrong…

I reverse the pins like this :

But unfortunately, volume control or shutdown doesn’t work, but the raspberry doesn’t turn off when using the rotary.

It’s working on volume when using only the Raspberry, but when trying to connect it through the AMP100 I don’t get any response

it’s possible you’re using a pin that is already used for something else.
https://www.hifiberry.com/docs/hardware/gpio-usage-of-hifiberry-boards/

HIFIBERRY AMP100

GPIO2-3 (pins 3 and 5) are used by our products for configuration. If you are experienced with I2C, you might add other slave devices. If you a a novice, we don’t recommend this at all.
GPIOs 18-21 (pins 12, 35, 38 and 40) are used for the sound interface. You can’t use these for any other purpose.
GPIO4 is used to control the MUTE function of the power stage. Pulling it to high will mute the output.
GPIO17 is used to reset the power stage (active low).

Looks like I’m not… :confused:

1 Like

seems to be problematic.

Prob. on purpose, to create a market for:
https://www.hifiberry.com/shop/boards/power-controller/

according to hifiberry, GPIO8-GPIO11 could be used for an encoder.
@LaitEau you can probably try it.

I’m trying it right now through the AMP100 with GPIO-8 and GPIO-11, but it doesn’t make any sense, sometimes it turns down the volume clockwise or anti-clockwise, sometimes the volume goes up, sometimes it looks really laggy. I’m really confused…

Yes I already subscribed to it ^^ but I think they won’t make it anymore

1 Like

Even if I have the issue when connecting through the AMP100 GPIO? Because when using only the Raspberry, the volume responded really quickly when turning the rotary.

Edit : Would it be a solution to solder the cables on Raspberry bottom?

Don’t think so. Your pi will then still be connected with Hifi board.
I this case I would disconnect the rpi. use some extension leads and only connect those pins that are needed to the AMP100
GPIO2-3 (pins 3 and 5)
GPIOs 18-21 (pins 12, 35, 38 and 40)
GPIO4 , GPIO17.

and connect the encoder to the rpi