-
Notifications
You must be signed in to change notification settings - Fork 401
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
Add support for rotary encoder volume control #267
Comments
Beispiel für einen Drehgeber. Diesen habe ich verwendet. https://www.amazon.de/dp/B079H3C98M/ref=psdc_1626220031_t1_B00HSWXR9Y |
Hi @patman13
|
Hello Micz,
So, nothing new for you. ;-) |
circuit diagram
|
Hi great Idea! With sudo nano I created a rotary-encoder.service.sample in the "sampleconfigs" folder with the rotary-encoder.service.txt code in it, like I did it for the "ky040.py" and "rotary-encoder.py" scripts. That's what I did. ciao |
If I leave the capacitators out, I also don't need to connect GPIO 5&6 to the Ground ?
|
● rotary-encoder.service - Rotary Encoder Service Oct 28 20:20:37 raspberrypi systemd[1]: rotary-encoder.service: Failed with resu |
Just want to leave feedback: |
Do you use the 5V or the 3.3V pin? Thank you! |
Used 5V Pin on Raspberry Pi. Connected everything without Capacitors. |
You write (capacitors are optionally). What are the advantages if you use them? |
Works perfectly without capacitors! Thank you very much - Great Work! |
My problem was that, opening the txt files with notepad++ copy there and paste into putty, some "space" and "enter" commands were lost. I had to look a little closer to realize this. |
I would like to change the "mute" button to "20% Volume", because the children press it accidentally. I changed the line: but it does not work. What does the (dummy) mean? I deleted it, but It does not help. |
I noticed that if the knob is turned quite fast - it does react relative slow - is that the reason capasitors are applied? |
Same here. |
The effect of reacting bad to fast rotation of the knob results from the debouncing mechanism. |
Hi, ● rotary-encoder.service - Rotary Encoder Service Nov 07 17:17:55 raspberrypi systemd[1]: rotary-encoder.service: Unit entered fai Nov 07 17:17:55 raspberrypi systemd[1]: rotary-encoder.service: Unit entered failed state. |
I updated to the newest Version. After I put sudo systemctl enable rotary-encoder.service the encoder works, but the other buttons are disabled. When I put sudo systemctl disable rotary-encoder.service the other buttons work again but not the encoder. Has anyone an Idea? |
@MTam86 after you downloaded the newest Version the files ky040.py sudo chmod +x /home/pi/RPi-Jukebox-RFID/scripts/rotary-encoder.py Then the installation of the Script like Andco7 described: installed script following way: But note that with the newest version the Encoder works that way, but the buttons get disabled |
This is the error Code. pi@raspberrypi:~ $ service phoniebox-gpio-buttons status Nov 10 13:33:30 raspberrypi systemd[1]: phoniebox-gpio-buttons.service: Unit entered failed state. |
Okay after some time trying different ways following solution worked for me. Download the newest Version of Jukebox the put in the following lines from: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Audio-RotaryKnobVolume sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-rotary-encoder.service.stretch-default.sample /etc/systemd/system/phoniebox-rotary-encoder.service sudo systemctl enable phoniebox-rotary-encoder after that I still had to do explained here : #325 from gpiozero import Button def def_shutdown(): def def_volU(): def def_volD(): def def_vol0(): def def_next(): def def_prev(): def def_halt(): shut = Button(3, hold_time=2) shut.when_held = def_shutdown pause() So now they work together for me - only the mute function when pressing the rotary encoder does not work. |
So, I even got the mute function to work: you have to remove the dummy within the rotary-encoder.py - so change
and it works. Ronny |
The above script works fine but I wonder why it says 5V although the GPIO pins (on my Raspi3) are only 3.3V max? |
Good Morning all. |
Thanks for this script. It works perfectly! One minor comment/proposal. On my side I changed the down/up to have volume up when clockwise and volume down on anticlockwise. It seems more "standard" for me? I just changed in rotary-encoder.py def rotaryChangeCWVol(steps): def rotaryChangeCCWVol(steps): |
I just switched the connection to GPIO 5 / 6 for that :) |
It can maybe be changed in code (not necessarily my "dirty" change) to make a clean version and avoid mistakes? @MiczFlor |
@dvalob sure cw should be up and ccw down! If that is not the case, I would recommend to change the wiring to A and B of your encoder. Thereby you have no custom code and can take the latest code directly for production. In case that is not feasible, you can change line 62 and 63 like @Yordan1976 did. |
yes you are right. Or we can change the A/B definition in the encoder-rotary python code for the same reason (keep production code)? ?? |
Why don't you want to swap the A and B wires? |
My wiring is as follows:
So my code is coherent with th original code. With these A/B defintion the volume is inverted. It is not a problem to swap the wires, but to avoid everybody to do it we could just swap A/B definition in the rotary-encoder.py. Or indicate in wiki article hat the wires need to be exchanged if we want to have "standard" sens for volume. Just a detail I agree :) Daniel |
We shouldn't change the code in a way that would affect the already wired encoders. Editing the documentation and/or adding a setting for switching the definition would be the better way. |
I checked available hardware while the own is asleep and indeed I mixed A and B up as you suggested. I fixed (because it was already there in one place) and extended the wiki. |
may I highjack this thread? |
You can simply unplug the SW wire, isn't it?
Le 10 mars 2019 13:49, "domu83" <notifications@github.com> a écrit :
… may I highjack this thread?
I'm wondering on how I can deactivate the mute function of the switch
button. I did some testouts and found, that the kids press the button by
fault too often. I would like to comment it out until they have more
experience with the box.
I can't find the 'mute' function in the rotary-encoder.py do I miss
anything? I though I have seen it there once a time, but not sure.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#267 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AtbkCOMSePAS7G6-LKkusepyKbaANyp3ks5vVP9jgaJpZM4XsppL>
.
|
@domu83 since I refactored all the encoder code, all buttons are handled in the gpio-buttons.py |
thanks @martinclausen2 ! |
is it possible to use the Rotary incl. Mute and the OLED Display (descriped here https://github.com/splitti/oled_phoniebox)? The problem is that the Display use the I2C Bus GPIO2 and 3, the Rotary uses also the GPIO3. |
Hi, Jan 31 21:03:13 raspberrypi systemd[1]: phoniebox-rotary-encoder.service: Start request repeated too quickly. Then I tried starting: rotary-encoder.py Anybody having this problem? What could be the solution? |
could you paste the content of |
solved. I looked into rotary_encoder_base.py I didnt touch this file before, interesting... |
Mir ist bewusst, dass das für jeden, der sich einigermaßen mit Elektrotechnik auskennt eine unfassbar unbedarfte Frage sein muss, aber: wie ist der Schaltplan zu lesen? Ich nehme an, ) bedeutet, dass die vertikale Lötung die die horizontale Lötung nicht berührt? Anders gefragt, hat jemand ein Photo von dieser Schaltung? Ganz herzlichen Dank! |
Hallo SKHSKHilber |
Ganz herzlichen Dank für die Info! |
Hello, first of all my english is not the best, but I hope you get what I want/mean.
Maybe I'm overlooking things!? |
last weekend i installed the OnOff Shim for usage with a powerbank. surprisingly rotary still works without 3v3 ? (volUp / volDown inverted!) (i'm on develop branch) |
hi, |
Hi @jlarsch, @michnixweiss, Yes, you are right. The new Please see #991. If you experience problems, please open a new issue or follow #991. |
Implemented since 2.2 in GPIO control see also https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Audio-RotaryKnobVolume |
Hallo Micz,
ich würde gerne einen Drehgeber für die Lautstärke Einstellung verwenden. Das finde ich intuitiver.
Ich habe dazu Skripte geschrieben und bei mir funktioniert es soweit. Wäre schön, wenn Du das in das Projekt aufnehmen könntest, damit es bei der Installation gleich eingerichtet wird (analog wie GPIO Buttons).
Leider weiß ich nicht, wie ich das in Git hochladen kann.
Grüße,
Patman
The text was updated successfully, but these errors were encountered: