Power from light switch

Dear all,

I've been thinking of starting a new project, which involves replacing my standard wall light switch into a smart switch with wifi connection. I know that it exists, such as the Sonoff touch switches. I would like to make my own with for instance a wifi- or RF-connection. The thing is, however, I cannot figure out how to power the Arduino when the light is off, as there is then no closed circuit?
I've been googling around quite a bit, but cannot find any useful schematics. I was wondering if any of you could explain the working principle of this?

Kind regards,

Guido

In the case of the Sonoff, check out this page. You will see that you need a live in and a switched live out - plus a neutral wire. That means that many people would have to rewire their houses to retro-fit those switches, since they only have live in and live out at the switch (ignoring earth).
There are other methods of doing it, but they would require passing a small current through the lamp at all times and will struggle with lamps that won't do that in a suitable fashion, eg. non-dimmables like compact fluorescent lamps.

Anyway, messing with home wiring is not a suitable project for the clueless and you won't have the resources to test and qualify your device. It may be illegal in your country. It may invalidate your home insurance. You may kill someone. You may burn your home down. It's not worth it. Pick a project you can control and keep an eye on.

If you have hot and neutral (which some switch boxes do) it can be done.

The tricky part without the "3rd wire" is that when the switch is on there is no voltage across the switch.* But it can be done ([u]example[/u]). Somehow, it "steals" a little power even when the lamp is on.

There are a few popular home automaton protocols. Most are not Wi-Fi but you can usually get a Wi-Fi or network/Internet "hub" so you can control everything with a smart phone or computer.

There are a lot of "engineering challenges" building something like this that fits into a switch box, operates locally or remotely, and looks good. And I doubt you can build it for the price you can buy it. The [u]X-10 Switch[/u] is only $23 USD (and I think it works with 2-wires).

...Usually there's a ground and I've use ground instead of neutral but that's an electrical code violation!!!

  • If you've ever had an illuminated light switch, you'll notice it's only illuminated when the switch is off. There is a small light in parallel with the switch (in series with the load). When the switch is off you have a voltage divider with almost all of the voltage dropped across the small, high-resistance, light in the switch. When the switch the light inside the switch is "shorted out" and all of the voltage goes to the load. The illumination will also turn-off if the "main" light bulb burns-out because you have an open circuit and no current can flow.

Guidotillema, I share the concerns of arduarn over safety and I am inclined to think that if you need to ask about this then you don't know enough about house wiring and mains electricity to be messing with it.

However, I have a suggestion that might help, based on what I have done in my own house. I had a sun room built a few years ago, I did the electrical wiring and had it properly tested and certified. However, for the lighting I didn't terminate the cables on lights, I terminated them on mains sockets in the loft. The lights I installed are a combination of RGB LED tape around the edges for colour and 8 white, low voltage LED lamps in the ceiling for general lighting. As these are all low voltage they are safe to play with. The controller for them is one I built around a PIC and Nextion display and feeds from the mains sockets controlled by the light switches. Thus I have a properly certified mains installation and low voltage lighting I can play with.

If you are going to do anything like this do consider if you are likely to ever sell the house, a custom built lighting system might be great for you but might put a buyer off. In my case I am quite happy where I am and don't have any thoughts about moving.

guidotillema:
Dear all,

I've been thinking of starting a new project, which involves replacing my standard wall light switch into a smart switch with wifi connection. I know that it exists, such as the Sonoff touch switches. I would like to make my own with for instance a wifi- or RF-connection. The thing is, however, I cannot figure out how to power the Arduino when the light is off, as there is then no closed circuit?

Wrong way round - if the switch is on, there is no difference in potential across the switch to power
anything. When the switch is off there's full mains voltage available (although if you draw too
much current the light may come on dimly).

The trick is to not switch on for a 100% duty cycle, but only 95% or so, then you can use a capacitive
dropper supply across the switch terminals whether or not the switch is notionally on.

Note that mains circuitry like this is not a beginners area - the risk of electricution may be solvable by
full isolation and using an RF connection, but the risk of fire is not so easily defeated, which is why mains
equipment has to be type approved and its safety tested rigorously.

The smart switches which operate without a neutral connection usually do it by never switching the light on fully. When the light is 99% on, you can't tell the difference to 100% but it's got enough energy leftover in that 1% to power itself.