tl;dr Can you, and if so how, power a Core using the wires from a light switch?
My first “big” project with the Core is a proximity light switch, eventually scaling to a door control (for those scifi fans, think the door controls in Stargate Atlantis - yay nerdism). Anyway, the idea is to use a Sharp IR proximity sensor to act as the virtual switch. When an object is detected below a certain threshold, the Core publishes an event which is processed by a python or node.js server. The server then makes a POST request to a second Core, instructing it to turn on and set the color of a NeoPixel strip. At the moment, a simple webpage is acting as the server to process the event.
This proximity light switch is effectively going to replace the current physical light switch. As such, I’d like to mount the switch where the current switch is located, and if possible, power the core using the wires in the wall. Would the Relay Shield work for this application, to step down the voltage, or is there a better solution.
Thanks for the help! Once the project is finished (hopefully this weekend), I’ll be posting it all on github.
The relay shield goes the other way - it enables the core to switch a high-voltage supply on/off. I'm pretty sure it won't allow you to use a high-voltage source to power the core.
Powering the core from a high-voltage supply was discussed here:
There are a lot of possible safety problems putting a core into a AC wall box. I think if you know what you are doing, it can be done safely, but you should consider the fact that your homeowner’s or renter’s insurance is not going to cover you if you do something like this and it goes badly (fire, shock, etc). Mixing high and low voltage in boxes usually calls for special isolation techniques and barriers to be safe.
If you need to “flip” the switch, have you thought of buying a remotely controlled switch instead for this? A switch that is IR remote controlled or X10 or Insteon or even a servo to mechanically move the existing switch would be safer.
If you are not using the existing switch anymore, and just want to mount your project near it, I would recommend you double-stick tape to the switch plate and run a low voltage wire down the wall to power the core–you can paint the wire to match the wall color even. It is not always possible to turn a switch location into a plug (receptacle) location since switches do not always have the neutral wire in the box.
bko is absolutely correct about the safety issues so proceed with extreme caution.
You could use a small switching regulator like those used in phone chargers that supply 5V. However, the entire unit consisting of your power “cube”, Spark and sensor must be in a non-conductive box and the power cube must maintain its isolation. That is, if you take it apart, it exposes potential shorts between the high and low voltage circuits. If you look at the (failed) plugg.ee project on kickstarter, they actually developed a patented (pending) UL-compliant unit and power supply:
Taking another approach may be better. Smartthings uses motion and other sensors that report back to a hub (via zigbee protocol) and their cloud. When motion is detected, the cloud sends a command to the light controller. Their motion sensor uses a PIR sensor.
Thank you all for your input. The safety (and insurance) notes are appreciated. I think I’ll follow @bko’s suggestion and mount my switch near the actual switch, and then run a power cable from my switch to a nearby wall socket. Doesn’t look as nice as being self-contained, but it certainly is safer.