I don't know much about electronics. I'm a developer/Linux admin. I have a Raspberry Pi2 that I may run on Raspbian or Ubuntu Core. I'd like to control my lights via the Pi.

My questions is: is RF or WiFi the best option for this?

For RF, the way I see it, I can write some Python code to work with a Transceiver like this to control the lighting device.

For WiFi as well, I'd write some Python code to interact with the lighting device.

I imagine my device would be an RF or WiFi relay switch. I'd conceal inside my wall switch. I'd be able to remotely turn this on and off. I'd also need to be able to manually override (i.e. turn the wall switch on and off using my hand). I'd get an electrician to install this but I'd like to know if this plan is feasible and, of course, whether RF or WiFi is better.


:EDIT: There are the two single channel RF relays I'm looking at right now:

I'm not sure which one is better or if RF is even the best choice yet.

  • 2
    electronics.stackexchange.com should stop moving questions just because they mention Raspberry Pi
    – Milliways
    Commented Jan 5, 2016 at 1:30
  • @milliways you should see how badly that mod is doing it to the arduino se.
    – cde
    Commented Jan 5, 2016 at 2:20
  • I was thinking the same thing @Milliways. It just so happens that I'm using a Pi but this is more a question for electronics, IMO.
    – Housni
    Commented Jan 5, 2016 at 21:54

2 Answers 2


For start, WiFi is RF (radio frequency), though it implies a whole stack of networking abstractions built on top of the RF communications.

I would not recommend using those transceivers because you will need to implement a whole pile of functionality yourself, i.e. packet framing, acknowledgements, error detection, etc, etc. That is a very large hurdle to climb, given the questions you are currently asking.

Those relay boards you have linked are NOT RF in any way. They take low voltage electrical inputs, isolate them and use them to switch a relay. You could happily wire those relay boards to the Pi's GPIO outputs, but it means that the relays would be co-located with the Pi. If you were using a Pi Zero with a USB WiFi adapter, that would be a very reasonable approach.

If you want a wireless connection between a Pi and some relays then you will need both a wireless link and a small microcontroller at the far end to interface between the wireless device and the relays.

I suggest that you look first at the ESP8266, which gives you a 32-bit microcontroller with built-in WiFi, a small number of GPIO pins and a relatively-easy (arduino-compatible) means of programming it. It would be capable of receiving commands over WiFi from a Pi or a phone or whatever and activating those relays. Edit: this is basically like buying a Pi Zero with built-in WiFi except that it's much smaller, lower power, doesn't run linux and you have to write a bunch of C to control it.

If you don't want to use WiFi, then look up an nRF24L01+. They're a couple dollars each, relatively-easily interfaced to a Pi and/or microcontroller, and they handle all the packet-radio hassles for you. You will need to use a microcontroller on the receiving end to interface between the radio and the relays.

The third option is that some cheap wireless switches have had their protocols reverse-engineered and can be controlled using chips like the nRF24L01. That would mean you can buy safe, commercial remote relays, ditch the remote control and start controlling them from your Pi with the appropriate radio interface.

  • I like your first suggestion. Please bear with me while I figure this out. From what I understand, these are the things I need to conceal inside my light switch: a ESP8266 ESP-12E Transceiver Module for my Pi to send instructions to, a 1 Channel 12V Latching Relay Module which the ESP will instruct to turn on or off. Is that right?
    – Housni
    Commented Jan 5, 2016 at 21:47
  • What about my question regarding manual override? Can I turn it on via the Pi and then turn it off by manually switching the switch to the on position (since the manual switch was in the off position initially) and work it like that?
    – Housni
    Commented Jan 5, 2016 at 21:47
  • I just realized, I'd also need some kind of regulator in there to supply the Relay Module as well.
    – Housni
    Commented Jan 5, 2016 at 21:49
  • 1
    Yes, you will need a 5V power supply to run the relays and ESP, maybe also a 3.3V regulator depending on which ESP module you buy. Make sure you get the ESP carrier board for prototyping work, otherwise the bare modules are really hard to mount and solder. It doesn't need to be a latching relay module, just a plain opto-isolated relay is fine. You can implement a local override in software by connecting a pushbutton to one of the ESP's GPIO lines and changing the relay state when you detect a press. Commented Jan 5, 2016 at 23:20
  • Thanks William. You've been very helpful. Based on what you've told me, I did a lot of searching and this is what I've come up with (btw, my mains is 240v AC). I'll use this 1CH 5v relay module powered by this 5v power supply.
    – Housni
    Commented Jan 6, 2016 at 23:40

For simplicities sake, stick to RF. Most remote controllers in home are used with RF, so it's good to stick with a commonly used setup. For the Wifi solution, you would have to setup a Wifi Direct client on the raspi, which is feasible but much more complicated, much more expensive and uses up a lot more of your time. You have to buy special ICs for this and then configure the connection so they link up. In terms of cost and and practicality, I would go with RF transmitters and receivers.

EDIT: I would've suggested going with the RF (Infrared) LEDs from Adafruit. They already have a tutorial setup and most of the process is already laid out.

  • Interesting points, I didn't even think that for. Thanks for bringing that up. But it does seem like the ESP8266 that William Brodie-Tyrrell suggested may solve that problem, wouldn't it? I Googled it and quickly scanned some links and it seems like the ESP makes it really easy to do all this.
    – Housni
    Commented Jan 5, 2016 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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