• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

Retroflag NESPi Case - Soft Power & Reset Hack

Scheduled Pinned Locked Moved Projects and Themes
nespiretroflagsoft shutdowntutorial
151 Posts 38 Posters 91.1k Views
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.
  • D
    DaminouTav @cyperghost
    last edited by DaminouTav 9 Jun 2017, 07:10 6 Sept 2017, 06:08

    @cyperghost ooh okay I understand :D thanks for explanations ! (And shame on me, I use Retropie competitor aha I tried it 2 years ago but I didn't like, have to test it again)

    1 Reply Last reply Reply Quote 0
    • B
      bjose2345 @cyperghost
      last edited by bjose2345 9 Jun 2017, 19:59 6 Sept 2017, 18:57

      @cyperghost I have a doubt hope you maybe can help me there, im looking to use the reset button and programmed to trigger like if was a keyboard presses, somehitng like this

      http://www.rcjoycon.com/cpjexr/

      but for a GPIO solution, i saw it in this video

      Any help any guide any suggest woul help me a lot, many thanks

      C 1 Reply Last reply 6 Sept 2017, 19:44 Reply Quote 0
      • C
        cyperghost @bjose2345
        last edited by cyperghost 9 Jun 2017, 20:59 6 Sept 2017, 19:44

        @bjose2345 Sorry I've no clue what is done here....
        There is a binary from adafruit that simulates keypresses via GPIO - I think that will work. Google is your friend...

        Got it: https://learn.adafruit.com/retro-gaming-with-raspberry-pi/configuring-retrogame

        B 1 Reply Last reply 7 Sept 2017, 16:45 Reply Quote 0
        • B
          bjose2345 @cyperghost
          last edited by 7 Sept 2017, 16:45

          @cyperghost Many thanks, i will look at this.

          1 Reply Last reply Reply Quote 0
          • Y
            Yahmez @cyperghost
            last edited by 10 Sept 2017, 00:28

            @cyperghost said in Retroflag NESPi Case - Soft Power & Reset Hack:

            @daminoutav As @Yahmez cut the traces off the switches they work independent. On the mosfet side with reset and evenpower buttons happens nothing ;) Because they are not connected to the mosfet.... only the "POWER CONTROL" GPIO is directly connected to the mosfet and keeps the state on/off.

            So you have power switch connected to GPIO X and reset to GPIO Y.
            So the Pie "knows" which button is pressed and initiates different actions ;)

            The original NesPi makes use of the reset buttons but that is an dirty reset method. Better use the software possibilities ;) RetroPie (better EmulationsStation) is able to perform proper Pie restarts, Pie shutdowns and ES restarts with a few tricks....

            Not quite. The power button is connected to the mosfet too, so upon pushing the power button it activates the mosfet switch, powering up the pi. It will continue to keep the mosfet on as long as the power switch is on. As the pi boots, it supplies a second 'on signal' to the mosfet but only really matters or does anything when you switch off the power switch. At that point it is keeping the mosfet on until the pi safely shuts down.

            1 Reply Last reply Reply Quote 1
            • Y
              Yahmez @s33d1ing
              last edited by 10 Sept 2017, 00:31

              @s33d1ing said in Retroflag NESPi Case - Soft Power & Reset Hack:

              @Yahmez Thanks this is exactly what I was looking for!

              You're welcome!

              1 Reply Last reply Reply Quote 0
              • Y
                Yahmez @mike17855
                last edited by 10 Sept 2017, 00:34

                @mike17855 said in Retroflag NESPi Case - Soft Power & Reset Hack:

                Has the shut down script been updated in the walk through? With the 1.59 script noted above?

                No, I have not had the time to try to achieve the same as that bash script in Python. I am not a programmer but do have an interest in finding out how to accomplish this in Python. I have read that the bash scripts for safe shutdown eat a lot more cpu cycles than the equivalent Python, which is why I chose that route.

                1 Reply Last reply Reply Quote 0
                • Y
                  Yahmez @Renegade_R
                  last edited by 10 Sept 2017, 00:36

                  @renegade_r said in Retroflag NESPi Case - Soft Power & Reset Hack:

                  @yahmez Thanks for the very comprehensive tutorial, I am wondering, is there an alternative to using the momentary switch board for more somewhat common parts? Getting that board delivered to me would cost more than the NESPI case itself.

                  Sure, there are other ways and methods. You can build your own circuit to accomplish the same end result.

                  1 Reply Last reply Reply Quote 0
                  • Y
                    Yahmez @DaminouTav
                    last edited by Yahmez 9 Oct 2017, 02:38 10 Sept 2017, 01:22

                    @daminoutav said in Retroflag NESPi Case - Soft Power & Reset Hack:

                    Thanks @Yahmez !
                    I will receive my NesPi case at the end of september and will test that.
                    If I understand well, when you press Power, it sends an order to Raspberry via GPIO (and we can do what we would like with it, in this case a properly shutdown) and then, hard power off raspberry ? The mofset knows when it have to hard power off via "On Control" => When raspberry is off, GPIO is off then mofset can hard power off ? Am I right ? :)
                    I'm not sure to understand very well how it works in fact ^^

                    Here is my description of the way it works...

                    There are three wires connected to the Pi. Two of these are inputs and can sense the state of the switches, one for the power switch (connected through a diode) and one for the reset switch. Both of them utilize the internal pullup GPIO resistors inside the Pi. When you press the power button, it activates the mosfet switch and sends power to the case PCBs and in turn the Pi. As long as the power switch is on, there is power available and the Pi has no way to turn off the mosfet switch. As the Pi boots, it turns on the aforementioned GPIO inputs to read the state of the buttons, it also turns a GPIO pin into an output and makes it go high. This output GPIO is connected to the third wire which acts as a second 'on signal' for the mosfet switch. Attached to this GPIO through a diode, there is a capacitor which upon receiving the 'on signal' from the Pi, charges up. If you hit reset at any point after booting the Pi senses this and initiates a reset of the Pi, but you could have it do anything you like. When you turn off the power switch, the Pi senses this as well and although there is no more 'on signal' coming from the power switch to the mosfet, the Pi's GPIO output keeps the mosfet on. After sensing the power switch is off, the Pi initiates a shut down. As the Pi shuts down the GPIO output goes low... This would mean that the mosfet would shut down instantly if not for the diode and capacitor we attached. Those components keep the mosfet switch on for a few seconds (until the capacitor discharges) to ensure that the Pi is completely shut down safely before switching off.

                    D 1 Reply Last reply 10 Sept 2017, 10:42 Reply Quote 0
                    • D
                      DaminouTav @Yahmez
                      last edited by 10 Sept 2017, 10:42

                      @yahmez Thanks that's clear ! So, if I shutdown Rpi directly from Pi and notre button, will it hard power off too ?

                      Y 1 Reply Last reply 10 Sept 2017, 14:27 Reply Quote 0
                      • Y
                        Yahmez @DaminouTav
                        last edited by 10 Sept 2017, 14:27

                        @daminoutav
                        Not sure I understand your question, but if you initiate a shutdown through ES the Pi will shutdown but the power to the Pi and the LED remain on until you press the power button to switch it off.

                        D 1 Reply Last reply 10 Sept 2017, 15:38 Reply Quote 0
                        • D
                          DaminouTav @Yahmez
                          last edited by DaminouTav 9 Oct 2017, 17:11 10 Sept 2017, 15:38

                          @yahmez oh okay thanks. It's not really like a Mausberry mofset wich allows that :)

                          1 Reply Last reply Reply Quote 0
                          • B
                            bug1baby
                            last edited by 11 Sept 2017, 20:08

                            @Yahmez Awesome guide. Do you think an alternative MOSFET could be used for this? Something like this? UK shipping for one from Pololu is $20 so looking at alternatives!

                            Thanks in advance!

                            Y 2 Replies Last reply 11 Sept 2017, 22:02 Reply Quote 0
                            • Y
                              Yahmez @bug1baby
                              last edited by 11 Sept 2017, 22:02

                              @bug1baby Thanks! Sadly, that mosfet board will not work. The Pololu board has an additional transistor and other components which allow it to work in the way I used it. You might be able to build your own version of the Pololu board though, they do provide a schematic of it on their website. It might be cheaper (but more work) to order the individual components rather than pay that outrageous shipping.

                              1 Reply Last reply Reply Quote 0
                              • Y
                                Yahmez @bug1baby
                                last edited by 11 Sept 2017, 22:07

                                @bug1baby
                                Amazon UK has the low voltage one which should work just the same as the one I used. Shipping is bound to be much cheaper.
                                https://www.amazon.co.uk/MOSFET-Switch-Reverse-Voltage-Protection/dp/B017HY9PIE

                                B 1 Reply Last reply 12 Sept 2017, 19:30 Reply Quote 0
                                • B
                                  bug1baby @Yahmez
                                  last edited by 12 Sept 2017, 19:30

                                  @yahmez Awesome. Thanks for the info

                                  1 Reply Last reply Reply Quote 0
                                  • topic:timeago-later,10 days
                                  • S
                                    snarc
                                    last edited by snarc 22 Sept 2017, 16:33

                                    Hi folks,

                                    I'm new to the RaspberryPi/RetroPie scene and today I've modded my NESPi case according to the awesome tutorial by @Yahmez.

                                    Soldering the wires etc. was no problem but setting up the Pi (a model 3 with the newest RetroPie installed) I got stuck...

                                    SOLVED: Some "expected an indented block" errors in the script caused the problem. So copying the script just from the PDF is not a good idea... :)

                                    Regards

                                    Y 1 Reply Last reply 24 Sept 2017, 03:20 Reply Quote 0
                                    • D
                                      doubleeuroz
                                      last edited by 24 Sept 2017, 02:58

                                      @Yahmez - For what reason did you go with that mosfet board vs using transistors and resistors along with the capacitor? It looks like you should be able to sub out the board with just the components. I have everything but that mosfet board...

                                      Y 1 Reply Last reply 24 Sept 2017, 03:18 Reply Quote 0
                                      • Y
                                        Yahmez @doubleeuroz
                                        last edited by 24 Sept 2017, 03:18

                                        @doubleeuroz
                                        For simplicity. There are many ways to do this, including using your own board and components whether it is transistors, mosfets, or a relay. For me, a proven $4 board was the easiest and most repeatable solution. The Pololu board is practically made for this application with the two ways to switch it matching perfectly to the pi and power switch combination. Also the form factor was just perfect as well. All in all, it was just the best option for me.

                                        1 Reply Last reply Reply Quote 0
                                        • Y
                                          Yahmez @snarc
                                          last edited by 24 Sept 2017, 03:20

                                          @snarc
                                          You're not the first having trouble copy/pasting from the PDF. I will be updating the walk through with links to pastebin copies of the code.

                                          1 Reply Last reply Reply Quote 0
                                          25 out of 151
                                          • First post
                                            25/151
                                            Last post

                                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                                            This community forum collects and processes your personal information.
                                            consent.not_received