Power failure circuit

chris-s

New Member
Not strictly a picaxe project as yet, but I need a solid state circuit that will switch on a 5v supply if the 240VAC it is monitoring goes down. I have a situation where there are a number of 240V feeds from separate trips and want to detect/alert if any of them trip. There are several trips I want to monitor, but only need a single 'alert' signal to say that one of them has tripped.

I don't want to use mechanical relays, I know I can do it with a transistor of sorts, but my transistor skills are pathetic so I need your help!

It's only to alert if one of the trips go, not the entire power feed, so in this instance there will still be 240V somewhere to power the 5V supply and pic.

Chris
 

boriz

Senior Member
Disclaimer: Mains will kill you if you’re carless. Do this at your own risk.

240v RMS mains has a peak of 340v. Put the mains straight through a large resistor into an LED with a reverse parallel diode across the LED to prevent reverse breakdown. A max LED current of 10mA@340v would require a 34K resistor. The resistor will drop the rest of the 340v, dissipating around 3.5 Watts, so make sure it’s a power resistor capable of comfortably handling > 3.5W. For a more efficient solution, you can replace the resistor with a capacitor, but I’m uncertain about what sort of capacitor to use. Google ‘Transformerless power supply’ for more details.

The LED will be on for half the mains cycle @ 50Hz. This section can now be completely isolated from the lower voltage parts of the circuit, coupled only optically. The mains status can easily be monitored safely using an optical sensor.

Note. This method only monitors the mains voltage, NOT current. If you need to monitor the presence/absence of a load, you need a different method.
 

BeanieBots

Moderator
Well, to be honest, relays would be your best bet on grounds of safety, simplicity and cost. If you insist on using something less safe, more complex and more expensive, then consider opto isolators.

The majority of them have an input which is similar to an LED. The output is an open collector transistor. (jsut connect to PICAXE input with a pull-up resistor).
To drive the LED input, consider a simple wall-wart adaptor.

A relay REALLY IS the best option.
 

papaof2

Senior Member
The safest way would be to use an opto-isolator or solid-state relay that is kept operated by each 240VAC line and detect when any relay drops out. The PICAXE would then be detecting a contact close/open and not a high voltage.

The contacts of all the relays/isolators would be in parallel so that any line failure can be detected by a single input on the PICAXE.

Grayhill lists interface devices for microprocessors, such as this one that handles up to 60VAC http://www.mpja.com/prodinfo.asp?number=14419+RL They probaly have versions for higher voltages.

*IF* you are knowledgable of working at AC mains voltages, you could make your own interface with a neon lamp (or two LEDs), a resistor, and a phototransistor. However, that is NOT an area for a novice.

John
 

hippy

Ex-Staff (retired)
The simplest and inherently safe solution would be to design a standard PICAXE circuit with regulator run from a plug-in 'wallwart' power supply. Then extend that to a number of plug-in supplies all diode mixed together, and take feeds before the diodes to PICAXE input pins via suitable current limiting R's.

The PICAXE will always be powered as long as one of the PSU's is, and it can monitor which ones are providing a supply and which ones are not.
 

gengis

New Member
I second the opto isolator idea for both safety and cost.

It is wasteful to use a dropping resistor for AC. Calculate the X sub C (capacitive reactance) for the current and voltage you need (at the frequency you have) for the led and use a capacitor to drop the mains voltage. You still need a full wave bridge or a diode to protect the led from the reverse voltage.

I've got an LED nightlight I put together ~20 years ago that uses a .47 / 300 V cap and 100 ohm 1/4 watt carbon film resistor in series. The resistor limits the inrush current and serves as a fuse for a cap shorting.

Fairchild had an application note on it some years ago.
 

BeanieBots

Moderator
@BB: optoisolators? less safe??!!?!
YES, LESS safe.

Consider EVERYTHING that is required. An opto-isolator would require a PCB and some way of being connected to the mains supply which would need to go to that board. Mains on a PCB is always to be avoided whenever possible.

A relay can be mounted in a realy socket on the same DIN rail as the circuit breakers all enclosed within the distribution unit. Screw terminals direct to the (mains rated) coils.
No "circuitry" to get wrong. No exposed close wires/tracks to come in contact. Just wire the coils across the supply to be monitored, the volt-free contacts to the PICAXE. IMHO a "no brainer".

Failing that, a $1 wall-wart into a zener clamp or regulator. Volts or no volts.
 

nbw

Senior Member
Jeez, if you can get an optoisolator wrong, one shouldn't be mucking around with mains voltage. Sixteen of one, 28 of another. ! :)
 

chris-s

New Member
Thanks for the replies guys.

The reason I wanted to avoid mech relays was simply because I was concerned about the lifetime of the coil being energised 24/7 over several years.

SSR's were my other thought, but optoisolators hadn't sprung to mind.

Don't worry about the 'safety' side, I'm pretty sensible and competent on that front.


Cheers!

Chris
 

nbw

Senior Member
if you know that connecting an LED to DC without a resistor is almost always trouble, you're halfway thru OptoIsolators 101. Take a bow :)
 

BeanieBots

Moderator
@chris-s
I don't want to labour the point, but a relay is rated for the voltage applied to it. It won't 'cook' even after years of service. (unless it's an eBay second being sold cheap, but that's true for any component).
An opto-isolator is far more susceptable to ageing (dimming of the LED) and damage caused by transients etc. A tiny little semiconductor device vs a length of copper wire with large thermal mass. IMHO still a no brainer.
For frequent switching applications then maybe the relay comes second but even then, most are rated for 10e6 operations.

Also, "safety" circuits to this day still use relays. Ever wondered why?
(mainly for reliability reasons).

@NBW
How many people here even get the two resistor download circuit wrong?
 

gengis

New Member
There seems to be a lot of mystique or magic (for lack of a better word) surrounding AC mains and safety. My long dead uncle: "There's only two things I know about electricity: You can't see it, and it can kill you." (he died of old age)

One can not be too circumspect when dealing with lethal voltages, but the op stated that he's comfortable with what he's doing safety-wise.

There's got to be some middle ground that encourages extending one's knowledge and ability, and staying safe at the same time. Safety based on understanding and reason instead of irrational fear.

The tesla coil news letter has folks using oil filled, 600 pound, distribution transformers, "pole pigs" hooked up backwards to raise 240 to 10KV to make 500 KV 5KVA sparks - and do it safely. Probably fry a picaxe at 100 feet . . .with no connections to it.
 

hippy

Ex-Staff (retired)
The big difficulty is defining what that middle ground is. I'm sure many a tragedy has been prefixed with, "Don't worry, I know exactly what I'm doing ..."

No offence to the OP, but anyone can say they are comfortable with mains and know what it is they are doing. It doesn't mean they are.

The general approach on this forum with respect to mains and other risky activity has been to take it that if people really knew what they were doing then they would not need to ask. That's obviously not 100% correct but is perhaps the safest way to deal with such things when it's known that there are readers who definitely don't know what they are doing and may be put at risk by trying something they don't understand the implications of.

The complexity and aggravation of adding caveats and warnings to postings about anything which could be endangering makes it far easier to adopt the "don't do it" catch all. So interfacing with mains and so on is generally beyond the remit of this forum except to the extent of offering safe solutions to doing that; ie, only take mains through a certified plug-in PSU etc and cautioning that there is serious risk in doing it any other way.
 

boriz

Senior Member
I use the tone of the question (reading between the lines) to estimate the capabilities of the questioner before deciding on how to answer. But that’s just me.


The resistor+LED (or capacitor+LED) idea could easily be freeform wired (soldered directly lead to lead) or built on a tag strip or even a terminal block. No need for a PCB. I certainly wouldn’t use one.

I also really like the neon idea. No diode required. The resistor and neon bulb could easily be fitted inside an existing mains socket with a small ‘window’ to pass light to the sensor. If I had a neon bulb handy, that’s probably exactly what I’d do. In fact, don’t they already make sockets like that?
 

nbw

Senior Member
@BB: again I say! If you can get the 2 resistors wrong, you shouldn't be playing with MAINS VOLTAGE PERIOD!!
 

nbw

Senior Member
It also depends how often the opto is on for. If it's on for a few hours a day, dimming isn't going to be a huge problem. LEDs these days are good for more than just a few thousand hours :) Of course, if it's on all the time, and run at a nice juicy current, I accept it will perish a lot quicker. 24h / d = 8760h per year. You might get 50K hours out of an LED that's not flogged at near-max ratings. Granted, a relay will last a *little* longer ;-)

Of course, everyone puts their DIP ICs in nice sockets, so they can remove / replace them with ease if need be, right?
 

BeanieBots

Moderator
Yep, you've done the sums already!
You can expect to see 'some' opto's start to fail after just 6 years if driven at max 24/7.

Anyway, it's a simple choice. I said I'd not go on about it anymore so I won't.
I just think the humble relay is sometimes dismissed through pure electronic 'snobbery'.
 

nbw

Senior Member
@kevrus - Sledgehammer said that too! aka: trust me, I know what I'm doing.

@others - some optos probably have a better than 50K hour output, espcially if their LEDs aren't being driven to within a mA of their lives. Would be quite a device that would have to be on 24/7 beyond 5,6,... more years. Reminds me somewhat of another thread - picaxes in vehicles: 'not used where safety is critical etc'. I'm sure some relays would fail too - no guarantee they won't - also a possibility they might stick on - not good if you have a need to turn them off! If an LED dies, it won't hold the opto on. It's not electronic snobbery - just like new and flashy isn't always best, neither is old school "by default the best option". :) My 2 cents, er, tuppence worth.
 

BCJKiwi

Senior Member
There are Isolators that are functionally equivalent to optoisolators that do not rely on optics and hence do not suffer the life issues e.g. the RF family from Silicon Labs like the Si8440 etc.
 

gengis

New Member
@BB: again I say! If you can get the 2 resistors wrong, you shouldn't be playing with MAINS VOLTAGE PERIOD!!
There are people that get things right the first time? I have more than ~40-50 connections, I probably have at least one mistake. I plan on it. Better odds for two connections . . .

"A man's got to know his limitations."
 

boriz

Senior Member
I always see scare tactics employed to try and dissuade people from using dangerous voltages. Yes, mains can kill, but so can walking to the bus stop. Let’s be honest, how many people here have experienced a shock from mains electricity and (I assume) lived to tell the tale? I’ll start...

I’ve had two. Once from a lamp when I was about 12 years old and convinced my mother that ‘I can fix it’. And once just a couple of years ago when I forgot the thing I was working on was still live. Both were painful and potentially dangerous, but so is a boyzone concert.

Between me and a few friends, we have collectively received perhaps dozens of mains shocks. With nothing worse to show for it than briefly elevated hormone levels and minor cosmetic damage.

Anyone else?
 

lbenson

Senior Member
Yes, when I was about 12, with a faulty Christmas tree light socket I was poking about. Burned my hand badly enough to need bandaging. Of course we won't be hearing from those whose experience might most caution us.
 

premelec

Senior Member
chris-s I think the main parameter missing is what your MTBF requirement is - perhaps you've got what you need now - I'd use a bunch of optos in series [secondary side] to indicate failure of one or more inputs [primary side]. The other thing is how important is an incorrect output signal? In short MTBF and what if.... You could probably use capacitive input from the 230VAC circuits if you don't want to make electrical connection - as usual so many ways so much fun!
 

gengis

New Member
Regarding safety: I saw a public broadcasting piece on society in the US being over-protective and lawsuit averse. So kids are not learning science. They make a good point - you don't see Chemistry sets or even the Physics sets that contained alcohol lamps in stores any more. We could go down to a store and buy individual chemicals in small jars to replace what you used up in the course of interesting mayhem.

In grammar school I was building solid fueled aluminum and brass rockets, flares, gunpowder, cannons, hydrogen filled balloons (incorporating flares, of course - devastating in the night sky, good solid Whoomp from a mile away) Give me a carburetor and I'd have a metal melting furnace or flame thrower in a few hours. Kids today just don't know how to have fun. Spud cannon - what's that?

I got the usual shock from the bare prongs of a half-plugged 120V appliance when I was very young. The thing I remember most was my OM giving me a plate transformer (transistors were outside my budget then, and toobs were cheap). I measured the voltage to either side of center tap - 325-0-325 VAC, since dual vacuum diodes were the rectifier of choice. I left it plugged in, then later without thinking, went back and separated the secondary wires - dragging them through my fingers. I got a shock that had me sitting down and quivering for about ten minutes. That was my last shock.
 

flyingnunrt

Senior Member
If you are going to be playing with the AC mains then it would be a good idea to install some type of residual current device type circuit breaker (RCD).
These trip at <30mA and in less than 20ms or so.
Just in case you have a slip up.
 

SilentScreamer

Senior Member
I'd also recommend working with one hand whenever there is the slightest chance of it having power to it. Its the AC current across your heart that kills you, only using one hand should prevent this (although its not a definite solution, an RCD is far more effective, but it can help).
 

nbw

Senior Member
People should be wary, bordering on scared, of mains voltage if they're not confident and knowledgeable in what they're doing. There's a big difference between getting a tingle from a 9V battery and 240V. One won't kill, the other could. RCDs are a must. I've met d**kheads before who say "if something goes wrong, I'll just switch it off". Good luck reacting faster than an electric shock! Yes, people will always have "accidents". Yes, people often make dud connections. And yes, if you're one of the kind that don't do basic checks and end up popping a few picaxes (whoops, they really don't like 12V!) or a few LEDs (just stick it in, 50% chance of getting it the right way) and put these down to accidents, you shouldn't be handling mains voltage. End of story. (Which it may well be if you don't catch that tingle before it hits yer ticker!)
 

inglewoodpete

Senior Member
Recounting tales of the mains shocks we have survived diminishes the reality.

Poeple who have died from electric shock do not post here. Generally, the nearest and dearest of the dead will not post here either: they don't know the user's password.

I know of 2 people who have inadvertantly killed themselves with electric shock. One was a neighbour and the other was the friend-of-a-friend.

Treat mains electricity with a lot of respect. You have been warned.
 

leftyretro

New Member
It's nice to see the subject of AC voltage safety discussed openly without preaching or dismissing or concerns. The truth is AC mains power can be worked on safely if you follow good safety procedures. At most petro/chemical plants there is a very strict safety policy generally called lock out tag out. What it means is that no work can be performed on equipment without first de-energizing it and labeling or locking out the power source first. Conversly the circuit cannot be re-energized without closing up exposed connections/equipment and only then applying power at the source.

The problem is that we normally don't feel we need those kinds of procedures when we do our experimates and prototypes with our 5vdc or 12vdc equipment, so we frequently make connections to hot terminals and add and remove wires at will. It becomes second nature to 'work hot' on low voltage DC and we are exposed to real danger is we carry that work practice onto mains AC power.

So, I do feel very comfortable working on Mains power interfacing, however I do stop and take off my low voltage DC hat and put on my AC lock-out tag-out hat, plan my steps ahead, kill power first and apply power last. It's easy and safe if you are aware and follow correct safe procedures.

Lefty
 
Top