• Recent
  • Tags
  • recalbox.com
  • Gitlab repository
  • Documentation
  • Discord
  • Register
  • Login

Recalbox Forum

  • Register
  • Login
  • Search
  • Recent
  • Tags
  • recalbox.com
  • Gitlab repository
  • Documentation
  • Discord

Pimoroni OnOff Shim working on Recalbox

Your discoveries
pimoroni onoff shim recalbox
3
5
2.2k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mi7chy
    mi7chy last edited by mi7chy 24 Jun 2018, 18:24 24 Jun 2018, 18:21

    Little contribution to get Pimoroni OnOff Shim working with Recalbox (tested with version 18.04.20 on RPi 3B).

    OnOff Shim is an affordable $7, compact, well-designed SHIM for adding momentary on/off button with safe shutdown and cutting off power that's essential for running off of battery.

    https://shop.pimoroni.com/products/onoff-shim

    SSH into Recalbox and remount read/writable:

    mount -o remount, rw /boot
    mount -o remount, rw /

    Backup then add the following line to /boot/config.txt:

    dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1
    

    Backup then uncomment the following line in /recalbox/share/system/recalbox.conf by removing the semicolon at the beginning of the line:

    system.power.switch=PIN56PUSH            https://github.com/recalbox/recalbox-os/wiki/Add-a-start-stop-button-to-your-recalbox-(EN)
    

    Backup then replace /recalbox/scripts/rpi-pin56-power.py with this modified version:

    import RPi.GPIO as GPIO
    import os
    import argpa**e
    pa**er = argpa**e.ArgumentPa**er(description='power manager')
    pa**er.add_argument("-m", help="mode onoff or push", type=str, required=True)
    args = pa**er.pa**e_args()
    mode = args.m
    GPIO.setmode(GPIO.BCM)
    # GPIO on pin 11 is the GPIO 17 in BCM mode
    GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    def shutdown():
    os.system("shutdown -h now")
    try:
    if mode == "push" :
    GPIO.wait_for_edge(17, GPIO.FALLING)
    shutdown()
    else:
    print("Unrecognized mode")
    except KeyboardInterrupt:
    print ""
    finally:
    print "cleaning up gpio"
    GPIO.cleanup()

    Finally, reboot with command 'shutdown -h -r now' to take effect and test OnOff Shim functionality.

    Optionally, if you prefer the longer way to add a new entry instead of reusing an existing entry then refer this post:
    https://forums.pimoroni.com/t/using-onoff-shim-with-recalbox/7981/3

    Substring 1 Reply Last reply 25 Jun 2018, 06:37 Reply Quote 0
    • Substring
      Substring @mi7chy last edited by 25 Jun 2018, 06:37

      @mi7chy hey nice !

      was it just a GPIO number problem ?

      Former dev - Please reply with @substring so that i am notified when you answer me
      Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

      mi7chy 1 Reply Last reply 26 Jun 2018, 18:12 Reply Quote 0
      • Dragu
        Dragu Banned last edited by 25 Jun 2018, 13:07

        @mi7chy
        Very nice, but I see one problem concerning additional hardware or just simply a fan. As it occupy all 5V an 3,3V pins. There should be some breaking out pins for this. Or is there another solution ?

        1 Reply Last reply Reply Quote 0
        • mi7chy
          mi7chy @Substring last edited by mi7chy 26 Jun 2018, 18:14 26 Jun 2018, 18:12

          @substring

          was it just a GPIO number problem ?

          Issue #1 Their one-line installer script only runs on Raspbian and not Recalbox and attempting to do so will generate missing command and syntax errors.

          curl https://get.pimoroni.com/onoffshim | bash
          

          Issue #2 Per Pimoroni recent versions of Raspbian support shutdown and cutting off power with the following two dt-overlay commands in /boot/config.txt but Recalbox is missing file /boot/overlays/gpio-shutdown.dtbo. Adding the file manually still doesn't work as there appears to be dependencies or hooks. Going forward this seems like the preferred and cleaner way than running background scripts that Recalbox may want to look at.

          dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1
          dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1

          @Dragu
          It's a SHIM (shove hat in the middle) so designed to work with HATs and pHATs. You can either solder the OnOff Shim directly onto the GPIO header then place HAT/pHAT on top. Or, solder OnOff Shim to header and stack headers on top of each other for a non-permanent solution.

          Btw, anyone in the US and internationally outside of Europe can get it through major distributor Digikey.
          https://www.digikey.com/product-detail/en/pimoroni-ltd/PIM269/1778-1117-ND/7386673

          Substring 1 Reply Last reply 27 Jun 2018, 07:34 Reply Quote 0
          • Substring
            Substring @mi7chy last edited by 27 Jun 2018, 07:34

            @mi7chy hey !

            I didn't know about these overlays ! But as it's related to kernel, and we're 2 years late on that point, i'm not surprised they don't work.

            BUT : this should be solved in the next 2-3 months

            Former dev - Please reply with @substring so that i am notified when you answer me
            Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

            1 Reply Last reply Reply Quote 0
            3 out of 5
            • First post
              3/5
              Last post

            Want to support us ?

            63
            Online

            98.8k
            Users

            28.1k
            Topics

            187.1k
            Posts

            Copyright © 2021 recalbox.com