Battery fallback for Onion Omega
@Lazar-Demin Thanks for your reply also. I know about the Onion Battery pack, i backed it Unfortunately it is pretty delayed and my 3 month road trip starts in 3 weeks, which my Onion is going to track and create a timelapse from it... sorry that was OT.
The Adafruit Power Board has the USB Vin extracted on the board so you can use it as GPIO i think and when its low i know that the power supply has gone and can shutdown the onion safely.
Also there is a Low Power Pin that can be used for the same reason but you can run the Onion as long as possible on battery.
I will give it a try and switch to the Onion Battery Pack later... hopefully it has such Low Battery and "is power source connected" pins also.
@Lazar-Demin On which pins could i connect the 5V and Ground for input power when i dont want to use microusb cable. I tried the 5V pin on the expansion board but it doesnt work. Maybe i have to connect ground to one specific pin?
@Benjamin-Rau I am assuming you are using an expansion dock.
I have successfully powered my Omega connected to an expansion dock from a 5v power source with the 5v connected to the expansion dock pin marked 5v near the RST pin and the ground of the power source to the GND pin at the end (next to the RST and 3.3v pins)
@Benjamin-Rau Either of the 5V pins and any of the three GND pins on the Expansion Dock will work (they're all connected on the PCB).
If it still doesn't work, please post a photo of your setup.
I created a small python script that i start on boot and which monitors low battery and input power status powers the onion off before an empty battery would kill the onion hard:
I made use of the gpio wrapper one of the onioneers contributed:
@Benjamin-Rau Awesome! I like the Python script that halts the Omega when the battery gets low.
Side note: there's also an Onion GPIO Python module: https://wiki.onion.io/Documentation/Libraries/GPIO-Library
Maybe coming up with a dumb question but "How to power on the Omega after powering it off from within the os with halt command?"
My problem now is that i power the Omega off with my script mentioned above but i dont know how to power it on again when power source recovered. The problem is that the from the Omegas perspective the power source never disconnected so i would need to "send some power on signal with HIGH..."
@Benjamin-Rau I think you have yourself a kind of logical conundrum Once you have halted your Omega (because power is getting low) using your script, it is now no longer running and thus will not be able to respond to any input signal you may devise.
I'm not a Python expert, but I gather that your script keeps going and does not halt unless the power low condition remains for a given period (1 minute ?). I assume that the intention is that you need to do some cleanup or tidy shut down action prior to power actually failing totally.
My best suggestion would be to not do the halt operation (but continue to do cleanup operations as required) while power is low. Then,if power is restored fully before it finally fails you will continue processing OK. If power does fail completely then (a) your system should still be in a clean state; and (b) your system should restart normally when power is restored
If this is not sufficient for your requirements, you may have to consider some external circuitry that (a) you can control to fully turn off your system when power is low for too long; and (b) which re-applies power to your system when power re-attains acceptable levels. I'm sure that something using latching relays or similar could be contrived to do this.
As an addendum to the above, as a final comment to this, in your original post you said: When i stop the car... the power is off. And mama told me that this isnt the way to shutdown a computer
The only real reason that powering off is not a good way to shut down a computer is because there may be data in memory that hasn't been physically written (flushed) to open files. Thus, so long as when you know power is getting low and may fail, you ensure that all pending output is done, you should be OK when/if power does fail.
Hej @Kit-Bishop, thanks for your reply.
YOu are right that was kind of a logical conundrum combined with bad english and misunderstadings
I cleared the situation now out for me and i am one step ahead.
As usual another blocker:
When connecting the LowBattery (LBO) output of the Adafruid PowerBoost to any GPIO on my Omega the LB Led on the module (also if it was off before) starts shining and the GPIO is logical HIGH, even when the LED was off before.
When i remove the cable from GPIO to LBO the LED is off again.
Tonight i will test the LBO with an Arduino (others in the internet report that the LBO is worked very well for them) but maybe in the meantime one has an idea why the LBO is high always when the cable is connected.
@Benjamin-Rau From looking at the schematics for the Adafruit PowerBost (https://learn.adafruit.com/downloads/pdf/adafruit-powerboost.pdf), its LB LED would be turned on if the LBO line is driven/held low.
- Are you sure that your Omega GPIO pin is configured as an INPUT?
Additionally, the Application Schematic for the TPS61090 chip used in the PowerBoost indicates that a pull-up resistor should be used on the LBO line (see http://www.ti.com/lit/ds/symlink/tps61090.pdf). There is no such pull-up in the PowerBoost schematics
- I would suggest a pull-up resistor on the GPIO pin used for the LBO - I guess around 10K Ohm should do.