0

So, this is probably a matter of buying the right UPS but I am currently using a Pi to control my aquarium via relays. I'd like to hook the whole system to a UPS in case of powerloss. Ideally, I'd have my Pi be able to notify me when my UPS kicks in and safely start shutting down less essential parts of my system (lighting, certain pumps, etc) to preserve battery life. I'm not sure how to detect when a UPS kicks in but, for obvious safety reasons, I have absolutely no interest in trying to DIY build a UPS with such functionality. I suspect it's a matter of finding one that supports monitoring hardware.

To clarify, I'm not looking for a UPS hat for the pi. I'm aware that those exist but the UPS has to be able to power a number of very power hungry pumps.

6
  • You could have both a Pi UPS HAT and a normal UPS (not connected to the computer). Then it would be easy to detect power loss.
    – Tomas By
    Nov 28, 2018 at 11:21
  • Possibly would tell me if I lost power, assuming they were on the same circuit, but I also want to monitor the UPS itself and verify that it's kicking in, also, if possible, monitoring how much charge is left on the battery.
    – AEvers
    Nov 28, 2018 at 12:53
  • I doubt this is going to be easy. You will have to reverse engineer the serial protocol they use, I would guess.
    – Tomas By
    Nov 28, 2018 at 13:02
  • 1
    some UPSs have a serial port that can be used to communicate with the UPS and to get the status from the UPS
    – jsotola
    Nov 28, 2018 at 21:34
  • 1
    Possible duplicate of Detecting 5V output from USB charger via Raspberry Pi Nov 30, 2018 at 10:51

1 Answer 1

2

You could get a 3.3V plug in power supply like Here:

Plug the power supply into an outlet that is not backed up by the UPS, this way when there is a power outage, the power supply will loose power.

Then use the positive wire from the power supply as an input to the GPIO(and tie the grounds together). If the input is high, then you still have main power, if the input goes low, then power is lost and you can assume your on backup power. Obviously this is not supper efficient, as the power supply is using power when its plugged into "nothing" but it is a very simple way of determining if you have power to that outlet.

Depending on how fast you want a response, and how much capacitance is in the power supply, you may need to put a resistor between the two lines of the power supply. Since the input to the GPIO is not drawing any(very little) current, the input could stay high for a bit even after power loss.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.