1

I'm looking to get started on Raspberry Pi programming and thought of a DIY project that I could do.

Basically, I want to control the light socket switch to on/off via a remote control. The switch looks something like this:enter image description here

What I plan to do is mount a device on the socket switch. This device is connected wirelessly to a raspberry Pi controller via local network. An android app in a phone/tablet connected (also wirelessly via local network) to the raspberry Pi controller is used to control the device. For example, when user press 'ON' in the app, the device would push the bottom part of the button of the socket switch and top part of the button when 'OFF'.

Constraints

  1. I have at least 2 socket switches that I want to control so I prefer to have multiple of those devices connected to just one raspberry Pi controller instead of having one raspberry Pi mounted on each socket switches.
  2. I've googled on some tutorials on raspberry Pi but they all seem to make use of relay switches and rewiring the wires to them. I'm living in a rented room so I am not allowed to mess around with the electrical wiring inside the socket.
  3. My budget is around US$50 but this is just a minor constraint. As long as constraints 1 and 2 are fulfilled, I'm all ears.

What devices and hardware should I prepare and which tutorial would be useful in carrying out this project?

  • If you can't mess with the wiring, what do you expect your RPi to do? Press those switches with a robotic arm or something? – Dmitry Grigoryev Oct 20 '16 at 10:23
  • @DmitryGrigoryev I was just about to post the same thing when I re-read and noticed '...the device would push the bottom part of the button...'. That seems to be the plan. – goobering Oct 20 '16 at 10:25
  • @DmitryGrigoryev, yes or something similar like a roller that rolls down/up on the switch depending on the 'ON/OFF' instruction. Was my explanation not clear enough though? Do note that the device that press those switches should be connected wirelessly to a central RPi controller. – Mark Oct 20 '16 at 10:31
  • @Mark Sorry, I missed the key sentence. IMO, there is no way to do this on $50 budget. – Dmitry Grigoryev Oct 20 '16 at 10:32
  • @DmitryGrigoryev Then maybe you can recommend the cheapest way to do this? I might be able to find the devices on the cheap in my current place. – Mark Oct 20 '16 at 10:36
2

I think you're definitely not taking one of the easy routes! If you're wanting to make reversible changes to the light switch, that would really be the way to go.

However, there isn't really any reason what you're proposing shouldn't work, but some initial questions come to mind:

  • How stiff is the light switch?
  • How had you planned on mounting the device to the switch?
  • Does the switch need to still be operated manually?

The first thing that came to mind is a servo physically controlling he light switch, some quick googling found this. You could use an idea like that and make the mounting line up with the screws that hold the switch to the wall. It's quite cumbersome, but I'm sure it'd work.

As soon as you have the physical operation working, it's a simple matter of making a bit of code to control it. I've written some code that would do it over websockets, but there are other examples in other languages, depending on what you're most comfortable with and what your full requirements are.

If there was some way you could get permission (or not, as the case may be), you can leave the switch in-place and achieve your desired result with only minor changes. The nicest thing about this method, is that you can just interrupt one of the connections from the switch, and not only control the light, but reroute the switch to a different GPIO as a manual override for when your landlord comes to visit and needs to turn on the light.

Since that second part is not specifically answering your question, I haven't gone into a lot of detail, but it needs to come with the usual "Playing with AC mains voltages" warning.

  • Good answer -- but I'm a bit surprised that servo manages to flick a switch as I have one of similar size and the torque it generates is pathetic; bare strands of 22 gauge jumper wire will stop it dead half the time (perhaps that style of switch offers less resistance, it is a hard thing to judge with human hands). I'm just noting this in case the OP is tempted to go with anything smaller and cheaper. Hobby servos are good for rotating things mounted only to them but if they have to actually push something where solid contact friction is involved, YMMV. – goldilocks Oct 20 '16 at 16:27
  • Nice... yeah, wish I could go relay but there is a 0.01% chance that the house owner would let me mess around with the wiring...and a 99.99% chance that I would screw things up if I mess with it. I'll look into this servo motors method, thanks! – Mark Oct 21 '16 at 0:45
  • @goldilocks I've never actually tried loading up a servo either, but I would assume all are not created equal. Another thought I had was getting a motor and fix a heavy-ish flywheel to it. If you found a way to fix that motor horizontally into the concavity of the switch, the moment of inertia might be enough to throw the switch up in one direction and down with the other. – calcinai Oct 21 '16 at 9:56
-2

I would recommand a Raspberry Pi Zero (cause the form factor) and then insert it in the switch witch a relay, for example this miniatur relay then you can bridge the original switch circuit without any problem and can still let the original circuit work.

Some like this easy bridge, you can modify it althoughyou living rented in this room, the only thing you need is to remove it if you cancle your rent.

Alternativ relays for a ready to use solution will be relay with phoenix contact. You get the with phoenix contacts or with screws. A other way will be RF relays, but then you need a test build to get the RF frequences and commands, after that you can use the Pi with an RF module to send the commands.

If you need a curcuit diagram how to bypath your curcuit just ask, me and many other with elektrical knowledge can help your here... its nothing magical just stay save and turn off the safetyswitch befor work ;)

  • 1
    This approach is sensible, but it means opening up the light switch which is out of bounds per the spec given in the question. – goobering Oct 20 '16 at 13:00
  • @goobering You are right but in the spec Mark thinks he is not allowed to do this, but he is allowed, he just is forced to a decommissioning if he cancel the rent – Broatcast Oct 20 '16 at 14:06
  • 1
    No. He is not allowed. You can not go messing around with electrical wiring in a residence that you do not own. Even if you are a licensed electrician, you need to get express permission from the home owner in advance. (Canada & US at least). There are severe legal and insurance liabilities if something happens and the house burns down. – stevieb Oct 20 '16 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.