Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 6 123 ... LastLast
Results 1 to 10 of 56
  1. #1
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,188

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

    SqueezeButtonPi is a tool some of you might find useful if you are trying to build a Raspberry Pi based Squeezebox player and you want to use various buttons or rotary encoders.

    It's currently a bit limited - only supports playback control commands without feedback (play, pause, power, skip, volume) but it could easily be extended to take server feedback and support things like "favorites" although for the latter someone should take the time to create a "hold" gesture detection for a button, something I didn't have the time for so far.

    One nice feature is that it's able to autodetect a common Squeezebox setup so you often don't need to manually configure the MAC, the server etc. and it can do automatic server switching.

    Main features:
    • Supports buttons and rotary encoders
    • Can be run as a daemon at startup and is fully command-line configurable
    • Automatically detects the MAC address of your RPi (or you can configure it manually)
    • Automatically detects what server your player is connected to and switches the server if your player does so it can be used in multi-server setups without a configuration change
    • can use authenticating servers, although only with manual username/password configuration


    Here's the source code and more documentation:

    https://github.com/coolio107/SqueezeButtonPi-Daemon

    Usage:

    Code:
    sbpd [OPTION...] [e,pin1,pin2,CMD,edge] [b,pin,CMD,edge...]
    Options arguments:
    Code:
      
        -A, --address=Server-Address   Set server address. Default: autodetect
        -M, --mac=MAC-Address      Set MAC address of player. Deafult: autodetect
        -p, --password=password    Set password for server. Default: none
        -P, --port=xxxx            Set server control port. Default: autodetect
        -u, --username=user name   Set user name for server. Default: none
        -d, --daemonize            Daemonize
        -k, --kill                 Kill daemon
        -s, --silent               Don't produce output
        -v, --verbose              Produce verbose output
        -?, --help                 Give this help list
            --usage                Give a short usage message
        -V, --version              Print program version
    Non-Option arguments.

    At least one needs to be specified for the daemon to do anything useful
    Arguments are a comma-separated list of configuration parameters:
    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. Unused for encoders, always VOLM for Volume
                edge: Optional. one of
                      1 - falling edge
                      2 - rising edge
                      0, 3 - both
    
        For buttons: 
            b,pin,CMD[,edge]
                "b" for "Button"
                pin: GPIO PIN numbers in BCM-notation
                CMD: Command. One of:
                    PLAY:   Play/pause
                    PREV:   Jump to previous track
                    NEXT:   Jump to next track
                    VOL+:   Increase volume
                    VOL-:   Decrease volume
                    POWR:   Toggle power state
                edge: Optional. one of
                      1 - falling edge
                      2 - rising edge
                      0, 3 - both
    Last edited by pippin; 2017-02-19 at 17:15.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  2. #2

    with PiCorePlayer?

    Quote Originally Posted by pippin View Post
    SqueezeButtonPi is a tool some of you might find useful if you are trying to build a Raspberry Pi based Squeezebox player and you want to use various buttons or rotary encoders.

    It's currently a bit limited - only supports playback control commands without feedback (play, pause, power, skip, volume) but it could easily be extended to take server feedback and support things like "favorites" although for the latter someone should take the time to create a "hold" gesture detection for a button, something I didn't have the time for so far.

    One nice feature is that it's able to autodetect a common Squeezebox setup so you often don't need to manually configure the MAC, the server etc. and it can do automatic server switching.

    Main features:
    • Supports buttons and rotary encoders
    • Can be run as a daemon at startup and is fully command-line configurable
    • Automatically detects the MAC address of your RPi (or you can configure it manually)
    • Automatically detects what server your player is connected to and switches the server if your player does so it can be used in multi-server setups without a configuration change
    • can use authenticating servers, although only with manual username/password configuration


    Here's the source code and more documentation:

    https://github.com/coolio107/SqueezeButtonPi-Daemon

    Usage:

    Code:
    sbpd [OPTION...] [e,pin1,pin2,CMD,edge] [b,pin,CMD,edge...]
    Options arguments:
    Code:
      
        -A, --address=Server-Address   Set server address. Default: autodetect
        -M, --mac=MAC-Address      Set MAC address of player. Deafult: autodetect
        -p, --password=password    Set password for server. Default: none
        -P, --port=xxxx            Set server control port. Default: autodetect
        -u, --username=user name   Set user name for server. Default: none
        -d, --daemonize            Daemonize
        -k, --kill                 Kill daemon
        -s, --silent               Don't produce output
        -v, --verbose              Produce verbose output
        -?, --help                 Give this help list
            --usage                Give a short usage message
        -V, --version              Print program version
    Non-Option arguments.

    At least one needs to be specified for the daemon to do anything useful
    Arguments are a comma-separated list of configuration parameters:
    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. Unused for encoders, always VOLM for Volume
                edge: Optional. one of
                      1 - falling edge
                      2 - rising edge
                      0, 3 - both
    
        For buttons: 
            b,pin,CMD[,edge]
                "b" for "Button"
                pin: GPIO PIN numbers in BCM-notation
                CMD: Command. One of:
                    PLAY:   Play/pause
                    PREV:   Jump to previous track
                    NEXT:   Jump to next track
                    VOL+:   Increase volume
                    VOL-:   Decrease volume
                    POWR:   Toggle power state
                edge: Optional. one of
                      1 - falling edge
                      2 - rising edge
                      0, 3 - both
    Pippin

    Many thanks for posting all this detailed information on the Tivoli radio and software - it's very helpful but I'm stuck on one point. I think you were using PcP in the radio (?) but to install the software needs git and Wiring Pi, I believe.

    I could do it on Raspbian and there are plenty of guides around but as PcP is based on TinyCore, I'm not sure how to install git or the Wiring Pi library, or where to save the SqueezeButtonPi code to. Would you be able to help?
    many thanks

  3. #3
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,188
    Quote Originally Posted by kingswindsor View Post
    I could do it on Raspbian and there are plenty of guides around but as PcP is based on TinyCore, I'm not sure how to install git or the Wiring Pi library, or where to save the SqueezeButtonPi code to. Would you be able to help?
    many thanks
    Yes, I should probably also have posted the extensions I used in pCP.
    You can install them as additional modules through the web interface.

    I think what you need is:

    • the compiler and development libraries. That's the module "compiletc.tcz"
    • wiringPi
    • probably libCurl (not 100% sure whether that's included in "compile.tcz"
    • git (if that's not included in "compile.tcz")


    The you can download the whole project via "git clone https://github.com/coolio107/SqueezeButtonPi-Daemon.git" to some folder you create.
    Then go to the main folder (typically "SqueezeButtonPi-Daemon") and just do a "make".

    Important: this needs to be in one of the folders being backed up, e.g. you user folder or you also need to change the list of folders being backed up by pCP. The pCP documentation has details.
    You need to do a backup (again: through the web interface) after you have downloaded and compiled sbpd otherwise it gets deleted on the next powerdown.

    This gives you a file called "sbpd" which you can add to the startup commands in pCP, they also guarantee it's being run as "root" which wiringPi requires, at least in pCP 3.0 (newer versions might have that requirement dropped).
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  4. #4
    Quote Originally Posted by pippin View Post

    I think what you need is:

    • the compiler and development libraries. That's the module "compiletc.tcz"
    • wiringPi
    • probably libCurl (not 100% sure whether that's included in "compile.tcz"
    • git (if that's not included in "compile.tcz")

    Thanks! I'll have a go and report back but it may not be tonight.

    UPDATE:
    I'm using PcP 3.10 Audio
    - compiletc.tcz installed fine
    - wiringPi installed fine
    - libCurl not listed but curl.tcz is but failed on install
    - git available but failed on install

    Would I have a better chance not using the Audio version and is there any logging I should turn on and view?
    Last edited by kingswindsor; 2017-02-27 at 14:58.

  5. #5
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    1,796
    Quote Originally Posted by kingswindsor View Post
    Thanks! I'll have a go and report back but it may not be tonight.

    UPDATE:
    I'm using PcP 3.10 Audio
    - compiletc.tcz installed fine
    - wiringPi installed fine
    - libCurl not listed but curl.tcz is but failed on install
    - git available but failed on install

    Would I have a better chance not using the Audio version and is there any logging I should turn on and view?
    I've added a test sbpd.tcz package to the beta files area for pcp 3.1x.

    ssh to picoreplayer as tc user and run these 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!
    You can start /usr/local/sbin/sbpd at boot from the user commands in the the web gui. Adding command line options as needed.
    Last edited by ralphy; 2017-03-02 at 06:11. Reason: Updated libwiringpi v2.42 for pi0W support.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

  6. #6
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,188
    Quote Originally Posted by ralphy View Post
    I've added a test sbpd.tcz package to the beta files area for pcp 3.1x.

    ssh to picoreplayer as tc user and run these 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
    909de67c040e8c41c10ced1949154f7a  sbpd.tcz
    
    cat sbpd.tcz.md5.txt # does it match the line above?
    909de67c040e8c41c10ced1949154f7a  sbpd.tcz
    
    echo "sbpd.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
    
    pcp rb  # you must reboot!
    You can start /usr/local/sbin/sbpd at boot from the user commands in the the web gui. Adding command line options as needed.
    coolio! Thanks for that!
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  7. #7
    Quote Originally Posted by ralphy View Post
    I've added a test sbpd.tcz package to the beta files area for pcp 3.1x.

    ssh to picoreplayer as tc user and run these 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
    909de67c040e8c41c10ced1949154f7a  sbpd.tcz
    
    cat sbpd.tcz.md5.txt # does it match the line above?
    909de67c040e8c41c10ced1949154f7a  sbpd.tcz
    
    echo "sbpd.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
    
    pcp rb  # you must reboot!
    You can start /usr/local/sbin/sbpd at boot from the user commands in the the web gui. Adding command line options as needed.
    Ralpy

    Thanks for that. I have followed these steps and rebooted but what do I do next?

  8. #8
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,188
    You need to configure sbpd (with the path above) as a startup command in the pCP web interface.
    The parameters you need to set are described above or in the reader file on github
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  9. #9
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,188

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

    Something like
    Code:
     /usr/local/sbin/sbpd -d -s e,23,24,VOLM,0 b,25,PLAY,1
    This example assumes you are using a rotary encoder connected to the BCM 23 and 24 pins for volume and a button connected to pin BCM 25 for play/pause
    I believe you don't need -s and -d but they are the safe choice.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  10. #10
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    1,796
    I've respun the sbpd.tcz in post #5 to support the pi0W which was added to libwiringpi v2.42 released on March 1st.

    It's untested at this point. Don't have a pi0W yet.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •