Detect mains current (are the lights on???)

Hi,

I have been researching this for about a month now but haven't found the "best" solution.
So I want to automate all the lights in my old house without altering the existing electric installation.
This will be achieved by connecting an Adruino next to *every switch.
As can be seen from the attachment the most common situation I have is a two way switch.
The Line wire runs to the first switch, two wires run from the first to the second switch, a wire runs from the second switch to the lamp(s), then then to the Neutral.
As there are over 20 such switches, running new wires is not an option I want to explore :stuck_out_tongue: .
Instead I want to connect a DPDT latching Relay (RT424A05) wired for phase reversal between the two switches.
This way i will be able to control the lights remotely without loosing any of the existing "functionality".
This part I have all figured out.

The problem I am having is how do I know if the lights are on or off (and inform OpenHab)?
So far I have read about through hole current senors and hall effect current censors.
But those seem fairly complicated for my purposes (sine wave etc...).
One of my main concerns is that I will have to detect very small currents (single Led bulb) about 20mAmps to about 5Amps (just to be on the safe side).
Another concern is the final circuit-board size, since ideally I would like to hide it behind the switch.
I don't really care about the measurement, just the detection.
Simpler solutions like a relay in series to the load is out of the question for obvious reasons.
So maybe there is a better and simpler option I haven't considered?
Basically how can I tell if the lights are on or off?!

Thanks in advance for your input!
(I hope I posted in the right section)

lights.png

There are a few different [u]home automation[/u] protocols. You replace switches/dimmers and/or outlets with remote-controllable versions. The switches/dimmers can be operated locally-manually or remotely-automatically.

There are quite a few "engineering challenges" to building something that fits into a regular electrical box so I recommend you buy the switches & dimmers even if you want to build the controller yourself.

You are absolutely right, but where is the fun in that :grinning: ?
I not looking for an easy solution, I was more thinking in the direction of designing my own PCB and stuff, winter is coming and I need something to do. Failure is an option after all.

Depending on how the lighting curcuit is wired , will you have a live connection at the switch when the light is on? You could then run an opto isolator from that to tell you when the light is actually on .

Hi,
First off, here is your picture so people do not have to download it.
lights.png

Learnt that little jem from here.
Simple guide to inserting pictures

So i have questions that you could answer before i can offer sujestions.

-Why do you want to control the lights?
Eg. Did you have an anoying sister who would walk from one end of the house to the other and leave every light on? I did.

-Did you realize that with this setup your light switches will operate in reverse? Eg. Up is on and down is off, then up is off and down is on.

-Do you realize that the relay will be on and drawing power for a considerable period of time?

-Do you want to know when the light is on or when the light is turned on. Eg. Detect the actual light or know when there is power going to the light?

-Do the lights have to work as normal in the event of failure of the circuitboard? Eg. Can we make the board turn the light on/off instead of the switch considering you are already changing the house wireing at the switch.

Give some idea about what your trying to do, leave the technical bits out just explain what you want to happen in the house.
There maybe other alternatives you have missed.

Daz

Kanivaloss:
So I want to automate all the lights in my old house without altering the existing electric installation.

good start

Kanivaloss:
I want to connect a DPDT latching Relay (RT424A05) wired for phase reversal between the two switches.
This way i will be able to control the lights remotely without loosing any of the existing "functionality"..

So, the goal is to alter the existing electric installation then. got it.

First off, you need to lay out how you can wire a DPDT switch to act like a 4-way switch. a dotted circle is not a schematic.

Can you even to that ?

Second, as part of your altering the existing installation, you will need to install new hardware. The DPDT switch you mentioned, the Arduino, a separate power source will need to be run as what you show does not provide power.

Or you have to figure out how to use the power that is there, but that is switched.

Then, you need to make it safe, say, while you are altering the existing installation, you should install a large enough electrical box to house all of these bits AND in the US, by code, they have to be separated by a physical barrier.

As for monitoring power, there are lots of ways. But since the place where you want to alter the existing installation is between switched loads, then you have to have two sensors -or- you have to use the other line.

I would replace one switch with a 4-way, manual switch and then put in your DPDT relay out side of the switched legs and your CT now only has to see one line.

Since you physically have to cut into the walls to alter the existing installation to add a new switch, you may be better off replacing a single wide switch box with a double wide that way, you do not have to cut holes in your building other places.

What you did not mention is if you have a 3-D printer and want to make it even more inconspicuous.

hammy:
You could then run an opto isolator from that to tell you when the light is actually on .

An opto isolator was my first choice but from what I know you shouldn't put a high load (up to 5A) in series with it right? It wouldn't be able to handle the high current drawn through it right?

Daz1712:
First off, here is your picture so people do not have to download it.

Thanks :wink:

Daz1712:
-Why do you want to control the lights?

Exactly as you pointed out, "people" never seem to understand that I want corridor&garden lights on and all other lights off. So I want to be able to monitor and switch them at specific hours according to rules that I will set up later.

Daz1712:
-Did you realize that with this setup your light switches will operate in reverse? Eg. Up is on and down is off, then up is off and down is on.

Well with two way switches this is that case anyway (I don't mind).

Daz1712:
-Do you realize that the relay will be on and drawing power for a considerable period of time?

For that purpose I will use a latching relay that draws power only when switching states.

Daz1712:
-Do you want to know when the light is on or when the light is turned on. Eg. Detect the actual light or know when there is power going to the light?

I was considering just knowing when there is power going to the light since that way I could detect switching events in software anyway.

Daz1712:
-Do the lights have to work as normal in the event of failure of the circuitboard?

Yes, the hole project should be "a fun little" addition to was already exist without causing any problems if it fails.

dave-in-nj:
So, the goal is to alter the existing electric installation then. got it.

Well, yes, of course what I mean is I don't want to rewire the entire house :stuck_out_tongue:

dave-in-nj:
First off, you need to lay out how you can wire a DPDT switch to act like a 4-way switch. a dotted circle is not a schematic.

Sorry, was't at my PC at the time of writing.
This is what I had in mind. (I also have some schematics for the PCB I drew in Eagle but they are more of a visualization of my ideas that an actually useful schematic)

dave-in-nj:
Second, as part of your altering the existing installation, you will need to install new hardware. The DPDT switch you mentioned, the Arduino, a separate power source will need to be run as what you show does not provide power.

Or you have to figure out how to use the power that is there, but that is switched.

Then, you need to make it safe, say, while you are altering the existing installation, you should install a large enough electrical box to house all of these bits AND in the US, by code, they have to be separated by a physical barrier.

All of that I have considered. I will need to run a neutral wire to the first switch of course.
Power Supply, Arduino, Relay etc.. This will all be installed next to the switch (or behind) that the Line goes to.
Once I am sure what the end project will look like (several prototypes later) this will be taken into consideration. I live in Greece so I'll have to research local regulations.

dave-in-nj:
As for monitoring power, there are lots of ways. But since the place where you want to alter the existing installation is between switched loads, then you have to have two sensors -or- you have to use the other line.

I would replace one switch with a 4-way, manual switch and then put in your DPDT relay out side of the switched legs and your CT now only has to see one line.

That is actually a good idea, I'll have to look if I can find matching 4-way switches.
On the other hand, wouldn't it be possible to run both wires through the CT since by default only one of them will be carrying the current each time? Using the other line is also an option I have considered.

dave-in-nj:
What you did not mention is if you have a 3-D printer and want to make it even more inconspicuous.

I have access to one, but as mentioned before, it all depends on how the final prototype is gonna look.

wouldn't it be possible to run both wires through the CT since by default only one of them will be carrying the current each time? Using the other line is also an option I have considered.

I think you are correct.

since it would only see current when there is a load, it would not matter if there are other wires in the hole.

since you want a permanent installation, you can use the very low cost CT's that will fit inside of a small area

if the looks of the switch is not important, buy a dimmer switch and gut it.
get a simple toggle switch, that is ON-ON and replace the dimmer knob.
use that box and put in SSR, silicon relays. they require power, but without power, you have no lights anyway.
by far the least amount of work in the house wiring.

This recent thread was pretty idiotic but actually had a couple of ideas that address the same thing - non-invasive current sensing.

Hello Kanivaloss.

I have a different suggestion for detecting that there is power connected to the light. I note from reading your various comments that you seem to be up for experimenting so...

I once built a device to detect mains power was applied to a wire using a CMOS 40106 hex Schmitt trigger. To one input I connected a wire which I wrapped around the mains wire I wanted to detect the power on. Note that I did not connect to the mains, just wrapped an insulated wire round it. This worked because the CMOS chips have very high input impedances and the wire connected to the input picked up enough electric field from the mains wire it was wrapped around to make a detectable signal when the mains was on. I think (I no longer have the circuit) I used a 10M ohm pull up resistor to make sure the input was high when there was no mains to detect. I would expect that with a bit of experimenting you should be able to get this to work with an Arduino input. Note that this detects mains voltage on a wire, it does not detect if any current is flowing. However, if you can get it to work it is dead cheap as you just need a spare input, maybe 10cm of insulated wire, and a 10M ohm resistor (or try the internal pull ups).

If you do get this to work I'd be interested to know.

@Kanivaloss, Did you find solution for that problem? How did you detect if lamp is on?

Interesting ideas. i say skip the relays and use a triac to control the light then go a step further and install voice activation modules at every light. that way with 7 active voice activated channels you can have a different resistance that correlates to a different light intensity which acts as a dimmer switch.
say -
chan 1 light on 100 %
chan 2 light 75 %
chan 3 light 50 %
chan 4 light 25 %
chan 5 light off
you could then attach small wireless modules to transmit when they are on to notify the main panel there is a light on in the house which is then connected to your cell most likely. you could add an override code that will shut off the light.

you could even build a PIR sensor that detects motion turning on. when no motion is detected for five or 10 minutes it automatically shuts off. all of these choices are small and compact.

the sky is the limit dude, the only obstacle is your imagination.
one a side note, make your sister pay 3/4's of the electric bill, problem solved.