Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Feb 2020
    Posts
    4

    PiCore On- and Off Button

    Hi folks, just a simple question. I already looked through a lot of threads but can’t find an answer.

    I want to add a simple push-button with the following function.

    1. No power, piCore down —> connect power —> piCore boots
    2. power connected, piCore up —> press push button once —> piCore shutdown
    3. power connected, piCore down —> press push button again —> piCore boots up

    So if I press the button the piCore should shutdown and if I press it again it will boot.

    How can I solve this with piCorePlayer 6.0? Didn’t find an answer until now

    Best

  2. #2
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    3,173
    Your best bet here is to use a power control board. The Raspberry pi has very little provisions to turn back on once you power it down. It also does not disconnect the mains from the board.

    If you are only using the raspberry pi internal audio, usb audio or not using a dac hat that uses i2c for control. Then you can do that with gpio-3 and the gpio-shutdown overlay.

    See the readme for the overlay.

    https://github.com/raspberrypi/linux...ys/README#L842

    But again, if you do it this way, you will need to leave power on the RPI board all the time.


    Examples: Pimoroni on/off shim. https://shop.pimoroni.com/products/onoff-shim
    Audiophonics power control board: https://www.audiophonics.fr/en/raspb...fast_search=fs

    There are others.
    Last edited by paul-; 2020-06-03 at 12:53.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  3. #3
    Senior Member
    Join Date
    Sep 2009
    Location
    Norway
    Posts
    252
    Another option is to buy a USB cable with a switch. This is not fancy stuff ... but I thought I'd mention this option here. There are severel in the market with USB-micro (for Pi 3, etc) and recently this one was announced for the Pi 4: https://thepihut.com/products/usb-c-cable-with-switch

    /Claus

  4. #4
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    3,173
    If your system is only a player, then the on/off switch is a cheap/easy option. No need to shutdown the system

    If your system is also enabling LMS in piCorePlayer, then you need to do a controlled shutdown before killing the power.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  5. #5
    Junior Member
    Join Date
    Apr 2017
    Posts
    12
    How about if all I want to do is use a push-button switch to shut the pi down gracefully (I am running piCore player with LMS & Squeezelite)? I already have a push-button switch connected to GPIO pin 17, normally Hi, so a push temporarily sets the voltage Lo.

    I was using this successfully on the same device previously running LMS on Debian, where it was monitored by a python program which then triggered a "sudo shutdown" in response to detecting pin 17 going to "lo" state.

    I have tried to replicate the similar behaviour (without the python script, just using the option under the "Tweaks" section) but I cannot get it to work. Any guidence appreciated.

  6. #6
    Junior Member
    Join Date
    Apr 2017
    Posts
    12
    Actually now I have it working, but the "tweaks" settings were not as I expected. The working settings are:

    Name:  Picture1.png
Views: 133
Size:  88.5 KB

    I probably misinterpreted the "pull Up/pull down" - had initially set it to "up". Its not entirely obvious to me that pull up & pull down are orthogonal commands to active high & active low, but I'm probably missing something. Just wondering if there is a simple description anywhere.

  7. #7
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    3,173
    if you wiring to a rpi, you should probably understand all that terminology, or you risk frying some circuits.

    It all depends on how you wire it and what type of switch or circuit is connected to the GPIO, there are cases for all of the potential settings.
    Last edited by paul-; 2020-06-17 at 09:37.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  8. #8
    Junior Member
    Join Date
    Apr 2017
    Posts
    12
    Quote Originally Posted by paul- View Post
    if you wiring to a rpi, you should probably understand all that terminology, or you risk frying some circuits.

    It all depends on how you wire it and what type of switch or circuit is connected to the GPIO, there are cases for all of the potential settings.
    I don't think I will fry the circuit because I have a fairly large (47k) resistor protecting the GPIO pin. But would be good to find a concise description to help me understand better. Any pointers?

  9. #9
    Senior Member
    Join Date
    Jan 2010
    Location
    Hertfordshire
    Posts
    4,346
    Quote Originally Posted by gustavm View Post
    I don't think I will fry the circuit because I have a fairly large (47k) resistor protecting the GPIO pin. But would be good to find a concise description to help me understand better. Any pointers?
    If something is active low then it needs a pull up resistor to pull it high when the active element is off. Conversely active high needs a pull down resistor to pull it low.

    Sent from my Pixel 3a using Tapatalk

  10. #10
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,833
    Quote Originally Posted by gustavm View Post
    Actually now I have it working, but the "tweaks" settings were not as I expected. The working settings are:

    I probably misinterpreted the "pull Up/pull down" - had initially set it to "up". Its not entirely obvious to me that pull up & pull down are orthogonal commands to active high & active low, but I'm probably missing something. Just wondering if there is a simple description anywhere.
    https://www.raspberrypi.org/documentation/usage/gpio/
    https://pinout.xyz/pinout/pin3_gpio2#
    Last edited by Greg Erskine; 2020-06-17 at 14:39.

Posting Permissions

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