BTW for volume use VOLU not VOL
See: read me on https://github.com/paul-1/SqueezeButtonPi-Daemon
Announcement
Collapse
No announcement yet.
[ANNOUNCE] SqueezeButtonPi - Tool to use buttons and rotary encoders on a RPi
Collapse
X
-
What encoder do you use?
Assuming you have not mixed up GPIO numbering and pin numbering on the header.
Pin 5 would be GPIO 3 and pin 6 would be ground. Which could explain only working in one direction.
GPIO 5 & 6 are pin 29 & 31
Other possibility is a defective encoder or defect GPIO, have you tried with other gpio’s?
The PLAY button works because is connected to pin 26 that is GPIO7; the encoder is connected to pin 29 / GPIO5 and pin 31 / GPIO6.
With this configuration the encoder work perfectly in a Volumio environment.Leave a comment:
-
What encoder do you use?
Assuming you have not mixed up GPIO numbering and pin numbering on the header.
Pin 5 would be GPIO 3 and pin 6 would be ground. Which could explain only working in one direction.
GPIO 5 & 6 are pin 29 & 31
Other possibility is a defective encoder or defect GPIO, have you tried with other gpio’s?Leave a comment:
-
Can anyone help me?
The rotary encoder appears to only work in one direction: forward. I have tried all the expected ways (1..9) using this command:Code:sbpd -v -z e,6,5,TRAC,1 b,7,PLAY
The commandCode:sbpd -v -z e,6,5,VOL,1 b,7,PLAY
Leave a comment:
-
Hi paul, I want to control the current playlist, not the volume. I tried also this:
Code:sbpd -v -z e,6,5,KEY:KEY_Z-KEY_B b,7,PLAY
Leave a comment:
-
Well then tell it to use VOLU instead of TRAC
Code:For rotary encoders (one, volume only): e,pin1,pin2,CMD[,edge] "e" for "Encoder" p1, p2: GPIO PIN numbers in BCM-notation CMD: Command. one of. \n\ VOLU for Volume\n\ TRAC for Prev/Next track\n\ KEY:<Positive key_name>-<Negative key_name> mode: Optional. one of\n\ 1 - Step mode (default)\n\ 2-9 - Detent mode - Assumes 1 dial click is x steps.
Leave a comment:
-
TRAC command works only forward
Hi all,
I have successfully installed this great plugin in my piCoreplayer and the encoder works. However works only "next track".
I use this command:
Code:sbpd e,6,5,TRAC,1 b,7,PLAY
Raspberry Pi 4B
Encoder module KY-040: CLK GPIO5 - DT GPIO6 - SW GPIO7
piCorePlayer version: 8.1.0
piCore version: 13.1
Squeezelite v1.9.9-1391-pCP
Jivelite
Thank you for your helpLeave a comment:
-
Hi all,
so I tried to do this wonderful thing to add a rotary encoder connected to the gpio to control the volume. And... all my attempts failed. I read the thread like millions times.
First of all mega noobs about command lines etc... but i did my best.
The material;
Raspberry pi A+
PiFi DAC+ v2.0 (set as Hifiberry DAC+ and works like a charm) > gpio 18 to 21 are used by the DAC.
A micro embedded electronic HAT which allowed to use 3 sets of all the GPIO pins.
Everything is working and I have sound and all.
Rotary encoder KY040 : gnd to gnd , + to 3.3V, sw to 26, dt to 23 and clk to 24
I created a script.sh in home/tc
Code:#!/bin/sh # start pigpiod daemon pigpiod -t 0 -f -l -s 10 # give the daemon a moment to start up before issuing the sbpd command sleep 1 # load uinput module, then set the permission to group writable, so you don't need to run sbpd with root permissions sudo modprobe uinput sudo chmod g+w /dev/uinput # issue the sbpd command # This command for volume and play pause sbpd e,23,24,VOLU,2 b,26,PAUS,2,0,STOP,500
Code:chmod 755 script.sh
So I rebbot and digged a little bit. When I started pigpiod > no sound any more.
and I can't figure why
I started sbpd just to check and I have that
Any help will be appreciated.
Thank you for your time and making/maintaining picoreplayer
Edit: removed the DAC hat, removed the gpio multiplier, removed the script and use the CLI instead. Works fine now.
Code:pigpiod -t 1 -f -l -s 10;sleep 1;modprobe uinput;chmod g+w /dev/uinput;sbpd e,24,25,VOLU,2 b,22,PLAY
Last edited by Themightybob; 2021-12-16, 20:45.Leave a comment:
-
The other pins are for the push button on the stem of the encoder. You can connect that to GPIO and do something else.Leave a comment:
-
Hello,
i have this rotary encoder KY040 or KY-040:
there are 5 connectors: CLK, DT, SW, + and GND
GND to GND
SW (Switch) like an button to a GPIO, so i can use the rotary encoder as button, when pressed in the middle.
now i have 3 left: CLK, DT and +
can someone give me a hint how to connect this one to the raspberry to use with sbpd?
[edit]
ok i tried and it works:
+ is 3V3
CLK is PIN1
DT is PIN2
so my command is now:
sbpd b,22,PLAY e,24,25,VOLULast edited by Besth; 2021-11-22, 15:03.Leave a comment:
-
Depends on how you have the software configured. But those button output voltage when pressed.Leave a comment:
-
Capacitive touch
I now have a https://www.adafruit.com/product/1374 capacitive touch connected to pin 20 and have set both resist and pressed to 1 as the output goes high when activated. Is this correct?Leave a comment:
-
For this project, I really want to preserve the outside and interface of the old radio. While this means in principle keeping the non-momentary original switches (buttons), you make we wonder if there is an indirect way to have the non-momentary switches activate a second set of momentary switches on their way to the GPIO pins, maybe through a time delay circuit or relay? I’ll have to do some reading.
On the software side, I wonder if I could modify the code that monitors the pins to register a button push if a connection is made via my non-momentary button. It could fire after a fixed time delay if the signal is maintained on specified pin. After a longer delay, if there was no further activity, the pin could be reset so it’s not left floating. Any thoughts on which portion of the source code I would need to look at?
Alternatively, maybe I could take the idea of a delay / second button and execute it in software. Maybe a script that reacts to a change on pin 1, triggered by my mechanical non-momentary switch, and then momentarily flips a second pin on and off on the Pi, which sbpd could interpret as a button push?
I’ll try and work through a few possibilities and share any results.
Hello Turner1200,
i faced the same problem when i wanted to rebuild an old cassette recorder with pcp.
Last but not least, I used gpiozero and LMSTools to control toggle style switches and rotary encoders.
This combination works very well with pcp and is relatively easy to implement.
If you need some advice i can help.
GreetingsLeave a comment:
-
All kinds of things you can do with software. This tool was just not written that way.Leave a comment:
Leave a comment: