Wireless AC Control With The Raspberry Pi

We’ve seen some of [Connor]’s work before, and it looks like he’s now turning to product design. He’s come up with an adapter for the Raspberry Pi to control a few wireless wall socket relays, allowing anyone with a Pi to control lights, coffee makers, TVs, and anything else that falls under the very broad home automation banner.

The system uses a 315MHz radio breakout board for a Raspberry Pi to control the relays in one of three wall socket adapters. There’s a script running on the Pi with a very nice GUI to turn the lights on and off.

[Connor]’s product is extremely similar to a certain WiFi-enabled wall-plug relay system controlled by a smartphone, and to that end, he’s decided to call his device the Belchin’ Emo Switch. The name might need work, but he’s selling three Raspberry Pi-controlled wall plugs for the same price of one wall plug from Brand A.

Below you’ll find [Connor]’s videos for his device. You can also check out this reddit thread where he shows off just how open source he can be; there are part suppliers and even how he’s packaging this system for shipment.



43 thoughts on “Wireless AC Control With The Raspberry Pi

  1. Here is something I was thinking about doing that would work with this hardware.
    1. Check the time of day and compare to Sunrise and Sunset.
    2. Check if owners cell phone is on the wifi network.
    3. If it is after sunset and the owners phone connects to the wifi turn on the lights.
    The change of state of the connection would be the trigger to turn on the lights. That way when you get home at night the lights would come one automatically when you walk up to the door.

    1. I tried this once. I used tasker on my android to send commands to my electric imp connected to a power switch tail 2. It worked alright but really wanting the lights on and off is a lot more situationally subjective. When I get home at 3 in the morning after a night out I really don’t want to be fussing with my phone to turn the lights off.

      1. That is just the point. You would not have to fiddle with your phone. The Pi could just wait until your phone logged onto your wifi or it detected your bluetooth and turn on the lights. You would have to do nothing. As you walked up to your home you phone would automatically log onto your wifi, the pi would see that your phone was now on the network by checking the router and looking at the macs and then turn on the lights.
        With tasker you could have it just send the command when it logged onto your wifi but I have not messed with tasker for a long time or the imp.

          1. And hey, here’s an idea.

            If sun is set && phone is on network, turn light on.

            BUT. If the phone’s accelerometer shows very little movement a in custom time period, kill the lights. That half-solves the automation on drunk nights!

          2. the ip of the phone might change. Better to check for the mac address if possible as that would not change. Another option is of course to use bluetooth if the range is good enough. You could also use tasker to do something when the phone logs onto the wifi. For me the key would be to also keep track of the time and do try and figure out people routines.

    1. I’m using 433Mhz plugs from a brand named “Di-o”. It’s working like a charm. Never heard of the 315Mhz version, though.

      Funny thing, i’m currently making my own “shield” for raspberry for 433Mhz plugs but i’m going to power my emiter with 12V and plug it in a 5dBi antenna. That way I could handle plugs at least 100m away. I’m planning to make my own controllable wall plugs with an arduino powered onto the mains (this component looks good enough : http://www.mouser.fr/Search/ProductDetail.aspx?R=RAC02-05SCvirtualkey56830000virtualkey919-RAC02-05SC). I hope i won’t be in “Hackaday Fails” !

      If you are using 433Mhz plugs with Home Easy protocol, try this : https://github.com/maditnerd/hcc. A good webui to manage your plugs.
      There’s a lot of good things on this github. I should try the new yana-server with vocal activation ;)

      1. Yeah, we’re going to be taking the proceeds of these boards to develop a 433Mhz European 220v variant, and a 2.0 of the US that includes better breakouts for antenna power.

        1. If you can get how dimming is managed (special code with 4 bytes more) for Home Easy protocol for 220v 433Mhz model, please let us know. There’s a lot of world out there looking for it.

    1. Nope, these RF operated mains switches are everywhere now, supermarkets often have them. Really cheap too, 10 UK pounds for a set of 3. I’m surprised more people aren’t using them, my house is rigged up already, tho just with the normal remote, nothing clever like this. They’re a brilliant solution for people wanting to control mains loads, dirt cheap, certified, and no connections needed to nasty mains voltage circuits.

      1. Yeah, a couple people on Reddit questioned my decision to use relays that weren’t also open-sourced, but I find it much safer (electrically and legally) to use AC gear that’s already UL, CE, RoHS and FCC approved. And at this point I’ve already torn one apart and could tell most people what’s in it if they can’t already guess. :)

        1. Bugger open source! They’re cheap as dirt! If somebody else wants to invent a system that does the same, let them.

          I don’t think there’s any way open source would benefit in this case, which would be competing against mass-produced Chinese cheap supermarket gadgets. There’s not a lot of brains in the system. The idea of controlling a relay, from an MCU, or just from RF, has already been done. A lot! It doesn’t need “open”ing, it’s not a secret! You may as well open-source the resistor.

    2. Oh, I see what you mean, using the IR remote control sensor the TV comes with, emulate the remote control. Yeah, you could, but you could only get as far as standby. These sockets cut the mains entirely, except for their own standby current of course, which I’d guess is a lot lower than most appliances. It also means things are *really off*, so no fire hazards etc. Except from the device itself. Of course.

      RF works round corners and through solid objects too. And things like my PC and amplifier don’t have IR remote control, but I power those off through these remote sockets. Also lamps, heaters, plenty of other things that don’t come with remotes, but are useful to turn off without getting out of your chair. Especially if disabilities etc mean reaching down to the skirting board, behind bits of furniture, is not an easy way of working mains switches.

      These cheap little gadgets, IMO, could easily replace X10 and the like, for the basic applications. From the look of the pic above the Raspi’s RF transmitter is just a SAW thing with a couple of coils, all low power and simple. I think they’re revolutionary, can’t say enough about them. Using a Raspi, like this, could provide a very decent home automation system for, what, a tenth, of the previous price. I think there’s plenty of channels available in the system, I’ve used 2 remotes together and they don’t interfere. I’d like to see the protocol analysed.

        1. Ah, so yours all use the same set of codes? I’ve bought several, and my remotes issue different codes. The sockets themselves learn to respond to whichever remote and button you like. You just hold down the button on the relay unit til the LED flashes, then hold down the button on the remote you want to program it to.

          I’ve had some from a different system, with 3 buttons and a selector on the relay units to select which button they’re on. There’s also a choice of 4 “channels”, A B C D, so you can run up to 12 altogether with several remotes. Or more, if you gang several relays to the same remote channel.

          So the ones you use all use the same set of codes? I’m surprised, I’d think either they’d learn, or have a switch somewhere. That, or just be randomised at the factory. Otherwise that limits you to 3 switches per household, right?

    1. At the moment there’s no on-board GUI, just a web interface. So you’d have to start X, and run a fullscreen browser on localhost. Performance shouldn’t be noticably different.

      1. I am new to the pi, my first is still in transit at the moment, and I didn’t know if you were able to share the GPO pins to multiple devices. I still have a lot to learn, but my thought was once you had them both installed launching midori to use the controls would be easy peasy.

  2. What’s needed to make this complete is a sensor module that plugs in to a switched socket (or wired in) to make a relay module follow the state of an existing line. It would be useful to permit more lights to be operated by one switch, or for a switched lamp to be moved away from a switched outlet.

    At least, it would make it complete for my needs!

  3. I’d say RasPi is an overkill, I have a single Arduino doing pretty much the same. It has an infrared sensor and understands all the remotes I have at home, and can PWM control some 10W LEDs and LED stripes.

  4. I noticed the channel of your remote outlets is labeled b and these usually come in a variation of a to f channels with 3 controllable outlets per.. Are you able to provide over 15 controllable outlets from a single pi or are you just selling 3 with no option for expansion?

    1. Currently it’s really hard to specifically order one channel, not many reputable sources allow us to pick and choose so far. They’re currently sent at random, the Pi software can be taught any new code if the channel isn’t supported already. However, if we can find a dealer that will let us order specific channels, you could easily expand our system to 12 relays. I’ve been really itching to do so.

        1. Yes, I just verified this.

          You can buy A,B,C,D channel, and convert it to the channel that you want.

          Just solder a wire across the cut trace of the controller ic on the receptacle and cut the trace of the channel you want. Do the same on the remote. Channel programing pins are the same pin numbers on the remote and receptacle ic. The receptacle channel traces are marked A,B,C,D, but are not marked on the remote.

          I guess 12 possibilities exist as stated before.


  5. Long time lurker, first time poster. I was just looking at something along this line to power cycle my modem when I lose connection or it locks up.
    I am just getting my toes wet with all of the Arduino/Rasp Pi stuff, but this post is really timely.
    A good concept and well done!

    1. Thanks! Pretty soon I’ll be rolling out an update that’ll let you input conditional logic into the web interface to do things like poll that network’s response time and kill/grant power to that modem if it’s too slow.

  6. The sockets sold in Denmark, usually comes with a 4pin dip switch to set a system code,so thats 16different codes * 3-5sockets per code, the one with 3 is most common some of the 4-5ones only have “change state” button instead of on/off.

  7. Hey guys, I am working on something similar but more versatile and open source as an indiegogo campaign. It contains an 433/434 MHz receiver for the power sockets and an nRF24L01+ 2.4GHz Wireless Module. It can sense wireless low-cost sensors (which are part of the campaign), control lights, control power sockets, RC cars, whatever you can imagine!


  8. Wait…. so he is asking for $60 for a kit with <10 in parts and 5 minutes of assembly? All while there are dozens of people who did the same project online and provided instructions how to replicate it ? (so it is not like there was much development work to do…)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.