[PLUGIN] RotaryEncoder II

Hi Markus,

On V3 it is discouraged to provide zipped plugins to users directly. There also seems to be no zipped plugin anymore in a branch of the repo.

There seems to be quite some backlog with PRs for plugins, I do not know how long it will take until the plugin will become available on the plugin beta channel.
If you are desperate to use the new version, there are tools to download a directory from GitHub as a zip file. You could for example use https://download-directory.github.io to download the 1.0.10 folder from my Github repo and then use the same process as you did for the 1.0.7.

1 Like

Any ideas as to why pressing the rotary encoder button resets my pi? The button pulls the GPIO to ground upon press, even activating logic low in the options. The lights on the pi dim whilst it’s pressed and resets the system as if it’s pulling a power rail to ground. Have tried multiple GPIO pins but I’m not entirely sure what to try.

Since you provide only limited info, I can only try to make some wild guesses, but will try to do so:
Does the same thing happen, when the plugin is not installed? I assume so, because the way you describe it sounds like a hardware problem.

  • The fact that the “lights” are dimming sounds like an issue with your GPIO settings and/or schematic.
    If the GPIO is configured as an input and correctly connected, there shouldn’t be much current in or out of the GPIO, regardless of the input being high or low, if high = 3.3V and lo = 0V.
  • Are you using external resistors or directly shorting the pin to ground? In case the GPIO is for some reason incorrectly configured (as an output) and you are directly shorting it to GND, you would be shorting the driver-stage of the IO to GND, which would probably explain the dimming of the LEDs and probably kill your IO soon (I know, there are many tutorials online telling you to directly connect to GND, but that is a poor design, never do that). It is always advisable, to not directly short to ground, but use a series resistor with your pin, to make sure, that the current stays within the spec of the GPIO, even if it should be (briefly) configured as output, e.g. during boot up. A good design also has to keep transient states under control - even if you do not notice, transient states with high current peaks can reduce the lifetime of Semiconductor devices.
  • Which GPIO are U using? Some of them are reserved for certain purposes and have to be reconfigured, before you can connect a button.
  • The plugin itself is not configuring the GPIOs. It is basically just connecting the software to the hardware via dtoverlay and npm OnOff - both are used a lot - so I assume, they are not the source of the problem.
  • In case you are using an I2S DAC, you need to pay attention, if it is using the GPIO. The info is normally found in the datasheet of the DAC. Some of them reserve multiple GPIOs
  • If you know how to log into your Pi, you can try to run gpio readall to read the current GPIO config.
  • If you are just starting with the RPi, you may not know this trap: Are you connecting to the correct pin? (RPi numbering is confusing, since there are three different Pin numbering systems (Physical, wiringPi, BCM). If you accidentally connect GND via your button to a 3.3V pin, you would also directly pull the power-rail low.

You can find more info about the Pi hardware here:

Hi!
I successfully installed version 1.0.10 on an (unofficial) Volumio 3.236 and it works fine - except one thing: I´m not able to save any setting from the GUI. When I manually edit the config.json to my needs, I can see my settings also in the GUI and everything works perfectly.
I´ve installed the plugin from a zip file - maybe the new Volumio version is more restrictive to that?

Hi! Do you have any idea, how to find out if something is still wrong? I changed the category mid December and did not see anything happening to the PR.
In this thread, several people confirm, that the plugin is working - so I’d think it would at least qualify for a beta release. But I have no idea, what I can do or who I can ask to do anything. And I also do not know, if there is anything I can do.
Looked through the forums, but also could not figure out details - seems it is somehow going slow with the plugins but at the same time, there are PRs that just take 9 days from creation to merge.

Let me know, if there is anything I can do… beside being patient.

1 Like

Hi!
The installation via ZIP file should normally not matter. Can you describe, in which order you do settings after install? On my test-system I did quite some testing - but I did not test every possible order of doing things, so you may be running into a bug, which did not show up with my settings.
On my v3.139 test-system, I can always save, unless I put non-sense values.
One thing you can check: The plugin is doing some sanity checks on the settings you provide, so it may be rejecting to save, if the sanity check fails. However, the Toast message are sometimes too quickly overwritten to read them. Luckily, the logging does contain the exact reason for failure.
You could try to enable the debug mode in the settings and then either log in to your Volumio device and issue a journalctl -f to see the live logging or open a second browser window and open volumio.local/dev and enable the live log.
You may then see messages like this, telling you why it did not save:

info: [ROTARYENCODER2] sanityCheckSettings: Rotary3 for:{"enabled2":true,"rotaryType2":{"value":1,"label":"1/1"},"pinA2":"","pinB2":"","dialAction2":{"value":1,"label":"Volume"},"socketCmdCCW2":"","socketDataCCW2":"","socketCmdCW2":"","socketDataCW2":"","pinPush2":0,"pinPushDebounce2":0,"pushState2":false,"pushAction2":{"value":0,"label":"..."},"socketCmdPush2":"","socketDataPush2":"","longPushAction2":{"value":0,"label":"..."},"socketCmdLongPush2":"","socketDataLongPush2":"","delayLongPush2":"1500","doublePushAction2":{"value":0,"label":"..."},"socketCmdDoublePush2":"","socketDataDoublePush2":"","delayDoublePush2":"700"}
info: [ROTARYENCODER2] getI18nString("TOAST_WRONG_PARAMETER"):Error in parameters
info: [ROTARYENCODER2] getI18nString("TOAST_NEEDS_INTEGER"):GPIO Pins must be Integers.
error: [ROTARYENCODER2] sanityCheckSettings: Pin values must be Integer
info: [ROTARYENCODER2] getI18nString("TOAST_SAVE_FAIL"):Save failed

You could also try to replicate the settings and send me the log of the session for review. Pls send it either via PM or upload as a zip. Pls do not post complete loggings here (it will blow up the thread too much).

Hi!
Thanks for your hints. I did a clean installation of the plugin on a clean official Volumio version 3.233. This is what I get from the live log when I simply enable the logging in the “Debug Settings” section of the plugin and press the “Save” button afterwards:

info: CALLMETHOD: user_interface rotaryencoder2 updateDebugSettings [object Object]
info: CoreCommandRouter::executeOnPlugin: rotaryencoder2 , updateDebugSettings

And this is what I get from the live log when I configure the Rotary Encoder 1 and press the “Save” button afterwards:

info: CALLMETHOD: user_interface rotaryencoder2 updateEncoder [object Object]
info: CoreCommandRouter::executeOnPlugin: rotaryencoder2 , updateEncoder

Is this information helpful for you? If you have more suggestions for testing, just let me know :slight_smile: .
And again, I´m happy with the manually edited “config.json” file.

Edit1: Maybe the CALLMETHOD: user_interface… is the problem – should it be CALLMETHOD: system_hardware…?

Edit2: Fixed! When I replace “user_interface” by “system_hardware” in the file “UIConfig.json” I get the following message in the live log:

info: CALLMETHOD: system_hardware rotaryencoder2 updateDebugSettings [object Object]
info: CoreCommandRouter::executeOnPlugin: rotaryencoder2 , updateDebugSettings
info: [ROTARYENCODER2] getI18nString("TOAST_SAVE_SUCCESS"):Speichern erfolgreich
info: [ROTARYENCODER2] getI18nString("TOAST_DEBUG_SAVE"):Einstellungen für Fehlersuche

=>This will fix the effect :grinning:

Thanks for checking, I also found that out yesterday evening. I already uploaded version 1.0.11 to the repo. Will later update the links in the forum.
I do not know, how it could happen, that I had the corrected UIConfig.json on my test-system (which was running fine all the time) and obviously not the latest version of the UIConfig in the Github repo - but I cannot find out anymore. I use VSC for remote development on the RPi, I may have messed something up from the VSC interface.
Good that you posted here!
Downloadable via download-directory.github.io

1 Like

Hi , is it possibile to have an “how to “ wire encoder stec11b03. Thanks

1 Like

There are examples on this page of the documentation

1 Like

Hi @T0MR0

the plugin has been included in the official repository!

thanks for your great work!

Yes - seen it already! Nice :blush:

Good afternoon.
So far I have used the plugin version from Saiyato. It worked very well. Volume, button.
Yesterday I installed Volumio 3.251. Only RotaryEncoder II is among the plugins. I have installed. The volume works perfectly, but the push button doesn’t work at all. Sometimes it will work once - right after starting Volumio, then not. Sometimes pressing causes a reboot the respberry.
My encoder is KY-040, all lines have a pullup and a 100nF capacitor. Changing the GPIO does not help, the effects are the same.
Platform: Raspberry Pi 3A+. I don’t use a DAC, only an LCD on i2c.
UPDATE!
The problem only occurs on the internet radio!
When listening to music from a NAS, everything works perfectly!

Hi elpaul,

Sorry to hear it is not working. I’d like to try and help, but need a little more info from your side.

  1. “Pressing causes a reboot” sounds bad - but unlikely to be software related. For the button press I rely on the npm onoff module. Would not know, how I can make the Pi crash via that… unless you have selected “reboot” as one of the button press options :wink:
    By the way, if you have ‘reboot’ on the double-click and bouncing, this may actually be the case. But with pullup and 100nF, unlikely.

  2. You do not even mention, which commands you are sending to Volumio by push-button. I am actually using the plugin on my Tube Radio project, that is only playing Internet Radio - all actions like Start, Stop, Pause, Mute are working on my system - so I need more info.

  3. To see, if there is a problem with the logic of the plugin, that does not generate problems for the other users, but in your case does, it would help if you can enable logging and generate a log-file while the problem occurs (ideally not too much additional log stuff around that occurence). I already just added a step-by-step instruction to the top post of this thread in a collapsible section.

I must already ask for some patience - family and work keep my time limited.

hi I need help with me rotary encoder. I have 3 encoders but doesn’t work well. does someone have my config and can share the gpio used? thanks
i have three stec 11b03 tried at 5 and 3 v without resistance … sometimes works but press button never works… thanks for any help
my hardware pi3 with hifiberry dac2hd board

please provide some more details about the hardware connection of the push-button.

I am using this plugin with a 10 kOhm -pull-up resistor to 3.3V and a 10 nF capacitor, the push-button of the encoder works like a charm with the following setting:

here below the complete schematic

Hi Whisper 74.
You should never connect the GPIOs to 5V.
They are specified at 3.3V and should be operated there. 5V will damage them sooner or later.
That said: if the rotary‘s rotational function is ok, then the switch should also be. Basically they are both just Switches.
If you do not use „any resistance“ that might be the problem: an open input is floating and can have both high and low state. Try to Google for „pull-up/-down resistor“ to get explanations. There are internal pull-ups in the Pi, but they are not always enabled.
In principle you could also refer to the debouncing tips I compiled in the Docs, they will also work for buttons.
Feel free to come back if you still see issues. You can refer to the topmost post on this thread, if you want to provide logs.
I suppose your problem is wiring related, so a small sketch of your schematic will help.

I just realized I was using the old version 1.0.7

with the latest one 1.0.11 I also have problems with the push-button

@T0MR0 how can I help you to debug this issue?

Here some log information

thanks. can you share your gpio connection of your 3 encoders? i have no resistor on my encoder… but if i know the gpio a viable for encoders…