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:
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:
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:
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:
- 20F super capacitor
- Inline powerbank / LiPo battery with management board
- Side line powerbank with Schottky diodes
- 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