Is there a way to unplug the Raspberry pi safely without shutting downShutting down the Pi safely without SSH or a monitor?Shut down standalone pi without accessCleanly shutting down daemon on Reboot or Shutdown commandShutting down quickly (And safely)Detect when the rpi3b+ has shut down

changing number of arguments to a function in secondary evaluation

Are differences between uniformly distributed numbers uniformly distributed?

Is there a way to unplug the Raspberry pi safely without shutting down

As a 16 year old, how can I keep my money safe from my mother?

Is refreshing multiple times a test case for web applications?

How to take the beginning and end parts of a list with simpler syntax?

How to mark beverage cans in a cooler for a blind person?

Who are these characters/superheroes in the posters from Chris's room in Family Guy?

The cat ate your input again!

English - Acceptable use of parentheses in an author's name

Should I ask for permission to write an expository post about someone's else research?

Double redundancy for the Saturn V LVDC computer memory, how were disagreements resolved?

Plausibility of Ice Eaters in the Arctic

Are there any financial disadvantages to living significantly "below your means"?

What is the maximum number of PC-controlled undead?

Understanding the point of a kölsche Witz

Find y in this equation

Why is transplanting a specific intact brain impossible if it is generally possible?

Was the 2019 Lion King film made through motion capture?

Y2K... in 2019?

What are the uses and limitations of Persuasion, Insight, and Deception against other PCs?

Does a code snippet compile? Or does it get compiled?

Why did Gandalf use a sword against the Balrog?

Why isn’t SHA-3 in wider use?



Is there a way to unplug the Raspberry pi safely without shutting down


Shutting down the Pi safely without SSH or a monitor?Shut down standalone pi without accessCleanly shutting down daemon on Reboot or Shutdown commandShutting down quickly (And safely)Detect when the rpi3b+ has shut down






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm building a kiosk app for a raspberry pi, and the final intention is that it will sit in a pelicase with all the external hardware, with one power cord in. My program has a quit button which safely shuts down the pi by running sudo halt, but it would make it easier if the pi could automatically shutdown when it detects that it has been unplugged. Could this be done if I had a capacitor on the power rails and when the power was disconnected the pi could measure the power drop and shutdown safely if it detected a loss of power? Thanks.










share|improve this question







New contributor



Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    1















    I'm building a kiosk app for a raspberry pi, and the final intention is that it will sit in a pelicase with all the external hardware, with one power cord in. My program has a quit button which safely shuts down the pi by running sudo halt, but it would make it easier if the pi could automatically shutdown when it detects that it has been unplugged. Could this be done if I had a capacitor on the power rails and when the power was disconnected the pi could measure the power drop and shutdown safely if it detected a loss of power? Thanks.










    share|improve this question







    New contributor



    Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      1












      1








      1








      I'm building a kiosk app for a raspberry pi, and the final intention is that it will sit in a pelicase with all the external hardware, with one power cord in. My program has a quit button which safely shuts down the pi by running sudo halt, but it would make it easier if the pi could automatically shutdown when it detects that it has been unplugged. Could this be done if I had a capacitor on the power rails and when the power was disconnected the pi could measure the power drop and shutdown safely if it detected a loss of power? Thanks.










      share|improve this question







      New contributor



      Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm building a kiosk app for a raspberry pi, and the final intention is that it will sit in a pelicase with all the external hardware, with one power cord in. My program has a quit button which safely shuts down the pi by running sudo halt, but it would make it easier if the pi could automatically shutdown when it detects that it has been unplugged. Could this be done if I had a capacitor on the power rails and when the power was disconnected the pi could measure the power drop and shutdown safely if it detected a loss of power? Thanks.







      shutdown






      share|improve this question







      New contributor



      Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 8 hours ago









      NadimNadim

      61 bronze badge




      61 bronze badge




      New contributor



      Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Nadim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.

























          3 Answers
          3






          active

          oldest

          votes


















          1














          What you're asking for is impossible. There's no battery backup on the RPi without additional hardware.



          Pulling the power may be OK 9 times out of ten, but every time you pull the power you risk corruption of your SDCard.



          Even if you move to a HDD or SSD for the root filesystem you risk corruption with a sudden power loss.



          How hard is it to use sudo poweroff then wait ten seconds for that to complete? You know it's complete when the activity LED blinks ten times.






          share|improve this answer
































            1














            To achieve this thing you need two things.



            1. First, the power failure detection circuit.

            2. A power backup system that can give power back up to shut down the raspberry pi.

            There are many ways to implement the power detection circuit. I am giving an example of this





            schematic





            simulate this circuit – Schematic created using CircuitLab
            in this circuit, the R1 and R2 you have to chose such that rpi gpio will get 3.3V, 3mA current. When power presents the gpio get a high signal failure will occur the get low signal.



            For power back up you need a supercapacitor circuitry that can store 5V*2.5mA * 60sec energy minimum such that it can provide power to RPI when it performs shut down the operation.






            share|improve this answer
































              1














              No computer system which writes to internal storage can just be powered off without risk of loss. The Pi is no different in this respect.



              Conventional computers have a managed shutdown and/or battery backup.



              It is not difficult to provide the same to a Pi (the additional circuitry is likely to cost more than the Pi) and there are many articles on this, and a number of commercial products.



              NOTE a capacitor is unlikely to provide sufficient voltage for long enough.



              The other option is to use a read only filesystem, and store working data in volatile storage (RAM) - it depends on your application if this is applicable.






              share|improve this answer

























              • Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                – sbell
                2 mins ago













              Your Answer






              StackExchange.ifUsing("editor", function ()
              return StackExchange.using("schematics", function ()
              StackExchange.schematics.init();
              );
              , "cicuitlab");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "447"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              Nadim is a new contributor. Be nice, and check out our Code of Conduct.









              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f101509%2fis-there-a-way-to-unplug-the-raspberry-pi-safely-without-shutting-down%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              What you're asking for is impossible. There's no battery backup on the RPi without additional hardware.



              Pulling the power may be OK 9 times out of ten, but every time you pull the power you risk corruption of your SDCard.



              Even if you move to a HDD or SSD for the root filesystem you risk corruption with a sudden power loss.



              How hard is it to use sudo poweroff then wait ten seconds for that to complete? You know it's complete when the activity LED blinks ten times.






              share|improve this answer





























                1














                What you're asking for is impossible. There's no battery backup on the RPi without additional hardware.



                Pulling the power may be OK 9 times out of ten, but every time you pull the power you risk corruption of your SDCard.



                Even if you move to a HDD or SSD for the root filesystem you risk corruption with a sudden power loss.



                How hard is it to use sudo poweroff then wait ten seconds for that to complete? You know it's complete when the activity LED blinks ten times.






                share|improve this answer



























                  1












                  1








                  1







                  What you're asking for is impossible. There's no battery backup on the RPi without additional hardware.



                  Pulling the power may be OK 9 times out of ten, but every time you pull the power you risk corruption of your SDCard.



                  Even if you move to a HDD or SSD for the root filesystem you risk corruption with a sudden power loss.



                  How hard is it to use sudo poweroff then wait ten seconds for that to complete? You know it's complete when the activity LED blinks ten times.






                  share|improve this answer













                  What you're asking for is impossible. There's no battery backup on the RPi without additional hardware.



                  Pulling the power may be OK 9 times out of ten, but every time you pull the power you risk corruption of your SDCard.



                  Even if you move to a HDD or SSD for the root filesystem you risk corruption with a sudden power loss.



                  How hard is it to use sudo poweroff then wait ten seconds for that to complete? You know it's complete when the activity LED blinks ten times.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 7 hours ago









                  DougieDougie

                  1,5821 gold badge2 silver badges10 bronze badges




                  1,5821 gold badge2 silver badges10 bronze badges


























                      1














                      To achieve this thing you need two things.



                      1. First, the power failure detection circuit.

                      2. A power backup system that can give power back up to shut down the raspberry pi.

                      There are many ways to implement the power detection circuit. I am giving an example of this





                      schematic





                      simulate this circuit – Schematic created using CircuitLab
                      in this circuit, the R1 and R2 you have to chose such that rpi gpio will get 3.3V, 3mA current. When power presents the gpio get a high signal failure will occur the get low signal.



                      For power back up you need a supercapacitor circuitry that can store 5V*2.5mA * 60sec energy minimum such that it can provide power to RPI when it performs shut down the operation.






                      share|improve this answer





























                        1














                        To achieve this thing you need two things.



                        1. First, the power failure detection circuit.

                        2. A power backup system that can give power back up to shut down the raspberry pi.

                        There are many ways to implement the power detection circuit. I am giving an example of this





                        schematic





                        simulate this circuit – Schematic created using CircuitLab
                        in this circuit, the R1 and R2 you have to chose such that rpi gpio will get 3.3V, 3mA current. When power presents the gpio get a high signal failure will occur the get low signal.



                        For power back up you need a supercapacitor circuitry that can store 5V*2.5mA * 60sec energy minimum such that it can provide power to RPI when it performs shut down the operation.






                        share|improve this answer



























                          1












                          1








                          1







                          To achieve this thing you need two things.



                          1. First, the power failure detection circuit.

                          2. A power backup system that can give power back up to shut down the raspberry pi.

                          There are many ways to implement the power detection circuit. I am giving an example of this





                          schematic





                          simulate this circuit – Schematic created using CircuitLab
                          in this circuit, the R1 and R2 you have to chose such that rpi gpio will get 3.3V, 3mA current. When power presents the gpio get a high signal failure will occur the get low signal.



                          For power back up you need a supercapacitor circuitry that can store 5V*2.5mA * 60sec energy minimum such that it can provide power to RPI when it performs shut down the operation.






                          share|improve this answer













                          To achieve this thing you need two things.



                          1. First, the power failure detection circuit.

                          2. A power backup system that can give power back up to shut down the raspberry pi.

                          There are many ways to implement the power detection circuit. I am giving an example of this





                          schematic





                          simulate this circuit – Schematic created using CircuitLab
                          in this circuit, the R1 and R2 you have to chose such that rpi gpio will get 3.3V, 3mA current. When power presents the gpio get a high signal failure will occur the get low signal.



                          For power back up you need a supercapacitor circuitry that can store 5V*2.5mA * 60sec energy minimum such that it can provide power to RPI when it performs shut down the operation.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 6 hours ago









                          PrayuktibidPrayuktibid

                          144 bronze badges




                          144 bronze badges
























                              1














                              No computer system which writes to internal storage can just be powered off without risk of loss. The Pi is no different in this respect.



                              Conventional computers have a managed shutdown and/or battery backup.



                              It is not difficult to provide the same to a Pi (the additional circuitry is likely to cost more than the Pi) and there are many articles on this, and a number of commercial products.



                              NOTE a capacitor is unlikely to provide sufficient voltage for long enough.



                              The other option is to use a read only filesystem, and store working data in volatile storage (RAM) - it depends on your application if this is applicable.






                              share|improve this answer

























                              • Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                                – sbell
                                2 mins ago















                              1














                              No computer system which writes to internal storage can just be powered off without risk of loss. The Pi is no different in this respect.



                              Conventional computers have a managed shutdown and/or battery backup.



                              It is not difficult to provide the same to a Pi (the additional circuitry is likely to cost more than the Pi) and there are many articles on this, and a number of commercial products.



                              NOTE a capacitor is unlikely to provide sufficient voltage for long enough.



                              The other option is to use a read only filesystem, and store working data in volatile storage (RAM) - it depends on your application if this is applicable.






                              share|improve this answer

























                              • Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                                – sbell
                                2 mins ago













                              1












                              1








                              1







                              No computer system which writes to internal storage can just be powered off without risk of loss. The Pi is no different in this respect.



                              Conventional computers have a managed shutdown and/or battery backup.



                              It is not difficult to provide the same to a Pi (the additional circuitry is likely to cost more than the Pi) and there are many articles on this, and a number of commercial products.



                              NOTE a capacitor is unlikely to provide sufficient voltage for long enough.



                              The other option is to use a read only filesystem, and store working data in volatile storage (RAM) - it depends on your application if this is applicable.






                              share|improve this answer













                              No computer system which writes to internal storage can just be powered off without risk of loss. The Pi is no different in this respect.



                              Conventional computers have a managed shutdown and/or battery backup.



                              It is not difficult to provide the same to a Pi (the additional circuitry is likely to cost more than the Pi) and there are many articles on this, and a number of commercial products.



                              NOTE a capacitor is unlikely to provide sufficient voltage for long enough.



                              The other option is to use a read only filesystem, and store working data in volatile storage (RAM) - it depends on your application if this is applicable.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 1 hour ago









                              MilliwaysMilliways

                              33.3k14 gold badges59 silver badges126 bronze badges




                              33.3k14 gold badges59 silver badges126 bronze badges















                              • Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                                – sbell
                                2 mins ago

















                              • Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                                – sbell
                                2 mins ago
















                              Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                              – sbell
                              2 mins ago





                              Re: your note about storing data in RAM; I have use AUFS (RAM fs + read only ext4 mount) to successfully implement a Linux driven embedded project that can handle hard power events. Something similar to what is mentioned here: linuxquestions.org/questions/linux-general-1/…

                              – sbell
                              2 mins ago










                              Nadim is a new contributor. Be nice, and check out our Code of Conduct.









                              draft saved

                              draft discarded


















                              Nadim is a new contributor. Be nice, and check out our Code of Conduct.












                              Nadim is a new contributor. Be nice, and check out our Code of Conduct.











                              Nadim is a new contributor. Be nice, and check out our Code of Conduct.














                              Thanks for contributing an answer to Raspberry Pi Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f101509%2fis-there-a-way-to-unplug-the-raspberry-pi-safely-without-shutting-down%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                              Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її