Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotary Encoder Support for Volume Control #11

Closed
MeltyMakes opened this issue Jan 13, 2021 · 8 comments
Closed

Rotary Encoder Support for Volume Control #11

MeltyMakes opened this issue Jan 13, 2021 · 8 comments

Comments

@MeltyMakes
Copy link

Hello,
I was wondering how easy it would be to implement support for rotary encoders for volume control including possibly push to toggle mute/unmute. I took a look at the source code and it looks like you could add wrapper handlers tied to the A/B pins that call either handle_volume_up/down once the direction is determined. However, I'm not super familiar with how these scripts work on Raspberry Pi so I'm not sure whether storing state variables to decode the encoder would cause problems or not.

@TheBigFudge
Copy link

@SidewaysFinch did you get any further? can a rotary encoder be used to set the volume up/down?

@MeltyMakes
Copy link
Author

@TheBigFudge I haven't had time to look into it on the software side yet sorry. You could probably get it done in hardware if you made a decoder circuit and had it pulse to two GPIOs and set those to trigger the volume up/down events.

@Gadgetoid
Copy link
Member

The linked PR solution looks pretty tidy- if either of you has the hardware set up to give it a go, I'd appreciate some feedback. I'm still using a perched-on-the-end-of-a-kitchen-table office and don't have a Pi set up for testing at the moment.

@MeltyMakes
Copy link
Author

I can't promise results within the week but I'll see if I can't try and get things running soon. Thanks for the update!

@martinfelis
Copy link
Contributor

This issue likely can be closed. I have been using the code for the last two months without an issue.

@MeltyMakes
Copy link
Author

I managed to get some time this week to test my setup, it mostly works except it only seems to go in one direction for me? My mopidy.conf has the following:

[raspberry-gpio]
enabled=true
...
bcm23 = volume_up,active_low,10,rotenc_id=vol,step=1
bcm24 = volume_down,active_low,10,rotenc_id=vol,step=1

Whichever action is assigned to bcm23 is what happens, in this case it'll always increase in volume. I'm doublechecking my wiring today since it's likely that there's a short somewhere but I think this is otherwise good. If you have any ideas what I might be missing though @martinfelis I'd really appreciate it! Thanks.

@martinfelis
Copy link
Contributor

@SidewaysFinch It could be a timing issue, specifically the bouncetime value. I am using the following related settings in my device:

bcm21 = volume_down,active_low,2,rotenc_id=vol,step=1
bcm20 = volume_up,active_low,2,rotenc_id=vol,step=1

Also maybe try using different gpio pins?

@MeltyMakes
Copy link
Author

Huh I thought I commented last week but seems like I might've forgotten. The bouncetime was the issue, things are working fine now. I'll close the issue now, thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants