Shop OBEX P1 Docs P2 Docs Learn Events
How to detect power failure? — Parallax Forums

How to detect power failure?

CitationXPilotCitationXPilot Posts: 4
edited 2014-04-27 08:17 in BASIC Stamp
Hello, happy new year to you·all,
I am starting to build a device that will detect power failure.··What it will be detecting would be standard home voltage between 100V-240V.· I have used stamp to control a solid-state relay to drive 100V lamp, but I am scratching my head on going backwards.

Ultimately, I would like to have it signal a PC through RS-232, and a VB app send an email.

Could someone please shed a light on this please?· Or has anyone seen anything similar already done with a stamp or any other microcontroller?
Thanks!!

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-01-05 08:16
    For this scheme to work, your PC would have to be on a UPS, so it could survive the power failure long enough to send an email. But UPS units have their own power fail detection and a way to signal the PC that's plugged into it to trigger an orderly shutdown. Soooo ... why do you need another power fail detector?

    -Phil
  • CitationXPilotCitationXPilot Posts: 4
    edited 2008-01-05 08:35
    Phil,
    Thanks for the reply. Well, in the future, I would like to integrate it with GSM module and LiPo Battery, so I can get an alert through SMS, possibly.
    -Daniel
  • FranklinFranklin Posts: 4,747
    edited 2008-01-05 16:08
    There are many devices that will detect the power fail it just depends on how fancy (and expensive) you want to get. a filtered 5v wall wart powering the led side of an optoisolator with the other side monitored by the stamp would work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • CitationXPilotCitationXPilot Posts: 4
    edited 2008-01-05 19:20
    Stephen, Thanks for the suggestion.
    Is there an optoisolator that I could use which can handle 240V on the LED side?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-05 19:43
    Optoisolators don't "handle" voltages above the normal LED voltage (about 1.7V). They rely on external resistors usually to drop the voltage. You could use two 100K 1W resistors in parallel to limit the current to about 5mA which is reasonable for an optoisolator's LED.

    Much better would be to use a small 240V transformer to reduce the voltage to something like 5-10V, then use a small resistor to limit the current to 5-10mA.
  • CitationXPilotCitationXPilot Posts: 4
    edited 2008-01-08 02:15
    Thanks Mike. I will try that.
  • uxoriousuxorious Posts: 126
    edited 2008-01-08 23:08
    I have played around with similar projects by using a night light and a phototransistor, both inside a dark tube. I happened to have it all laying around when I started and left it since it worked perfectly. My question lately has been how to detect voltage fluctuations. I need a cheap way to monitor the quality of my overpriced power source. Basically I want to see fluctuations and those little 1/2 second blinks on a log.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ~~ dRu ~~
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-09 18:12
    In 1995 I built a Z80-based alarm system that needed to detect loss of main AC power. What I did was put an opto-coupler on the input of the power supply transformer. Its output was fed to an input buffer which was connected to the NMI input. It a power failure was detected the unit switched to battery backup. This method relied on the fact that the output capacitors on the supply were sufficient to power the system for a few seconds after main power was lost, though only a fraction of a second was/is needed. The output of the device is essentially a transistor, so you see a low when there is power and a high when power is lost. Interestingly, the configuration of this circuit was designed for more than just detecting power loss. The 60 Hz output was what clocked the NMI line and drove the internal software clock. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • steve_bsteve_b Posts: 1,563
    edited 2008-01-09 18:16
    I like the suggested low voltage opto ways of doing things and recommend them.

    But just to add options, you could just take a 120V relay and wire a stamp up to it's NO/NC contacts and just monitor that. When the power goes out, the relay is deenergized and changes the state of it's contacts.

    Something we run in to here at work, we're rural, is that we'll lose one phase of three. So some things will drop out, but most things keep working. Our generator doesn't monitor all the phases, so we are sometimes surprised when the thing we're working on drops out and the gen doesn't cover it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • willy41willy41 Posts: 2
    edited 2014-04-26 16:19
    I am not a EE so I would ask that any answer be in layman's terms. My car has a DC power outlet in the console. When I turn off the ignition, the power goes off. What would be the simplest way to detect that power is going off. I have a battery powered annunciator with a switch that I would like to activate when the main power is turned off. Thanks in advance.
  • Mike GreenMike Green Posts: 23,101
    edited 2014-04-26 16:43
    The simplest way would be to use a 12V coil relay with NC (normally closed) contacts. When there's 12V available, the relay is open. When the power off, the relay contacts close. Something like this. Any SPDT or DPDT relay with a 12V coil should work. I picked this one because it doesn't take much power when active. The coil gets connected across the 12V DC outlet connections and the NC contacts get connected across the switch of the annunciator.
  • willy41willy41 Posts: 2
    edited 2014-04-26 20:26
    Ah, yes, one good answer deserves another question. I only want the anunciator switch to be closed for ten seconds; otherwise it would keep anunciating forever. Thanks again.
  • Mike GreenMike Green Posts: 23,101
    edited 2014-04-26 22:44
    Look at some of the internet DIY articles on the 555 timer. You'd have to run your timer off the battery of the annunciator. The 555 timer's switching transistor would turn on power to the annumciator, probably by connecting the ground lead to the battery's ground lead. You'd configure the timer to provide a 10 second on pulse when the relay contacts close.
  • tonyp12tonyp12 Posts: 1,951
    edited 2014-04-27 08:17
    They make voltage supervisor IC, this one for example have a (max) 10second stay low delay, that you could feed to a PMsofet that is feeding a relay etc.
    Use resistor voltage divider to get automotive 13-20v down to 3v (or what ever you set as threshold voltage) and also put TVS on the input line too as spikes you be way above that.
    http://www.ti.com/lit/ds/symlink/tps3808g15-q1.pdf
Sign In or Register to comment.