Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Rotary Encoder: What are the possibilities?
#1
Hi there,

I've got a quick question regarding the rotary encoder.
I'm using an IQAudio PiDigiAmp+ it forwards Pins for the
rotary encoder as well as mute.

Somehow the rot encoder does not seem to work for squeezelite, is this true?
I would like to control the volume for squeezelite/spotify/bluetooth - is this possible
with a rotary encoder?

Edit: I just noticed it doesn't work for any of the sources. It just clicks in the speaker...
any idea what causes this?

I'm using this one:
https://www.aliexpress.com/item/Promotio...4c4dsKyyao


Thank you,
Christoph
Reply
#2
moOde 's built in rotary encoder driver controls MPD volume and also updates the volume knob. Controlling the volume for any of the renderers happens on the client that's running the playback app for the renderer and thus a rotary encoder is not applicable.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(03-30-2019, 12:49 PM)Tim Curtis Wrote: moOde 's built in rotary encoder driver controls MPD volume and also updates the volume knob. Controlling the volume for any of the renderers happens on the client that's running the playback app for the renderer and thus a rotary encoder is not applicable.

Thank you Tim. Any idea why I only get a weird clicking noise in the speaker when using the encoder?
Does it log anything or how could I debug this?
Reply
#4
The driver runs the commands below when it detects clockwise or counterclockwise movement in the encoder. you could just run these manually from ssh to verify that MPD volume is changing and the knob is being updated.

Code:
/var/www/command/rotvol.sh -up 1

/var/www/command/rotvol.sh -dn 1
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
(03-30-2019, 01:26 PM)Tim Curtis Wrote: The driver runs the commands below when it detects clockwise or counterclockwise movement in the encoder. you could just run these manually from ssh to verify that MPD volume is changing and the knob is being updated.

Code:
/var/www/command/rotvol.sh -up 1

/var/www/command/rotvol.sh -dn 1

Thank you Tim, the scripts itself work so I assume it's a problem either with the connection or the script that calls these commands.
Can you maybe tell me from where this is called and if I can test that?
Reply
#6
They are called from the rotary encoder driver.

The binary is /usr/local/bin/rotenc
The source code is in the Git repo
https://github.com/moode-player/moode/bl...c/rotenc.c
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
(03-30-2019, 02:58 PM)Tim Curtis Wrote: They are called from the rotary encoder driver.

The binary is /usr/local/bin/rotenc
The source code is in the Git repo
https://github.com/moode-player/moode/bl...c/rotenc.c

Thank you, do you have any idea what the following debug output means?
DEBUG: 1 
ISRDBG: 0 
delay: 100 
accel: 2 
step: 3 
pin_a: 38 
pin_b: 40 
gpio: Unable to open GPIO direction interface for pin -1: No such file or directory
gpio: Unable to open GPIO direction interface for pin -1: No such file or directory
start
Reply
#8
No worries, I used the wrong IDs - it works if I use 28, 29 instead.

However, this is still very strange:

If I run rotenc the music playback (moode playlists) is muted. If I turn the encoder, the volume in the interface
is correctly increased/decreased, but I don't have sound anymore until I reboot.

Also I have these cracking noises in my speakers...
Reply
#9
The driver uses the wiringPi GPIO library and so you need to use wiringPi pin numbering scheme.
http://wiringpi.com/pins/

You can also run the cmd below to print out the pin numbers

Code:
gpio readall

Note: The cmd won't work on Pi-3A+ until I bump to wiringPi 2.50 lib.

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#10
Thanks, I figured out how to correctly read the GPIOs.

However:

- there are still cracking sounds when I turn the encoder
- if I try to read the GPIO with this simple script, it works, but as soon as I start the script, Moode stops the music and somehow
does not recover: https://www.raspberrypi.org/forums/viewt...p?t=198815

@Tim Curtis is there anything I can do to debug this or fix it?
Reply


Forum Jump: