sylvan
Posts: 118
Joined: Sun Nov 27, 2011 8:39 pm

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

Tue Dec 20, 2011 11:06 pm

Quote from Gert van Loo on December 19, 2011, 12:56
Catch 22... :-(

Definitely. I'm sorry the world is this way. :(

The folks at ComputerChristmas have published many boards and circuits.

sylvan
Posts: 118
Joined: Sun Nov 27, 2011 8:39 pm

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

Tue Dec 20, 2011 11:07 pm

Quote from bradburts on December 19, 2011, 17:18
That's why I like software, less laws to follow :)


At least today...

Every time something like the recent Airbus finding hits the news, the day of software regulation comes a bit closer.

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

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

Tue Dec 20, 2011 11:21 pm

Shhhh!
Stop giving people ideas dammit!

Its never software anyway, its always a stray cosmic ray http://en.wikipedia.org/wiki/D.....ess_memory
(towards the bottom)

That's my proffesional opinion & I am sticking to it.

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

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

Tue Dec 20, 2011 11:21 pm

Shhhh!
Stop giving people ideas dammit!

Its never software anyway, its always a stray cosmic ray http://en.wikipedia.org/wiki/D.....ess_memory
(towards the bottom)

That's my proffesional opinion & I am sticking to it.

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

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

Tue Dec 20, 2011 11:40 pm

Quote from Gert van Loo on December 19, 2011, 12:56
My biggest worry:
If anybody dies using the circuit I will feel very bad. Also it is rather a risk in the current climate of 'sue the pants of everybody' so I am reluctant to give out the board.
On the one hand, you being responsible for whatever happens to someone using your circuit (especially with a fat explicit disclaimer) is, with all due respect, in the words of the great Penn & Teller - bullshit. Anyone not realizing that they and they alone are responsible for whatever they download from wherever (and then build) is straight on cuckoo - anyway, schematics can also be posted anonymously, if need be for peace of mind.

On the other hand, the above is exactly why you should not post said schematic - if one cannot figure out how to control a simple mains switch / relay by themselves, then they have a helluva lot to learn before they have any business attempting to actually do it, especially under independent 24/7 hardware control. Which does not exclude of course using something purposefully built for that aim, bought from a store, if such a thing exists.

That being said, I'm under the impression that WiFi-based thermostats start appearing in stores (or at least on the net) - one of those might do the trick, albeit they seem to be rather more complicated than a simple controllable relay. And of course, one could always try to do something with the ole' X10 et al., if any of those devices are still around (and meant for 220V) - no idea about that.

Lakes
Posts: 267
Joined: Wed Aug 24, 2011 2:17 pm

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

Wed Dec 21, 2011 12:00 pm

Even though I`m experienced at dealing with mains voltage, I would still go with the "hacking a wireless mains switch" or the X10 (more expensive?) solution, as the interface is totally isolated and the mains part already comes in a nice plug-in box. :)

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

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

Wed Dec 21, 2011 1:26 pm

Agreed, its a simple cost benefit question.

Cost: few extra pounds
Benefit: better chance of staying alive

There are no old bold electrical engineers as they say.
And remember kids keep your left hand in your pocket, but not touching your willy - you don't want that as the grounding path believe me ;)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

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

Wed Dec 21, 2011 2:42 pm

My 2 cent, initial inclination is to not make a board at the get go. Even with disclaimers galore some mom who wasn't smart enough to teach little Johnny not to touch the wires will come after you if it has your mark of approval. Something like that can be very detrimental to anything company/organization/foundation in it's "infancy". But if you don't make the board and some kid zaps himself up to high heaven then you have a solid "he was using the board in an manner outside its official parameters" defense. You are seriously kindhearted for worrying about how people might hurt themselves using faulty wiring because you didn't release a board though ;)
Dear forum: Play nice ;-)

Metz
Posts: 37
Joined: Mon Nov 28, 2011 3:38 pm

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

Thu Dec 22, 2011 2:34 pm

FYI, just been into Maplins, and they have a 4-way gang with 4 way remote controller for £13. They also have a box of 3 seperate wall-plugs with remote for £15. Seems like a good starting point to me. Not as sexy as doing it yourself (fnar), but certainly easier and safer.

JaffaBoy
Posts: 4
Joined: Tue Aug 30, 2011 7:16 pm

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

Fri Dec 23, 2011 8:44 am

Thanks for info about Maplins remote controller

Looking online you can save yourself even more money by buying the remote+1 plug(£4.99) and 2 more plugs (£3.99 each) = £13.97 ...although just noticed that the single plugs are out of stock and this price is only until... tomorrow :(

Does anyone know if it's possible to control more than 4 plugs (the remote in the picture at Maplins has a big 433MHz on it) but was wondering if you can alter the frequency on the controller and plugs to enable 2 to be used?

[later] Ok I can semi answer my own question by reading the site properly... you can control more than 4 plugs by setting them to the same channel, i.e. you can switch on/off 2 or more plugs with a single switch. But what about controlling more than 4 individually?

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

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

Sat Dec 24, 2011 7:32 pm

fordp said:



Quote from kme on November 28, 2011, 18:46


Quote from celerity on November 28, 2011, 18:08
We use 240V here in the UK, although I'm sure that doesn't alter what you're saying.


Well, actually you don't. You run 230V and have done that for 10-15 years when EU harmonized UK 240V with continental Europe's 220V and everything ended up being 230V. It really didn't matter much as the switch was within the normal voltage fluctuation anyway. But it did limit some confusion. EU actually does do make sense some times.


Most peoples mains voltage in the UK has not changed for the last 50 years. We are now nominally 230V and were nominally 240V but there is a wide tolerance on the voltage supplied so most transformers were not changed when we switched to 230V AC Nominal.

Not a lot of people know that ;)



The standard is 230VAC RMS +10% -5%.

So max. permitted voltage is 253VAC, minimum is 218.5VAC

In most of the UK you will actually have 240 to 248VAC.

While some new builds do have 230VAC, the substation transformer is usually tapped 'high' so that the electric company don't have to come back and re-tap the transformer as the load on it increases - new houses/offices built etc.

As to home automation:

Don't use solid-state-switching for this, as there are a lot of loads that can be damaged by them. You want to use physical relays, as those cannot damage the load.

For those wanting to make a home-built system:

NEVER use PCB-mount relays for mains switching. The vast majority of the 'kits' don't meet EU regs for clearance, and even those that do are extremely difficult to safely enclose - remember that both sides of the PCB are 'live'.

Buy 12 or 24V DC coil DIN-rail mount relays to switch the actual mains, and use the PCB-mount relays or solid-state-switches as 'pilots' to switch the mains relays.

- For bonus points, 'latching' or 'pulse' relays can be used, as those don't draw any current in either position - they only require power to switch. Most of these turn on if current is put in one direction and off in the other.

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

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

Sun Dec 25, 2011 11:10 am

One of the easiest ways to safely control AC Voltage with a computer is to buy a couple of remote control plug sockets from a supermarket (typically £5-£10). Then take the remote and replace the remote buttons with opto-isolators. The opto's can be switched on or off in the same way an LED works (an opto-isolator is essentially an integrated LED and a Light sensor at its most basic level - have a look on wikipedia, there’s a good explanation on there!). In order to turn the remote power socket on simply send activate the Opto on the sockets 'on' switch a couple of times for around a 1 second interval, and to turn off simply activate the opto on the off button for a couple of one second intervals (I always make a habit of pressing the button a couple of times to guarantee the signal was sent!).

So essentially, if you can turn an LED on or off (if the board natively has some digital outputs - im not sure it does) or otherwise use an Arduino board connected via USB to the ARM Board (Around £15-20) and is also very very easy to program with lots of good examples included!

As a bonus the Raspberry Board would provide an excellent Interface/GUI/Web Server for controlling the Arduino board (look up arduino.cc) .

I hope this helps! Once the Raspberry has been released and I have bought one I will put together a how-to on setting up the web controlled remote power hack! (already using the remote hack and an additional solid state relay and temp sensor for home power/heating control with Android phone/web server)

Hope this helps!

Regards,

Ian

Ps. Feel free to google for the Opto-isolator wall wart hack - there’s plenty of examples on the net! best of all your only dealing with the remotes low power and don’t need to touch AC!

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

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

Sun Dec 25, 2011 11:24 am

Ps. Forgot to mention an Optoisolator is like a small On/Off switch which has the additional benefit of isolating one circuit from another! (solid state relays typically consist of an optoisolator on the low voltage side and a TRIAC base circuit on the Mains side.

If you must use relays, go for solid state relays, they do cost more however mechanical relays are much more prone to failure and are horribly bouncy for power control (bounce means its not a clean On/Off and can cause surges/spikes as the current can arc across the contacts) plus for the time/cost of the additional components to protect the low voltage side of the circuit with a mechanical relay you may as well buy an SSR for simplicity.

However if you have no experience of dealing with mains voltage/Current go for the remote control socket remote control modification!  AC power can be lethal and if you don’t understand the basics avoid until you can find someone with good professional experience/knowledge and the correct tools to help you. Plus I'm sure the local fire authority would appreciate it if nothing else!

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

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

Sun Dec 25, 2011 11:34 am

Hi! Really got to ask, I have a full data-center HVAC power control system based on Solid state relays plus the home aircon system/boiler is switched by them (as supplied by the manuf)!… err, why are they a problem? given the bounce and arc from mechanical relays?


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

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

Sun Dec 25, 2011 12:51 pm

I would not say that SSRs are a problem.

They dump a bit of power though.

Its swings and roundabouts, mechanical wear and tear vrs heating.

Most home plug solutions controllers are relays for this reason.

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

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

Sun Dec 25, 2011 12:56 pm

Oh, and make sure you get an isolated SSR, that or properly insulate, which is harder if you have a heatsink. And you will need a heatsink cause if the SSR overheats it will break down and latch on.

Both can be a real problem!

So relay modules can be easier to make safe but there is no reason why you cannot make SSRs safe.

hansp
Posts: 6
Joined: Sun Aug 28, 2011 1:26 pm

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

Sun Dec 25, 2011 1:12 pm

JaffaBoy said:


Does anyone know if it's possible to control more than 4 plugs (the remote in the picture at Maplins has a big 433MHz on it) but was wondering if you can alter the frequency on the controller and plugs to enable 2 to be used?

[later] Ok I can semi answer my own question by reading the site properly... you can control more than 4 plugs by setting them to the same channel, i.e. you can switch on/off 2 or more plugs with a single switch. But what about controlling more than 4 individually?


Usually these have a rotary switches to select one of 4 "groups", the controller and plugs must be set to the same group, each group can have up to 4 switched circuits.

By opening the remote you can attach your Arduino/Raspi send the correct signals to control all 16 circuits.

Take care if your neigbours have one of these otherwise you might end up controlling thier appliances and vice-versa!

There are lots of web pages on this topic, here are just a couple:

http://www.sconemad.com/decons.....t/article/

http://makeprojects.com/pdf/ma.....453_en.pdf

I made myself an SSR controlled power strip. The control voltage is simply the output from my laptop USB port. Now when I start my laptop it uses its battery to power on, once the USB is poweed the SSR turns on the power strip which in turn powers my laptop, screen etc. Powering the laptop off turns everything off when the USB is turned off.

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

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

Sun Dec 25, 2011 1:35 pm

Some great links and projects there.

Anyone needing to do AC, but without the experience, should consider this approach.

re-uk have a similar project but use a digital timer. Its a wired solution, cuts out the RF link. Having said that isloating the DC and AC using the RF link is an the most AC careful solution I can think of!

Course you know that Bye Bye standbye sell a product which does the same for $10.

But that may not be the point!

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

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

Sun Dec 25, 2011 2:04 pm

Thanks for the info on SSR's, Only reason I asked is I bought a 25A SSR to control our boiler heating switch with a Dallas 1-wire Thermistor on Arduino to act as a web-based/automatic home heating controller and was a bit concerned there was an issue there lol!

Once the Raspberry is released and we've (the users!) had a bit of time to work out setting up Apache or Tomcat (web server) and the arduino USB links anyone interested in forming an open-source domotics (home automation) project? i'm currently using arduino and a Friendly-arm board to do it however this looks to be a much much more elegant and straight-forward solution! (by the way for an enclusure I housed my setup in a micro-itx pc case using the 5V ancil feeds from the PSU to power the Arduino... anyone know what the power requirement is for the Raspberry?)

Merry christmas!

Ian

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

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

Sun Dec 25, 2011 3:52 pm

@Ian

Yes I am interested. I am software for the most part.

The Pi needs 5V DC, standard USB plug PSU will do it @1 or 2 Amps.

Would be easy to put Apache2 on the Pi and control some devices.

Keeping the AC safe and legal is the tricky part.

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

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

Sun Dec 25, 2011 5:38 pm

Thanks Bradburts!

For the AC I would most probably use RF to run some off the shelf remote light sockets, eg, make a simple circuit to emulate the remote electronics. I bought a few from ASDA (something like £5 for two socket adaptors with the remote) and just wired the arduino to the remote to emulate button presses, however for something a bit more elegant it should'nt be too tricky to build the RF circuit from scratch. Anyhow, will get a Raspberry ordered when its released and have a play around then will post back here, Hopefully ARM6 will be fast enough to host the HTTP side and deal with the USB output via CGI/Perl etc.

I did give some thought to making some wall sockets with SSR's and Xbee modules but worked out to be too expensive + the tooling, CE testing etc would cost a fortune if it where to be sold commercially!

Cheers,

Ian

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

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

Sun Dec 25, 2011 6:37 pm

Ianw said:


If you must use relays, go for solid state relays, they do cost more however mechanical relays are much more prone to failure and are horribly bouncy for power control (bounce means its not a clean On/Off and can cause surges/spikes as the current can arc across the contacts) plus for the time/cost of the additional components to protect the low voltage side of the circuit with a mechanical relay you may as well buy an SSR for simplicity.


Relays are horribly bouncy? Utter rubbish!

If that were true then the mains switch on your switched socket, and the lightswitch on the wall would do exactly the same.

I agree that the "10A 250V" PCB-mount relays are unsuitable – I have seen several installations try to use these to switch the load and they do indeed fail quite rapidly.

However this is because they are designed for purely resistive loads (eg as pilot relays to proper mains power control) and are not intended for mains power control.

Proper mains power control relays do not do this. They tend to be rated at >10,000 operations (15 years at twice a day).

My day job is power control – I work with these things every day.

SSRs really can damage certain types of load – energy-saving CFLs and LED fittings are particularly likely to fail, as some designs of PSU will definitely die. Key reasons are that the current is discontinuous, and they have several bad failure modes (eg half-on).

They are well suited to resistive loads and some kinds of inductive load – eg heaters, tungsten lighting, most AC electric motors.

Simple rule-of-thumb is if it doesn't have any electronics inside, it'll be fine on an SSR.

They generally dissipate approx. 2%-5% of the connected load, depending.

Best home-built method (aside from adapting a remote for an existing system) is a transistor or MOSFET to drive the 12VDC coil of a DIN-rail mount mains relay. Gertboard will do that.

- The ones that draw no current at all in either position are even better (approx. £15-25 for a 16A rated unit from RS.) Again, these can be driven by Gertboard though require a bit more logic as you obviously don't know if the relay is on or off when the Raspberry boots.

This way you put the mains stuff into a separate box, and all the DIN-rail mount 12/24VDC coil mains relays have all the necessary protection (both safety and electrical) built-in – including proper separation of LV and ELV.

(DIN-rail mount mains relays are relatively safe even with no enclosure, though I would not recommend using them that way.)

Finally, the caveats:


Don't do this unless you are competent to work with LV electrical systems.
In the UK domestic situation, Part P complicates things further.
It is safer, and almost certainly easier to adapt the remote control of an off-the-shelf plug-in power control system.

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

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

Sun Dec 25, 2011 7:08 pm

@Tomo2K

Good post.

IDNK that SSRs were not good for CFLs, how does that work (or not work)?

Your job sounds interesting, do you design these sort of products at a company?

@Ian

The ARM will be more than fine. HTTP is just text really.

What's your use case, what you want to achieve, what are you inovating (or what are you trying to learn through re-inventing the wheel).

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

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

Sun Dec 25, 2011 8:06 pm

Basically my present set-up uses an embedded micro controller to supply 5v triggers to a bank of opto-isolators interfacing the on/off buttons on the remote of an off-the-shelf remote control power socket.

The Micro controller listens for triggers on a serial connection and then triggers the relevant opto-isolator on the remote in order to turn a socket on and off.

Presently I am using Tomcat and some C CGI scripts on a friendlyARM ARM7 Stamp in order to send the codes to the micro controller based on a web form interaction .

Essentially I would like to use raspberry with Apache and some CGI/Perl to trigger GPIO events (send +5v to up to 16 opto-isolators in the same way that the current AMTEL 328 AVR chip does on its I/O pins)

As a next stage it would be nice to see if it would be possible to enable drivers to read 'One wire' components such as thermistors etc in order to trigger temperature driven events etc

Basically, i'll wait until raspberry gets released, take a look at the *nix distros it can handle and take a look at how easy it is to compile the drivers for etc.

Will wait and see what happens :D

p.s. below is a very basic Arduino and C# (non web server – just uses forms) – Its a bit hacked out as I slapped it together for some testing, but whats happening here is the C# app is running on a pc and displays several buttons all of which trigger a relay connected to the Arduino board. Basically for the Raspberry I was looking at doing something similar using C++ and GPIO running as a CGI proggy on a web server, eg a web page Button1 triggers Lighton1.CGI which sends a GPIO trigger to a relay/opto etc

Be warned in advance! the code below is experimental and just posted here to clarify a mechanism for communicating between a PC and an embedded device using serial commands – essentially setting an example for Bradburts on where I'm coming from! feel free to use it however I cant guarantee it works properly or is fit for any purpose!

Arduino code: Listens for code on its serial port then triggers +5v according to whichever number it recieves


void setup()  
{                

  pinMode(12, OUTPUT); //Relay 1
  pinMode(11, OUTPUT); //Relay 2
  pinMode(10, OUTPUT); //Relay 3
  pinMode(9, OUTPUT);  //Relay 4
  pinMode(8, OUTPUT);  //Relay 5
  pinMode(7, OUTPUT);  //Relay 6
  pinMode(6, OUTPUT);  //Relay 7
  pinMode(5, OUTPUT);  //Relay 8
 
  Serial.begin(9600);  //Serial Baud Rate
}

void loop()                    
{
  if(Serial.available()) //Check to see if Serial is up
  {
    digitalWrite(2,HIGH);

    int c = Serial.read();

    if (c == '2') // if  "2" is recieved on the serial port do this:
    {
      digitalWrite(11,HIGH); // sends 5v to pin 11 to power opto on remote
      digitalWrite(12,LOW); //removes 5v from pin 12

      delay (800); // waits 0.8 seconds then repeats the command to ensure signal sent

      digitalWrite(12,HIGH);
    digitalWrite(11,HIGH);
    }

    else if (c == '1')
    {
      digitalWrite(12,HIGH);
      digitalWrite(11,LOW);

      delay (800);

      digitalWrite(11,HIGH);
      digitalWrite(12,HIGH);

    }
  }
}

C# 2010 Code – Sends a serial command to the arduino depending on action/trigger from a form (this example was put together to demonstrate the Microsoft Kinect SDK Mouse control triggering hardware so its a bit…. basic :-p + could have used an array but hey… lol) (moon laser = desk lamp :-p…thought it would be more fun to call it a moon laser!))

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;

namespace SerialCommunication
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
            serialPort1.PortName = "COM3";
            serialPort1.BaudRate = 9600;        
            serialPort1.Open();

        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (serialPort1.IsOpen) serialPort1.Close();
        }

        private void one_on(object sender, EventArgs e) //Assigned to a button event on the form – eg mouse enter/exit
        {             
            serialPort1.Write("1"); //sends "1" along the serial connection to the Board

        }

        private void two_on(object sender, EventArgs e)
        {
            serialPort1.Write("12");

        }

        private void thee_on(object sender, EventArgs e)
        {
            serialPort1.Write("13");

        }

        private void four_on(object sender, EventArgs e)
        {
            serialPort1.Write("14");

        }

        private void five_on(object sender, EventArgs e)
        {
            serialPort1.Write("15");

        }

        private void six_on(object sender, EventArgs e)
        {
            serialPort1.Write("16");

        }

        private void seven_on(object sender, EventArgs e)
        {
            serialPort1.Write("17");

        }

        private void eight_on(object sender, EventArgs e)
        {
            serialPort1.Write("18");

        }

        private void all_on(object sender, EventArgs e)
        {
            serialPort1.Write("2");
            Allon.Text = ("");
            Alloff.Text = ("MOON DESTROYED – TURN OFF");

        }

        private void all_off(object sender, EventArgs e)
        {
            serialPort1.Write("a1");
            Allon.Text = ("MOON LASER OFF – POWER ON");
            Alloff.Text = ("");

        }

        private void one_off(object sender, EventArgs e)
        {
            serialPort1.Write("21");
        }

        private void two_off(object sender, EventArgs e)
        {
            serialPort1.Write("22");
        }

        private void three_off(object sender, EventArgs e)
        {
            serialPort1.Write("23");
        }

        private void four_off(object sender, EventArgs e)
        {
            serialPort1.Write("24");
        }

        private void five_off(object sender, EventArgs e)
        {
            serialPort1.Write("25");
        }

        private void six_off(object sender, EventArgs e)
        {
            serialPort1.Write("26");
        }

        private void seven_off(object sender, EventArgs e)
        {
            serialPort1.Write("27");
        }

        private void eight_off(object sender, EventArgs e)
        {
            serialPort1.Write("28");
        }

    }
}

Anyhow! once I have some code for raspberry hardware control/web interface put together will post it up here! Looking forward to the Raspberry as it means less harware/power consumption and looks ideal for a one-stop domotics controller!

p.s. Thanks for the info Tomo! its always good to know!

Cheers,

Ian

Return to “Other projects”