Announcement

Collapse
No announcement yet.

[ANNOUNCE] SqueezeButtonPi - Tool to use buttons and rotary encoders on a RPi

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • billtsig
    replied
    Originally posted by jeroen2 View Post
    I was having a hard time getting that to work as well.. Ended up up adding the following to config.txt and that works fine..
    Code:
    dtoverlay=gpio-key,gpio=5,keycode=16 # KEY_q power
    dtoverlay=gpio-key,gpio=6,keycode=57 # KEY_SPACE play-pause
    dtoverlay=gpio-key,gpio=16,keycode=48 # KEY_b jump-forward
    hi jeroen2 this works preety well and easy without downloading anything simple and awesome!!!

    thank you verry much!!

    i also try to make it work with a rotary encoder (as gpiokey) that emulates the arrow keys of a keyboard without success (and its very logical since a rotary encoader gives pulse A and B even if you turn it clockwise or anti clockwise

    so with a reaserch i found this
    Code:
    Name:   rotary-encoder
    Info:   Overlay for GPIO connected rotary encoder.
    Load:   dtoverlay=rotary-encoder,<param>=<val>
    Params: pin_a                   GPIO connected to rotary encoder channel A
                                    (default 4).
            pin_b                   GPIO connected to rotary encoder channel B
                                    (default 17).
            relative_axis           register a relative axis rather than an
                                    absolute one. Relative axis will only
                                    generate +1/-1 events on the input device,
                                    hence no steps need to be passed.
            linux_axis              the input subsystem axis to map to this
                                    rotary encoder. Defaults to 0 (ABS_X / REL_X)
            rollover                Automatic rollover when the rotary value
                                    becomes greater than the specified steps or
                                    smaller than 0. For absolute axis only.
            steps-per-period        Number of steps (stable states) per period.
                                    The values have the following meaning:
                                    1: Full-period mode (default)
                                    2: Half-period mode
                                    4: Quarter-period mode
            steps                   Number of steps in a full turnaround of the
                                    encoder. Only relevant for absolute axis.
                                    Defaults to 24 which is a typical value for
                                    such devices.
            wakeup                  Boolean, rotary encoder can wake up the
                                    system.
            encoding                String, the method used to encode steps.
                                    Supported are "gray" (the default and more
                                    common) and "binary".
    i try this comand
    Code:
    dtoverlay=rotary-encoder,rotary0_2_a=keycode=103
    but it does not work , i would be gratefull if anyone tell me how to make the encoder emulates the up-down arrows of the keyboard

    thank you again vasilios

    Leave a comment:


  • jd68
    replied
    Originally posted by billtsig View Post
    as a newbie i read many threads for how can i do that and i try the method from post number 5 in this thread
    Just a note: there have been several improvements for SBP since post 5, e.g. it is better to use the SBP from the repository of piCorePlayer. The same is valid for examples of scripts, i.e. take the latest ones and read the the thread completely. ;-)

    Leave a comment:


  • paul-
    replied
    The version on sourceforge is quite old. The current version is on the pCP repo. And no longer uses wiringPI, it uses pigpiod. As wiringPI is depreciated.

    Leave a comment:


  • meq123
    replied
    Originally posted by billtsig View Post
    i press the enter button and yeah an error occured
    Code:
    wiringPiISR: Can't find gpio program
    wiringPiISR: unable to open /sys/class/gpio/gpio26/value: No such file or directory
    Did you load the gpio extension?

    1) On the Main Page tab, scroll down to and click "Extensions"
    2) For "Current repository", select 'piCorePlayer main repository' (if not already selected) and click 'Set'
    3) For "Available Extensions" select 'pcp-sbpd.tcz' and click 'Load' then wait for extension
    to load. Similarly select 'pigpio.tcz' and click 'Load' then wait for extension to load.
    (Latter may already be installed)

    Leave a comment:


  • jeroen2
    replied
    Originally posted by billtsig View Post
    does anyone have an idea for how can i solve this problem? , i spent manu hours in front of the screen without result
    I was having a hard time getting that to work as well.. Ended up up adding the following to config.txt and that works fine..
    Code:
    dtoverlay=gpio-key,gpio=5,keycode=16 # KEY_q power
    dtoverlay=gpio-key,gpio=6,keycode=57 # KEY_SPACE play-pause
    dtoverlay=gpio-key,gpio=16,keycode=48 # KEY_b jump-forward

    Leave a comment:


  • billtsig
    replied
    Hello everybody

    i am using rpi4 2gb ram with picore player and LMS for a system that i build now, so today i decited to try to control the player with phisical buttons

    as a newbie i read many threads for how can i do that and i try the method from post number 5 in this thread

    i connect to my rasberry pi over ssh and i run this commands

    Code:
    pcp bu  # save pcp config
    
    cd /mnt/mmcblk0p2/tce/optional
    
    wget http://downloads.sourceforge.net/project/picoreplayer/beta/sbpd.tcz.md5.txt
    
    wget http://downloads.sourceforge.net/project/picoreplayer/beta/sbpd.tcz
    
    md5sum sbpd.tcz # make sure the file downloaded correctly
    f0157164d10b86325b38fee0cb8d709e  sbpd.tcz
    
    cat sbpd.tcz.md5.txt # does it match the line above?
    f0157164d10b86325b38fee0cb8d709e  sbpd.tcz
    
    echo "sbpd.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
    
    pcp rb  # you must reboot!
    everything seems to be ok, so lets make the first button for the "play , pause" action

    i open again the ssh and i run this command
    Code:
    sbpd b,26,PLAY,1
    i press the enter button and yeah an error occured
    Code:
    wiringPiISR: Can't find gpio program
    wiringPiISR: unable to open /sys/class/gpio/gpio26/value: No such file or directory


    does anyone have an idea for how can i solve this problem? , i spent manu hours in front of the screen without result

    thank you
    Vasilios

    Leave a comment:


  • spt58
    replied
    This a great plugin thanks to all involved!

    Is there any way it could be tweaked to allow for double press / triple press on buttons in a future update perhaps? Opens up a few more options for those with a limited number buttons e.g. single press (play pause), double press (next track), triple press (prev track)

    Many thanks

    Leave a comment:


  • Aki7
    replied
    the way i got it running with PCP 6.1:

    install: pigpio.tcz
    Install: pcp_sbpd.tcz

    Tweaks-autostart with internal sound:
    Code:
    sudo pigpiod -t [B]1[/B];sleep 0.1;sbpd -d -s b,5,POWR
    Tweaks-autostart with DAC-board:
    Code:
    sudo pigpiod -t [B]0[/B];sleep 0.1;sbpd -d -s b,5,POWR
    my user command in tweaks:
    Code:
    sudo pigpiod -t 0;sleep 0.1; sbpd -d -s  e,24,23,VOLU,2 b,25,POWR,2,0,PLAY,300 b,5,NEXT,2,0 b,12,PREV,2,0
    rotary encoder is volume, short press rotary encoder is soft off/on, long press rotary encoder is play/pause
    two buttons for next and previous track

    Leave a comment:


  • klothi
    replied
    It works!

    Originally posted by Paul Webster View Post
    From the error message I guess that you need wiringpi.tcz
    I checked this and got for wiringpi.tcz the same funny thing:
    • Wiringpi.tcz was not listed in the "Installed" tab of extension section.
    • After selection of wiringpi.tcz from piCorePlayer repository in the "Available" tab and click on the "Load" button I got the message:
      wiringpi.tcz is already got alread downloaded.
    • I clicked "Load again but it's only downloaded.
    • Then I installed wiringpi-dev.tcz. This worked successfully and was not downlaoded before.
    • When I try to install wiringpi.tcz again the procedure claims that it's now installed.
    • Furthermore I can see now in the "onboot.lst" tab that wiringpi.tcz seems to be below wiringpi-dev.tcz in the hierarchy.



    I noticed the same issue already for the pigpio.tcz.
    Anyway. This was the problem! It works now! Thank you very much for your help to bring my Sunday evening to an happy ending!

    Leave a comment:


  • Paul Webster
    replied
    From the error message I guess that you need wiringpi.tcz

    Leave a comment:


  • klothi
    replied
    These were not not installed. I installed all 3 now. pigpio.tcz, pigpio-dev.tcz and pigpio-doc.tcz.
    After a reboot nothing changed.
    The error message is still the same. :-(

    Leave a comment:


  • meq123
    replied
    Do you have the gpio library loaded? (pigpio.tcz on the Extensions tab)

    Leave a comment:


  • klothi
    replied
    Need help for setup

    Hi,
    I'm using a PiCorePlayer v6.1 setup with HDMI output. LMS is running on Synology NAS in the LAN.
    I installed the sbpd as explained on the first site of this thread.
    Then I tried several hours a bunch of different User commands in the tweaks menu to get my rotary encounter running. It's a model KY-040 encounter.

    First I tried to use VOLM but read later on that it got replaced by VOLU.
    My last version I tried was:

    Code:
    /usr/local/sbin/sbpd -d -s e,23,24,VOLU,1 b,25,POWR,1
    This and all the versions before didn't work.
    Last thing i did was to connect via SSH and to exec:

    Code:
    sbpd -v e,23,24,VOLU,1
    The result was:
    1601829442.7315 6 GPIO.c,219:Initializing GPIO
    wiringPiISR: Can't find gpio program
    wiringPiISR: unable to open /sys/class/gpio/gpio23/value: No such file or directory


    I assume there is a piece of software missing to use the gpio but have no clue how to solve it.

    Got anybody the KY-040 running and can help me?

    Leave a comment:


  • sakos
    replied
    Originally posted by sakos View Post
    Yes, I understand that this is only a "soft" power off. And this is exactly what I need. But it has an issue.
    The above issue is solved by LMS update to latest. Now I have a working solution to control GPIO when the player is in "power off" status.

    Leave a comment:


  • blackbird
    replied
    Originally posted by paul- View Post
    Check the optional mode setting for encoders.

    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.
    It works after changing dent mode setting from 2 to 4.
    Thank you.

    Leave a comment:

Working...
X