Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Junior Member
    Join Date
    Jun 2019
    Location
    Belgium
    Posts
    16

    power on/off switch

    I now have two picoreplayers running. One with the official touchscreen and a Hifiberry DAC+pro connected to my BEO Ouverture and another running headless with a Hifiberry Amp2. Both working just fine. Thank you.

    I know that in the case of Picoreplayer, you can safely remove power to shutdown the device but I like to be able to switch on/off my equipment with a switch. I'd like to do that with a momentary switch between Pins 5 and 6 and a script I found here.

    Among the Squeezelite settings, I see the fields "Power On/Off GPIO" and "Power On/Off Script" Am I right in assuming that I can accomplish what I want by a) putting a 0 in the first field and b) putting the path to the script in the second ? If so, where should I put the script?
    Last edited by Alverman; 2019-07-18 at 10:56.

  2. #2
    Senior Member
    Join Date
    May 2017
    Posts
    652
    Nice find!
    SqueezeBoxes: 1x Transporter (Living room) 1x SB2 (shed), 1x Radio (Kitchen), 1x Boom (Dining room), 1x piCorePlayer (jacuzzi), 1x piCorePlayer (Garden) 1x OSMC + Squeezelite (Movie room), 1x Touch (Study 2), few spare unit's
    Server: LMS on Pi3 7.9.1. on PcP 3.21
    Network: AVM Fritzbox, Netgear Smart Switch 24p, 3x Ubiquity

  3. #3
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    3,421
    In Raspbian I think you just add a line to /boot/config.txt


    http://www.sensorsiot.org/raspberry-pi-tricks/


    Name: gpio-shutdown
    Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin
    is configured as an input key that generates KEY_POWER events.
    This event is handled by systemd-logind by initiating a
    shutdown. Systemd versions older than 225 need an udev rule
    enable listening to the input device:

    ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
    SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
    ATTRS{keys}=="116", TAG+="power-switch"

    This overlay only handles shutdown. After shutdown, the system
    can be powered up again by driving GPIO3 low. The default
    configuration uses GPIO3 with a pullup, so if you connect a
    button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
    you get a shutdown and power-up button.
    Load: dtoverlay=gpio-shutdown,<param>=<val>
    Params: gpio_pin GPIO pin to trigger on (default 3)

    active_low When this is 1 (active low), a falling
    edge generates a key down event and a
    rising edge generates a key up event.
    When this is 0 (active high), this is
    reversed. The default is 1 (active low).

    gpio_pull Desired pull-up/down state (off, down, up)
    Default is "up".

    Note that the default pin (GPIO3) has an
    external pullup.
    Last edited by Man in a van; 2019-07-17 at 11:46.

  4. #4
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    3,173
    That will work with pCP too, those options are on the tweaks page.

    Just be careful nothing is using that GPIO.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  5. #5
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,833
    hi Alverman,

    Please note that piCorePlayer doesn't have python loaded by default. Including python would double the size of piCorePlayer.

    piCorePlayer does have microPython though, but not many microPython libraries loaded.

    regards
    Greg

  6. #6
    Junior Member
    Join Date
    Jun 2019
    Location
    Belgium
    Posts
    16
    Thanks for the tips.
    I'l try to work with the options on the tweaks page.
    BTW, pin 5 is already in use by the Hifiberry board, but it might be possible to use it also for the shutdown. I'll just have to try. After all what could possibly go wrong

  7. #7
    Senior Member
    Join Date
    Apr 2019
    Location
    Wunstorf, Germany
    Posts
    322
    Here you can find the documentation which pins are used by the different Hifiberry boards: https://www.hifiberry.com/build/docu...iberry-boards/

  8. #8
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    3,421
    Quote Originally Posted by Man in a van View Post
    In Raspbian I think you just add a line to /boot/config.txt

    Seems the rpi4b is getting a fix for this

    https://www.raspberrypi.org/forums/v...f=117&t=246027

  9. #9
    Junior Member
    Join Date
    Apr 2017
    Posts
    18
    Quote Originally Posted by Alverman View Post
    I now have two picoreplayers running. One with the official touchscreen and a Hifiberry DAC+pro connected to my BEO Ouverture and another running headless with a Hifiberry Amp2. Both working just fine. Thank you.

    I know that in the case of Picoreplayer, you can safely remove power to shutdown the device but I like to be able to switch on/off my equipment with a switch. I'd like to do that with a momentary switch between Pins 5 and 6 and a script I found here.

    Among the Squeezelite settings, I see the fields "Power On/Off GPIO" and "Power On/Off Script" Am I right in assuming that I can accomplish what I want by a) putting a 0 in the first field and b) putting the path to the script in the second ? If so, where should I put the script?

    Hello,

    I'm wondering if you got to find a way to install that software switch?
    I'm looking to implement the exact same function but can't proceed with the download and installation of the script via SSH as the are missing dependencies such as ''apt install'', ''git'' etc.

    Any help will be greatly appreciated!

  10. #10
    Member
    Join Date
    Apr 2019
    Location
    Finland
    Posts
    62
    Hello,

    Iĺm planning to build a diy musicplayer.

    Raspberry pi 3
    Official touchscreen
    Hifiberry amp2 hat
    Speakers

    I ordered a momentary switch to shutdown and turn on pi from gpio pins.

    If I use gpio pins to shutdown the pi, the amp hat still stays powered. Should I order a latching switch that would cut the power from the 18v power supply connected to the hat and forget the gpio switch?

    Is there any benefits to use the gpio switch instead of powering off the whole setup?

    I am planning to install only picoreplayer and not lms.

    Thank you!

Posting Permissions

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