I'm trying to switch the light with my Raspberry PI. I've seen some guides on the web, suggesting I'd need a relay. However I'm very bad at electronics and creating circuits. So can somebody give me a list of items I'd need.

PS: I'm from EU so I have EU standard sockets for Lamps etc.

  • 1
    There are tons of other interesting projects that would be less dangerous. Commented Oct 3, 2017 at 12:04
  • And tons of guides for this very thing. But if you're bad with electronics and circuits, I'd steer clear. You're gonna kill yourself if you aren't careful.
    – user42000
    Commented Oct 3, 2017 at 18:33

3 Answers 3


As some other users said, is not a good option to mess with that voltage if you don't know what you're doing. Although, if you want to take a look, this is a common schematic of a relay controlled unit:

enter image description here

Relays have three pins: COM, NO, NC standing for Common, Normally Open and Normally Closed. It will depend on how you want to interface with the relay or relay module, you'll need to change your wiring.

Usually, you will cut one wire coming from the power and pass it to COM of relay, after that, grab the other side of the wire and put it on NO or NC. Applying or removing V on the correct pad (usually labeled as INx on modules) it will change the state of the relay, thus, changing the "state" of the thing connected through it.

  • Thanks, what is the difference between NO/NC? What would be the better choice for my project?
    – 0x45
    Commented Oct 3, 2017 at 14:14
  • Hi! It depend on what do you need as unpowered state. Think what will be the most used state and use the apropiate. i.e: If you want to power a lightbulb that is going to off more time than on, use the NO.
    – Luis Diaz
    Commented Oct 3, 2017 at 14:36
  • Whats the model number of that relay board, looks just the thing for a project I'm working on?
    – Plasma
    Commented Oct 4, 2017 at 9:04

An easy solution, that does not involve your pi coming into contact with mains voltages, is to grab a cheap wirelessly controlled power outlet like this and then attach your Pi to a 433Mhz radio transmitter. You will find several sites online that walk you through this process.

enter image description here

Another solution is this computer-controlled outlet from AdaFruit, which is designed to hook directly to the GPIO pins on your Pi.

enter image description here


Yes please avoid messing with mains voltage especially if you are not confident. That said there are still nerdy ways to accomplish this.

The Kankun Smart Wifi Plug Socket is a wifi access point that actually runs a ssh server so you could control it that way.

There may be other plugs but none that I am aware runs like this as most seem to require "hubs"

  • It's not a good idea to mess with thing that you don't understand, but some times it's needed to understand those things.
    – Luis Diaz
    Commented Oct 3, 2017 at 13:32
  • Agreed but there is no need to touch any 240v Ac as you can learn with low powered DC.
    – Dr.Rabbit
    Commented Oct 3, 2017 at 13:37
  • I totally agree to that. There is a lot of options to not mess with it, but hence he/she is asking, it's our "duty" to answer that, beside pointing better choices and making appropriate warnings.
    – Luis Diaz
    Commented Oct 3, 2017 at 13:41

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.