Tomo2k
Posts: 127
Joined: Mon Dec 19, 2011 10:00 pm

Re: Controlling a mains power socket switch? (home automation)

Sun Dec 25, 2011 8:22 pm

SSRs are either a Triac or a pair of SCRs (a Triac is internally two SCRs), usually with an optotriac to drive the gate.

Very low-power ones might just be an optotriac, however these are very rarely used to control loads directly – generally they drive a mains-coil relay.

SCRs are turned on by feeding current into the gate, and they continue to conduct until the current falls to zero.

- This means that there is always a 'wibble'* around zero-cross as the forward SCR turns off and the reverse SCR turns back on. The size and shape of the wibble depends on the reactance of the circuit. Some PSU designs cannot handle this.

When 'off', there is a small (mA) leakage current through the SCR.

- This can be enough to (partially) power small loads, and means that a PSU in the load is always being provided with some voltage and a few mA, with a very odd curve as the voltage varies with the current drawn.

Finally, SCRs have two failure modes – stuck on and stuck off. Generally SCRs tend to fail stuck-on, triacs stuck-off, though either is possible.

If only one direction fails either way, then you will be giving the load a half-wave rectified mains supply – and there are a lot of things that really don't like that.

There are of course many loads that SSRs can switch well.

Unfortunately some CFLs have among the worst PSUs I've ever seen – and are highly capacitive. Most of the SSR-based switches I've seen specifically say not to use them with CFLs.

There are 'dimmable' CFLs and these are fine on SSRs, but you'll have bought those to put them on a real dimmer anyway.!

A normal dimmer is actually an SSR with added choke (big inductor) and control electronics to determine the right point in the cycle to turn on.

*Technical term.

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Controlling a mains power socket switch? (home automation)

Sun Dec 25, 2011 8:48 pm

Thanks Tomo2k.

Interesting.

I looked into using a phase controller to dump excess power from a solar PV array into the immersion heater.

Doable with the Pi but I need a lower power solution with RF to get the consumer meter tail readings to the control system, no power by the consumer unit & I don't want to drill near it!

A hobby really, cost too much to qualify.

johnnysometimes
Posts: 6
Joined: Tue Dec 27, 2011 12:08 am

Re: Controlling a mains power socket switch? (home automation)

Tue Dec 27, 2011 1:28 am

http://www.ecrater.co.uk/p/118.....ne-channel

costs £16 and has Linux drivers

It has a 10 Amp relay which will handle 2000 Watts.

If you take a two way power strip socket apart (unplugged of course!) You need to take the brown wire off the socket to the relay, then add a new brown wire back from the relay to the socket. I should then tape the relay board to cover one socket and connect your heater to the other. Better still get a tupperware or ice cream tub and put the whole contraption inside - cut three slots for the wires - Power in, Heater out and USB control.

Ianw
Posts: 46
Joined: Sun Dec 25, 2011 10:54 am

Re: Controlling a mains power socket switch? (home automation)

Tue Dec 27, 2011 12:57 pm

Doesn’t look like there’s any kind of adequate Isolation on that board and would have thought 13A would be a minimum? (plus about another 100 reasons why its unsafe – not going to troll or be condescending but that thing looks like a fire/electrocution in the making)

Be aware that altering/making stuff like that will probably void house insurance in the event of a fire etc

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Controlling a mains power socket switch? (home automation)

Tue Dec 27, 2011 1:11 pm

Its a mechanically isolated relay.

Doesn't look like there is opto isolation through to the digital.

I would have thought that it would be OK.

Myself, I would add the opto through to digital as well!

You will have to search a bit to find a 13Amp relay ready built.

I thought that the application was a <300W motor?

You need to check what your motor's inductance is.

If the comment is meant for me re: 3KW immersion heater (13Amp) then I could put a diode on it and get 1.5KW.

Ianw
Posts: 46
Joined: Sun Dec 25, 2011 10:54 am

Re: Controlling a mains power socket switch? (home automation)

Tue Dec 27, 2011 9:10 pm

Lol sorry Brad, was posted towards Johnny and the boiler Personally wouldnt use that relay as it is for such a load yet alone plop 2000w +/- @230V +/- in an ice cream tub with a £10 unisolated, unfused, unearthed non CE/BS compliant untested and non-manufacturer approved relay board and a bodged power socket.

Really cant see any potential pitfalls there and im sure the household insurance will understand :-p plus the police, fire, paramedics etc :-p

Tomo2k
Posts: 127
Joined: Mon Dec 19, 2011 10:00 pm

Re: Controlling a mains power socket switch? (home automation)

Tue Dec 27, 2011 9:56 pm

I'm with Ianw here.

I've been bitten by 120VAC via X/Y caps (lost PE on a device). That hurt and it was not really a dangerous current.

Electric can and does kill.

The relay used in that board claims 1500VAC coil to contact insulation (good start), but is probably unsuitable for inductive loads as the relay component manufacturer doesn't give any information about that.

Secondly, there is no Protective Earth terminal on that board, though it's possible the screw terminals are intended that way.

You have no way of knowing whether that board meets the requirements for separation of LV and ELV either as Class I or Class II - the underside of the board is not shown.

If put in an icecream carton as-is, it would be a Class 0 device which are illegal to sell in the UK.

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Controlling a mains power socket switch? (home automation)

Tue Dec 27, 2011 10:19 pm

lol

I was going to ask if I should eat all the icecream first.....

There are cheaper options at Maplins.

johnnysometimes
Posts: 6
Joined: Tue Dec 27, 2011 12:08 am

Re: Controlling a mains power socket switch? (home automation)

Wed Dec 28, 2011 12:56 am

What a bunch of health and safety fanatics you are!

30 years of Wireless World and Practical Electroncs taught me to drive relay coils with a transistor or a 555 timer and use it to switch mains. I've never had a fire in my life.

The neutral and earth wires are still in place so it's not Class 0 inside or outside of the ice cream tub. He's only switching a resistive heater load with (he hopes) up to 2Kw on a really good day in winter.

Please try to think yourself back into 1980's mode for the Raspberry Pi. How are we ever going to think outside the ice cream tub ever again if we don't take some risks and experiment? That's why it costs fifteen quid.

It's not just playstations and 64bit processors that strangled programming and innovation in the UK, it's the all pervasive "every single possible risk must be eliminated" culture that ground it out. Man-up, guys! Wrap some bloody insulation tape round it, keep an eye on it for the first few hours it is working, feel it occasionally to see if it's getting warm, then move on and invent something else!

Prior to dabbling with PC's with their mains pack tidily canned in the corner, nearly everything I built from a teenager involved mains power and electronics - power ampliffiers, sound to light units etc. Tens of thousnads of people worked on domestic TV sets with "live" chassis - no earth wire, neutral on the metal work. Prior to that they built their own valve radios with HT (High Tension) voltages up to 700 volts .....

I'll stop now before I end up writing a book

Yes - eat the ice cream, eat lots of ice cream - we're going to need a bigger tub

Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Controlling a mains power socket switch? (home automation)

Wed Dec 28, 2011 1:10 am

I whole heartedly agree. This stuff be magic, made of smoke and fire...

Lol

Tomo2k
Posts: 127
Joined: Mon Dec 19, 2011 10:00 pm

Re: Controlling a mains power socket switch? (home automation)

Wed Dec 28, 2011 3:59 am

johnnysometimes said:


What a bunch of health and safety fanatics you are!

30 years of Wireless World and Practical Electroncs taught me to drive relay coils with a transistor or a 555 timer and use it to switch mains. I've never had a fire in my life.



I don't want people doing unsafe things.

That's not only because it's a shame when people get killed or injured, but I'm selfish enough to want to continue to be able to work in my day job without needing to take even more daft certification tests.

Even if I get grandfathered in, it's still a pain.

Part P came about because of accidents by people doing that kind of thing.

(I think it was actually due to one accident where the daughter of an MP died due to badly-installed kitchen wiring, though that might be a coincidence.)

Part P means that I'm not allowed to rewire notable parts of my house despite being a qualified and competent electrician working on mid-sized power (up to 1000A) systems in my day job.

The CSCS system came about because too many workers on building sites did stupid things - so I now have to take a multiple-guess test every five years to renew my ECS card.

(One of the questions has the possible answer "Bring a cat to work". I kid you not!)

Perhaps you can safely work with electricity - but the 15-year old kid reading this forum next year probably isn't.

- Oh, and the relay board would be Class 0. The supplied equipment would retain whatever rating it had unless you did something truly crazy.

Pensee
Posts: 14
Joined: Wed Dec 28, 2011 12:37 pm
Contact: Website

Re: Controlling a mains power socket switch? (home automation)

Wed Dec 28, 2011 1:07 pm

You can find lot of tips and advices from this site (but you have to dig a bit) :

http://tuxgraphics.org/electronics/

example with photos here :

tuxgraphics.org: Pool timer

my 2 cts

bugvish
Posts: 1
Joined: Thu Dec 29, 2011 7:40 pm

Re: Controlling a mains power socket switch? (home automation)

Thu Dec 29, 2011 7:48 pm

Not sure if this suits the particular form-factor you're after, but if you dont want to deal with relays/soldering..

http://www.adafruit.com/products/268

Simply connect a GPIO to the screw terminal on the powerswitch tail, and you're golden.  Hope that helps!

julianrich
Posts: 12
Joined: Fri Dec 30, 2011 9:32 pm

Re: Controlling a mains power socket switch? (home automation)

Sun Jan 01, 2012 7:11 pm

You need to be very careful mixing mains AC and DC, the most straitforward solution is to use solid state relays, if you are making your own, you should.

1/ Always fuse the AC side to protect the wiring and the device from overload.

2/ Use opto-isolators to seperate DC and AC circuits.

3/ Have a seperate board for AC in a suitable case

4/ Earth the AC board and connected devices.

If in doubt consult a professional before you switch it on.

User avatar
Mezo
Posts: 55
Joined: Sun Jan 01, 2012 9:35 pm

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 10:33 am

There`s nothing wrong with "having a go" a bit of DIY electrickery, whats the worse than can happen? you get a good zap right? wrong.

Speaking as a sparky (ex English) now Aussie sparky with many years under my belt, a small zap can kill you under the right circumstances, but more important than you frying yourself is the risk of burning down your house if you dont do it right, and your going to say "that`s OK its insured" wrong again.

If the insurance company find out your "Billy DIY" home automation man & your half hacked attempt caused the fire there not going to pay out my friends.

So sure do the low voltage side & leave the mains side to someone who is qualified/licensed & knows whats safe, by law there has to be i minimum distance of separation between low voltage & mains voltage.

Mezo.

Wooloomooloo
Posts: 92
Joined: Fri Nov 25, 2011 10:52 am

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 11:20 am

Mezo said:


There`s nothing wrong with "having a go" a bit of DIY electrickery, whats the worse than can happen? you get a good zap right? wrong.

Speaking as a sparky (ex English) now Aussie sparky with many years under my belt, a small zap can kill you under the right circumstances, but more important than you frying yourself is the risk of burning down your house if you dont do it right, and your going to say "that`s OK its insured" wrong again.

If the insurance company find out your "Billy DIY" home automation man & your half hacked attempt caused the fire there not going to pay out my friends.

So sure do the low voltage side & leave the mains side to someone who is qualified/licensed & knows whats safe, by law there has to be i minimum distance of separation between low voltage & mains voltage.

Mezo.



Yup, kids. Mains electricity is notorious for mass-murdering innocent people - it will kill you, your whole family, your dog, your friend, and your friend's dog. Also, it is known to be a form of evil, unpredictable dark magicks no-one really understands, out to get you the second you take your eyes off it. Make sure you watch those treacherous switches and outlets at home closely - better safe than sorry!

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 12:34 pm

There are many ways to do the AC side ranging from 'I want to die' to being a health & safety freak.

There is no quick or easy way for someone in forum to instruct another about basic safe design practice.

Fusing is a good start as is fitting an earth. The devil is in the detail though and fitting an earth stud with an undersized screw which will fall out won't help much. Who would have thought that the fool would do that.....

Playing with AC is not for everyone. Unfortunately the lower the common sense the more likely it is that that person will have a go.

Also there is a huge difference between wiring a prototype on your bench and designing something that is safe, reliable and won't latch on or catch fire. What may work freely convecting on your desk may soon fail in an airing cupboard or boxed or may fail on the next build because component tolerances have not been considered.

I have seen more than a few 'profesional' hardware engineers fail in the task of designing basic electrical safety protection, usually out of sheer arrogance.

There are many products available which will allow safe AC switching using a DC input, many cost <£15. You have to wonder why anyone would design their own.

Borg 1.0
Posts: 35
Joined: Sun Jan 01, 2012 1:02 pm
Contact: Website

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 1:39 pm

There are two ways of controlling a mains load: proportional and digital.

Digital uses a relay/triac to turn on/off the load. It"s called digital because there are only two states - fully on or fully off. It"s dead simple to do, uses only 2-3 components, it"s very robust, but it does stress the hell out of whatever you"re using as the switch.

Proportional control allows the amount of power applied to the load (heater, fan, light bulb, etc) to be varied almost infinitely. This gives you much better control, at the expense of a fairly complicated circuit, as other folks have mentioned - zero crossing to reduce "hash" or interference, and so on.

Regardless of which type you want to use, you need some kind of feedback to tell you when the temperature is correct/too high/too low, and that"s much more difficult to implement on a controller without ADC inputs. I use solid-state temperature sensors exclusively; thermocouples and the like are terribly susceptible to noise, current flow, humidity, and so on. The LM35 series of sensors are fantastic, but they do need an ADC to read the device"s output voltage properly. The alternative (given that, as far as we know, the GPIO support on the RasPi doesn"t include analogue inputs) is a simple op-amp circuit with a "set temp" knob. That will definitely work with the GPIO inputs, easy-peasy.

Gert"s board (again, as far as I know, hint hint ) would be ideal for use as a simple on/off type controller. The circuit needed to drive the relay (mechanical or solid-state) is absolutely trivial, reliable, and safe, so that"s probably the least-worst option.

I design and use proportional 240VAC controllers in my studio, safely and cleanly controlling loads up to 15kW.

As I"ve offered in another thread, I"d be more than happy to whip up some AC controllers for use with the RasPi. These would not only be safe, they"d comply with any electrical certification as well. They would be FAR cheaper than an over-the-counter solution, and more fun as well!

However, since there seems to be quite a bit of interest in using the RasPi in cars as well, it would be interesting to offer a couple of options. For example, what about a "universal" PCB, where one set of components would be added for mains control, and a slightly different set for control of, say, a 12v fridge, or courtesy light, etc?

I"m also thinking about a board with 2,3, or more controllable outputs, so a studio ( in my own case) could be controlled by a single "Pi box", with an appropriate GUI to manage the settings, and so on.

I do apologise if I"m standing on anyone"s toes here, these are just thoughts generated by this really interesting thread...

Questions, comments, and suggestions are most welcome!

Thanks for reading this far!

Paul_ArtCAM
Posts: 2
Joined: Thu Dec 29, 2011 12:09 pm

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 2:01 pm

Its logical to go the USB route....... a USB device with switches/relays for example. USB is universal for input devices, we now need USB output devices for the kids to experiment with.

The software interface would be universal, the hardware can range from DIY to a commercial product that complies with local electrical laws.

-Paul

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 2:48 pm

I would be interested in phase controllers in the KW range.

How cheap is cheap?

The crydom range are not cheap but then they are not too expensive either.

Something with PWM control or SPI control would be more use to the Pi than analogue.

I would imagine that switching noise is why the crydom uses analogue control.

What filtering would you use?

How would you qualify a phase controller for UK use?

spamel
Posts: 196
Joined: Sun Jan 01, 2012 8:43 pm

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 3:04 pm

This is an interesting thread, and the benefits of using a computer to control equipment is pretty obvious. I have heard that there are energy smart products already invented that will allow you to turn lights on in your house, or to start the washing machine whilst you are out,that will be controlled via apps on, say, an iPhone or similar. It is proven technology that needs refining and should come to market easily within the next ten years. Energy efficiency is massive these days and constantly being driven by the energy companies, so it is a good idea to use the RasPi for trying to figure out a way of doing things, things that could be patented and earn the developer some cash!

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 5:30 pm

Yes there are plenty of home energy management systems that the Pi should be able to integrate into and use the AC side of.

I would have thought that commercial systems will be very wide spread well within 5 years.

20% pa rise in energy price n all.........

Mind you I would have expected everyone to have had their free home insulation by now......

A lot of the technology is similar to that developed in the 70s, to control industrial lighting etc. to ease grid load. I expect that there will be patent trolls a plenty but I can remember reading/watching home energy management concepts during the 70s following the last oil crisis so much of this is not new.

Its amazing how much money you can save just by switching it off and so increasingly this technology should take on.

Wooloomooloo
Posts: 92
Joined: Fri Nov 25, 2011 10:52 am

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 6:54 pm

Let's just say it's been "the year of home automation" every year in the last two or three decades pretty much the way it's been "the year of the Linux desktop" every year the last five or so. It's been long enough for the original venerable X10 technology to go out of patent protection (for about a decade now)! It doesn't mean it won't eventually happen, of course, it's just that it's gaining ground way, way slower that people think and the relevant marketing garbage would have you believe. Recently, the tune more or less changed to "the year of the wirelessly-mesh-controlled-everything" (by which they mostly mean some form of ZigBee or sometimes z-wave), but that's taking its time too.

Reasons are various (not the least of which being that HA has never been all that particularly cheap, and it often needed lots of new wiring up until recently), but ultimately there should be a range of wired and wireless gadgets available if one is really interested. Just do a search for "home automation" (and hold on to your wallet tightly…), you should get endless lists of sites like http://www.uk-automation.co.uk, all more than happy to part you with your money in exchange for various switches, dimmers and controllers. How many of them actually have any Linux support is a different matter altogether.

Ultimately, if one only wants to control that one or two sockets, the cheapest solution is invariably the supemarket-dwelling variety of the cheap "wireless remote controlled socket" blister set – which will certainly insulate you thoroughly from any mains if you hack its remote's buttons for your own use, but might be so "cost-consciously" produced in the finest factories on some boat as to be barely – if at all – safer than a properly executed DIY version by someone who knows their stuff – at least you'd know you used an actual fuse instead of, say, a wire short on the PCB. They might be more legal-nitpicker-friendly though (or not, which you'll only find out when it's too late).

Tomo2k
Posts: 127
Joined: Mon Dec 19, 2011 10:00 pm

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 9:29 pm

The supermarket-sold ones will be proper CE marked, because it'll cost Tesco et al too much if they aren't up to spec.

- The importer is legally liable to ensure it meets CE.

eBay, less so, as eBay don't care and the reseller is effectively untraceable.

- Seen quite a few "China Export" devices sold on eBay that are very scary.

Aside from that, if an accident occurs, the insurer is going to pay out if it was a supermarket-bought device that turned out to be dangerous*.

- Then there will be a recall and replacement scheme, thus you're even less likely to be the poor sod who gets to find out about the dangerous design.

If it was a home built device they may quibble somewhat.

* (and then maybe go after the supermarket to recover the costs)

gtzav
Posts: 1
Joined: Tue Jan 03, 2012 10:03 pm

Re: Controlling a mains power socket switch? (home automation)

Tue Jan 03, 2012 10:20 pm

This one seems interesting
http://www.active-robots.com/s.....0-0-4.html

And has Linux drivers : http://www.phidgets.com/drivers.php

Anyone used them before??

Return to “Other projects”