Detect Power Outage with Relay?

Hello everyone,

I am looking for a cheap but accurate method of determining a power loss. My plan was to wire a 5v wall charger to a relay module:


By connecting the Positive to the VCC and In wires, and Ground to Negative. Then I could use my battery powered arduino to test across the Normally Open and Common terminals and thus determine if there was AC power.

Is this a good method to use? What are the chances of the relay getting "Stuck" in the on position?

Thanks for your time!

Hi,
Sure, that will work.

I have built emergency power systems that worked that way: a 120VAC relay on the power line. If it drops out the generator and transfer system is started.

I am looking for a cheap but accurate method of determining a power loss. My plan was to wire a 5v wall charger to a relay module:

if you have a 5V wall charger you can detect the 5V directly and you don’t need the relay. (Just make sure the 5V is regulated so you don’t over-voltage your Arduino.)

An alternative is a relay with a 120VAC coil (or a 230VAC if you’re in Europe.)

What are the chances of the relay getting “Stuck” in the on position?

Despite being mechanical, relays are very reliable. I remember having a bad horn-relay in a car once and where I work we’ve had some where the contact resistance has gone out-of-spec (but they still “work”). Otherwise I can’t remember any failures.

Thanks for the replies!

@DVDDoug:
I plan to have a 5v circuit powering the arduino (With an UPS I have laying around for backup), and I have a few extra 5v transformers around the house which I was going to use for the relay.

You are telling me it's possible to just directly test (Eg wire the 5v transformer right to an input pin) and that would work? (Wouldn't that short circuit?) Should I put a 220 ohm resistor & LED in the mix to give it some load?

Hi There
Yes, that would be my question as well. How to ensure that the Arduino doesn't get fried. I have a nice little Samsung travel adapter with a 5V 0.7A output that I could use. Any thoughts regarding how I should set this up?
Thanks

Canukus, I used an 8v transformer and an LM7805, that way it can handle some fluctuations.

DarthCaniac:
What are the chances of the relay getting "Stuck" in the on position?

Thanks for your time!

All depends on the contact material. Soft material, like silver will eventually stick. Look for tungsten contacts.

Paul

I use a voltage divider across the input - in front of a reverse polarity diode and 470uF capacitor.
Poll the analog input...
When primary DC supply starts diving - there is plenty of time to clean up and write about 512B of EEPROM before the cpu would have stopped (Actually: Enough time to write it several times... I stop the cpu after writing is complete)

I use a voltage divider across the input - in front of a reverse polarity diode and 470uF capacitor.

That's SUPER DANGEROUS and would not be allowed in a commercial product unless the Arduino was enclosed in an insulated/isolated case with no connections coming-out that you might touch or that you might connect low-voltage equipment to.

The power line should be totally ELECTRCALLY ISOLATED from the low-voltage Arduino. Isolation can be with a transformer (as with a 5V power supply), with a relay, or it can be optically isolated.

...The problem is, if the AC wiring gets accidentally "flipped around" you'll still have 5V across the voltage divider, but you'll have 120VAC (assuming U.S. power) on the Arduino's ground (relative to earth ground). You could be killed if you touch the Arduino' ground, and all kinds of bad things can happen if you plug the Arduino's USB port into your computer!

Optical isolation. Now that is a fantastic idea!

When primary DC supply starts diving

Not intending to be disrespectful, but WTF? the divider is across the pre-regulated DC input...!

1 Like