Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • blackbird
    replied
    Originally posted by paul-
    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:


  • paul-
    replied
    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.

    Leave a comment:


  • blackbird
    replied
    Rotary encoder is working but very sensitive

    My configuration:

    RPi 2B
    PCP 6.1.0
    pcp-sbpd
    jivelite (Waveshare 3.5")

    /home/tc/sbpd-script.sh
    ================================================== ===========================
    #!/bin/sh

    # start pigpiod daemon
    pigpiod

    # 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
    sbpd e,6,12,KEY:KEY_UP-KEY_DOWN,2 b,5,KEY:KEY_RIGHT,2,0,KEY:KEY_LEFT,500
    ================================================== ============================

    Click image for larger version

Name:	rotary.jpg
Views:	1
Size:	126.8 KB
ID:	1569675

    Rotary encoder working...key up and down, and button also working.
    BUT. when key up, down..jump 2 step down or up.
    I have to rotate very slowly to move 1 step.

    Does any options are available to fix this problem ?

    Leave a comment:


  • sakos
    replied
    Originally posted by paul-
    Power on/off in the spbd/lms context is just turning off the "Player Power" Just like hitting the power button on the LMS interface. Most would use it to control a relay that powers an amplifier on/off.

    To shutdown the complete pi, you could script it here with spbd, but other ways are easier.
    Yes, I understand that this is only a "soft" power off. And this is exactly what I need. But it has an issue.

    Leave a comment:


  • paul-
    replied
    Power on/off in the spbd/lms context is just turning off the "Player Power" Just like hitting the power button on the LMS interface. Most would use it to control a relay that powers an amplifier on/off.

    To shutdown the complete pi, you could script it here with spbd, but other ways are easier.

    Leave a comment:


  • sakos
    replied
    Power On/Off GPIO

    Originally posted by sakos
    Hi,

    I have a similar radio in kitchen with an 5'' display but the physical control is important due to the same reasons. Following the instructions found here I managed to configure two rotary encoders and buttons. The only missing thing is the LCD backlight control. I would like to drive the LCD backlight control GPIO port to switch off the backlight when the player is stopped.

    With sbpd b,13,POWR command the top row of jivelite shows "Off" when the button is pressed. I expected it would control the Poweroff GPIO configured in Poweroff/Shutdown Overlays section of piCorePlayer configuration page, however it does not fly, the configured GPIO pin does nothing.

    Could you please recommend a solution to configure a simulated power on/off behavior with stopping/starting player and LCD backlight control?
    Meanwhile I realized that there is a similar configuration option in "Squeezelite settings" page. It is called "Power On/Off GPIO".
    Squeezelite will toggle this GPIO when the Power On/Off button is pressed.

    This is exactly what I was looking for. After configuring, it started to work. But it works only until I start playing a webradio. After that, it applies only a momentary impulse on the GPIO pin. What a pity...
    I am convinced it is a SW bug. Going to open a ticket.

    Leave a comment:


  • sakos
    replied
    Availability of source code

    Is the latest version of source code public? The version running on my device is 3.0.1, however the github version is 2.1 only.

    Leave a comment:


  • paul-
    replied
    I would run sbpd in debug mode and make sure commands are being sent as planned. If the commands are getting executed, then we can figure out if the commands are right.

    Leave a comment:


  • sakos
    replied
    LCD power control

    Originally posted by Jursi
    Thank you very much, everything is working now.

    Finally I have a player in my bathroom/sauna with physical control. Physical controls are important because it is hard to use touch screen with wet hands when I am in sauna/shower or in a hot tube. And the cheap touch screen is almost unusable anyways.

    Here is a picture of my "prototype" player. It is not the prettiest but it sure gets the job done! https://imgur.com/a/bG1HApc
    Sad that there is no 3.5 inch display with bezel/frame like there is in the official 7inch display. It hard to cut a proper hole with a dremel
    Hi,

    I have a similar radio in kitchen with an 5'' display but the physical control is important due to the same reasons. Following the instructions found here I managed to configure two rotary encoders and buttons. The only missing thing is the LCD backlight control. I would like to drive the LCD backlight control GPIO port to switch off the backlight when the player is stopped.

    With sbpd b,13,POWR command the top row of jivelite shows "Off" when the button is pressed. I expected it would control the Poweroff GPIO configured in Poweroff/Shutdown Overlays section of piCorePlayer configuration page, however it does not fly, the configured GPIO pin does nothing.

    Could you please recommend a solution to configure a simulated power on/off behavior with stopping/starting player and LCD backlight control?

    Leave a comment:


  • Jursi
    replied
    Hello,

    Can a volume button be setup in a way that it increases volume as long as I press it or is it just +1 volume per button press?

    Thanks!

    Leave a comment:


  • paul-
    replied
    Once your done debugging, then yes, add -d.

    Leave a comment:


  • meq123
    replied
    OK, I've answered one of my own questions... while I was browsing the forum threads, I came across this link to the various Key 'code's: https://github.com/ralph-irving/tcz-...r/jivekeys.csv

    AHA! I see a "KEY_LEFTBRACE" there that corresponds to NowPlaying. Sure enough, I configure it to a button and it works like a champ!

    But I still would like to know if -d should be added to the sbpd line?

    Leave a comment:


  • meq123
    replied
    So I've just had an adventuresome weekend. Last year I built a custom-cased music player/streamer based around a Pi 3B and a Hifiberry DAC+ running pcp 4.x. With the new Topping E30 coming out, and the non-USB-limited Pi 4, I decided to update the internals to a Pi4, no hat, just USB out. I saw that, in the interim, we were now up to pcp 6.1, so of course went for that and followed my earlier notes to reinstall. All went fine (few changes, but easily navigated) until it came to sbpd. My buttons no longer worked

    Obviously I searched the 'net and found out here about this new sbpd upgrade and install mechanism, and after a few false starts, everything is working again! Yay! Thanks to all who contributed!

    So now, just a couple of questions...

    1) The script that @Chill has shown, does not run sbpd with the "-d" (deamonize) parameter. Should it? Or is this no longer required?

    2) With the new flexibility, I want to reassign my buttons. Does anyone know how to make a button show the "Now Playing" screen - i.e. do the same thing as the 'music note' icon in the top right of the touch display?

    Thanks again!

    Leave a comment:


  • jemhayward
    replied
    I decided to simplify things completely - it would appear that the script is not starting pigpiod.

    Manually starting pigpiod only, from the shell as root results in the music slowing down, so it's done something to the clock - I recall reading about this somewhere. I think I need to fix this problem before I do anything else.

    Later: - sudo su
    pigs t shows that pigpiod is not being started by my script.
    Manually starting pigpiod -t 0 gets me music at the right speed - progress
    manually starting sbpd e,23,24,VOLU gets me volume control.

    What's not working is doing this automatically at boot, but at least I know it's working.

    Later:
    A few more re-boots and I then gave up on scripting. I have three startup options so the first one is:
    sudo pigpiod -t 0
    The second one is:
    sleep 10
    I'm in no rush, so giving pigpiod time to get going is fine...
    The third one is:
    sbpd e,23,24,VOLU

    It now works.

    Many, many thanks to all the experts helping a noob get there - slowly. I now really love PiCorePlayer and I think I may build another one for my main system, as I'm currently using Volumio with Squeezelite - but I like the fact I can really get inside PiCorePlayer (and so break it completely!) - keep up the good work!
    Last edited by jemhayward; 2020-04-13, 17:43.

    Leave a comment:


  • jemhayward
    replied
    Only one LMS - it finds that OK, but I do have another squeezelite on the network (which is set to 100% volume fixed) - I'll try the mac address in my script.

    That doesn't work... BUT if I SSH in, do a sudo su and pigs t - it shows that pigpiod is running
    If I then do
    sbpd -M 'my mac address' e,23,24,VOLU
    It WORKS!
    and so does
    sbpd e,23,24,VOLU

    so mac address is a red herring - it just doesn't work from the script

    I think I may simplify my script to emulate exactly what I'm doing at the command line and see if that does it. I'm nearly there!

    Leave a comment:

Working...
X
😀
🥰
🤢
😎
😡
👍
👎