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.

AEvers
  • 1
  • 3

1 Answers1

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.

Chad G
  • 1,063
  • 1
  • 7
  • 14