I need to turn on and off a very power-hungry appliance using my Raspberry Pi. I know a lot about software, and next to nothing about electronics and hardware. I looked around, and I saw a few rather scary things. Is there a 220v plug out there with a simple input, which I can connect to one of my Raspbery Pi's inputs, and which will decide whether the 220v plug is active or dead?

Surely, this is a common case...? I am amazed I can't find anything out there.

  • 3
    use a smart plug
    – jsotola
    Jun 2, 2022 at 23:06
  • 1
    Combine "plug" with "radio", "remote", "smart", "wifi" or "zigbee" and you will find lots of different products. Jun 3, 2022 at 9:33
  • Placing my vote with a smart plug of some sort as well. I use wifi controlled esp32 based ones but there are a ton on the market of different types. Jun 3, 2022 at 20:25
  • If there were 220 V compatible versions of the Digital Loggers IOT Relay, or the defunct PowerSwitch Tail for 240 V, I'd recommend them in a flash. Both are safe ways of switching mains power from a logic pin
    – scruss
    Jun 8, 2022 at 2:15

4 Answers 4


I would use two relays. One connected to the PI. The contacts would then switch the coil on the second relay.

A power hungry appliance would need a larger relay. The coil drain would be to much for the PI.

I would also have the coil voltage for the second relay low voltage, just in case of a problem. I would locate the second relay away from the PI.

Here is a good relay for the second high voltage one. https://www.amazon.com/Functional-Devices-RIB2421B-208-277-Housing/dp/B00788B0MO/ref=sr_1_1?keywords=Power+Relay&qid=1654186619&refinements=p_n_feature_nineteen_browse-bin%3A18945469011%2Cp_n_feature_sixteen_browse-bin%3A18644709011&rnid=18644703011&s=industrial&sr=1-1


You need to buy a relay module.

The relay module contacts (switch part) should be rated for a minimum of 220V AC at the current you need.

The relay modules inputs should operate from 3V3.

Note, a relay module is a relay plus the components needed to make it safe to drive from a microcontroller.

  • I found this raspberry.piaustralia.com.au/products/… But I feel VERY uneasy to actually put 220V stuff anywhere. I was hoping to have something like a powerboard where you plug things in and then control what is on and what is off by I/Os...
    – Merc
    Jun 2, 2022 at 16:08

If you do not have much experience with electronics or hardware, it is generally a bad idea to start directly with 220V. Common ways of switching are of course relay boards, but those require wiring.

Another solution would be to use domotica components. A cheap way would be to buy a 4.33MHz transmitter and Klikaan KLikuit or equivalent (see f.e. https://dullaart.website/raspberry/2_433Mhz.html#a2 and https://www.trust.com/en/product/71182-compact-wireless-socket-switch-set-apc3-2300r). In that way, you'll get some experience with hardware without the risks of getting a shock or burning the Pi.

A better way would be to get a Zigbee USB stick (I use the DeConz) and get simple power plug switches (f.e. Sonoff, which you can get at Amazon or other shops). This will report back the actual status of the switch. The DeConz software has a fairly well documented API.

Alternatively, use WiFi (without the cloud). Sonof WiFi plugs can be used in DIY mode (see https://sonoff.tech/diy-developer/ and https://sonoff.tech/sonoff-diy-developer-documentation-basicr3-rfr3-mini-http-api/) or a device with the Tasmota firmware.

  • All of the "smart" switches seem to require wifi/internet, so that they can be talked to from anywhere. I need something I can control even if the internet is down. Nobody made a power board where things can be controlled via USB? (As in a simple protocol where you can send 'on 1' and the switch 1 is on, 'off 1' and then 'status 1'..?)
    – Merc
    Jun 4, 2022 at 2:12
  • The options that I gave are not internet or WiFi based. Zigbee is a separate protocol, not Internet. And the 433MHz is also used by those remote thermometers. Jun 4, 2022 at 7:41
  • Wait a sec. Sonoff have a LAN mode! So I can talk to them using my WIFI directly, without having to get a Zigbee switch etc...!
    – Merc
    Jun 4, 2022 at 14:57
  • OK this is it... please add this link to your answer, since this really is "it": sonoff.tech/diy-developer
    – Merc
    Jun 4, 2022 at 15:03

The GPIO pins on the Raspberry Pi are 3.3 volt logic rated for only 3 mA and are static sensitive. You need to use something like this relay module to control a 220 volt mains device. https://www.ebay.com/itm/221962380923

You could also use an optocoupled thyristor to control AC mains voltage: https://www.ebay.com/itm/203158790920

Best to use an optocoupler to sense the mains voltage: https://www.ebay.com/itm/311864741981

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.