element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Power & Energy
  • Technologies
  • More
Power & Energy
Forum Maintain power long enough for SBC to power down
  • Blog
  • Forum
  • Quiz
  • Documents
  • Polls
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 12 replies
  • Subscribers 281 subscribers
  • Views 2503 views
  • Users 0 members are here
  • battery
  • power_supply
Related

Maintain power long enough for SBC to power down

obones
obones over 1 year ago

Hello,

I have connected my 3D printer to an Orange Pi Lite running Octoprint as it is much more user friendly when it comes to managing my prints.
This works just fine but required an additional power source and so I opened the printer and connected the 24V PSU output to a step down converter that provides the 5V for the Orange Pi.
So far, so good, everything is powering up and running properly.

What I'm having an issue with is the power off sequence because when I turn off the printer, the OrangePi is immediately deprived of its power and does not have the time to shutdown properly.
This may lead to some corruption on the file system and most importantly OctoPrint thinks it has crashed and thus starts in "Safe mode" upon the next boot.

First and foremost, I would need a way to detect the sudden disappearance of power and inform the OrangePi. Looking around for existing resources, I came up with this arrangement using parts that I have sitting on the shelf here:

image

As soon as the 24V is gone, Q1 stops conducting and the Orange Pi sees a logic 1 on one of its GPIO pins.
But I'm not too confident with this because when I usually such an arrangement, the base voltage is usually equal to or smaller than the collector voltage. Here the base voltage is MUCH higher and I'm afraid there would be a situation where the 24V would end up straight into the GPIO pin and frying the entire OrangePi.
So I came up with this design, once again using parts that I already have:

image

It feels wrong to have the same ground on both sides of the optocoupler but it gives me a sense of safety in that the +24V will have a harder time going to the GPIO pins in case of catastrophic failure.

What do you people think of those two options?

And while the above would be easily sorted out, I'm also struggling with the second part of the requirements which would be to maintain the +5V power for a sufficiently long time so that the OrangePi could run a script that properly turns it off.

At first, I took the biggest capacitor that I have here : 3300uF

But this failed miserably, there wasn't much delay in between +24V disappearing and step down converter shutdown.

I should have measured the current it consumes because with 250mA it would have been obvious this capacitor is too small.

So using a capacitor discharge curve calculator, aiming for 4.7V after 20s it showed me that I would need about 20F capacity!

That would cost me anywhere between 10 to 20€ which made me look for other alternatives based on what I have lying around here.

First idea was to use a phone PowerBank that would have its charge port connected to the step down converter and its output to the OrangePi. It's not guaranteed that its output is active while charging, but even then I have a feeling that it would quickly kill the battery to source so much current for so long.

Second idea was to use a 500mA LiPo that I have along with a 3€ controller board like this one:


image

While I know its output is active while charging, it still has the same potential issue of shortening the battery life.

This is why I figured I would need a way to OR the step down converter output with the battery step up converter output.

Easiest way is to use Schottky diodes on both power sources, so this requires 2W diodes and a careful setup of output voltages so that the step down one is higher than the "battery" one to ensure the step down one is used preferentially.

Reading about ORing power sources, I stumbled on Ideal Diodes chips like the LM66100 and LM66200, the latter being a very good candidate as it even shows exactly my use case in its datasheet. Getting my hands on one and being able to solder it is something that I have not even started to consider, though.

In the end, I'm left with those choices:

  1. 20F super capacitor
  2. Inline powerbank / LiPo battery with management board
  3. Side line powerbank with Schottky diodes
  4. Side line powerbank with Ideal diodes

Which option would you recommend?
Do you have any other suggestion?
Are there any potential issues that I did not think of?

Many thanks for your help

  • Sign in to reply
  • Cancel

Top Replies

  • michaelkellett
    michaelkellett over 1 year ago +2
    There is no risk with your single transistor ciruit - so long as R1 (220k) does not fail. The maximum current that can flow from the 24V supply is 24/220 mA = 0.109 mA or 109 uA. The maximum voltage…
  • obones
    obones over 1 year ago +2
    2 months later I was finally able to get some time to experiment with a 10F 5.6V capacitor and the bench power supply, it works! Bear with me for the tidiness, the breadboard setup is in the middle of…
  • michaelkellett
    michaelkellett over 1 year ago in reply to obones +1
    You could do it with one of those motor start switches which are a start and stop push button in a little box. The Start is single pole normally open and the Stop single pole normally closed. You wire…
  • rsjawale24
    rsjawale24 over 1 year ago

    Maybe shutdown the orange Pi before turning off the printer!?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 1 year ago

    There is no risk with your single transistor ciruit  - so long as R1 (220k) does not fail.

    The maximum current that can flow from the 24V supply is 24/220 mA = 0.109 mA or 109 uA. The maximum voltage that will reach your computer from the 24V is less than 0.7V (it will actually see 3.3V from the 3.3V supply.

    If you are really worried then use two resistors (110k) in series for R1, then, even if one fails short circuit, your computer is still safe.

    MK

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 1 year ago in reply to michaelkellett

    You could reverse the arrangement so that when you power off you ask the computer to shut down and when it shuts down it triggers a low power relay based switch that cuts the 24V power.

    The system on button will need to energise the relay directly.

    Exactly how you might do it depends on the design of the 24V supply in the printer.

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • obones
    obones over 1 year ago in reply to rsjawale24

    This can be done, but it requires connecting to it and issuing a command, waiting for the LED to turn off and then power down the printer.
    Quite cumbersome, and error prone if someone else comes along and simply sets the printer button to off.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • obones
    obones over 1 year ago in reply to michaelkellett

    The design is quite simple, the on/off switch is cutting the 220V phase line, then there is an integrated PSU that outputs 24V 12.5A, and then the entire printer system is using this 24V output.
    Pretty like what was done in the early computers before ATX came along.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 1 year ago in reply to obones

    You could do it with one of those motor start switches which are a start and stop push button in a little box. The Start is single pole normally open and the Stop single pole normally closed. You wire them in series and the mains on once side and the 24V supply input on the other.

    You need  a relay to bypass the on switch so that when the relay is energised the ciruit stays on, until you press the off switch.

    My internet is currently half dead (fibre pole blown down last Sunday) so I can't upload a picture.

    You'll need a couple of transistors to drive the relay.

    The StopStart switches are cheap, the wiring needs a little care because the mains is involved. Don't forget the diode across the relay to prevent spikes.

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 1 year ago

    It depends how fast you can shutdown the SBC or flush the fs to disk.

    Here is a sample spice schematic to experiment with how long a constant power load will be held up by an arbitrary bulk cap.

    image

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to michaelkellett
    michaelkellett said:
    My internet is currently half dead (fibre pole blown down last Sunday) so I can't upload a picture

    Over here, the wind is so strong that it blows away my wifi...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • javagoza
    javagoza over 1 year ago in reply to Jan Cumps

    Laughing

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • obones
    obones over 1 year ago in reply to scottiebabe
    scottiebabe said:
    It depends how fast you can shutdown the SBC or flush the fs to disk.

    From a power point of view, it's awfully slow with quite a few variations. On average, it's about 5 seconds, but I've seen anything between 2 and 10 seconds.
    Hence my requirement of 20 seconds "power hold" just to be on the safe side of things.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube