So I want to wire two DHT22 sensors (5V) to a Pi and also control a lightbulb with 220V. As a plus this should be very compact and I don't want to solder or use breadboards/jumper cabling.

I looked around and found some nice HATs/boards for the Pi. But there is none which fits my needs, so it seems I need two boards.

Would it be possible to use this board for the lightbulbs:

Waveshare RPi Relay Board Waveshare

and stack another board on top of this. Something like this

Paddle Breakout HAT Board Paddle Hat

This would be compact and I could use solid core wire directly or crimp some cables with insulated cord pin end terminal ferrules which I already have.

Will this work or are there some caveats/gotchas which I have to look for? Is it possible to piggyback two GPIO boards on a single Raspberry Pi?

  • So you have 220VAC live wire connected to the relay switch on the PCB which is stacked on Rpi? If your Rpi has a metal case, it it important to earth the case. Even if you are not using a metal case, you must cover the relay screw terminal with a plastic cover, so your cat won't touch anything dangerous.
    – tlfong01
    Apr 9, 2019 at 6:08
  • I did not have connected anything, just doing some research....But you are right, I don't want to mess with mains voltage if I can avoid it. Maybe I should go for a 433Mhz socket.
    – duenni
    Apr 9, 2019 at 6:56

1 Answer 1



two DHT22 sensors to Pi and also control a lightbulb 220V ... should be very compact I don't want to solder or use breadboards/jumper cabling. HATs/boards Pi for the lightbulbs Will this work or are there some caveats/gotchas

Short Answer

DON't PLACE ANY 200V Mains Wire near your Rpi!!!

Beside electric shock risk, there is also scary things like back EMF and EMI that might kill your Rpi.

Long Answer

Not too long ago I also did a Rpi project with a couple of sensors, and a relay module with 4 relays, controlling DC and AC mains, very similar to yours.

As I started building my master piece and showing off in a forum, immediately I got severe warnings from all those professionals with EE experience in industry and military areas, including registered electricians.

Now let me first show you my project idea.

enter image description here

Then the schematic.

enter image description here

Then I got warnings that I MUST EARTH EVERYTHING (My metal box is 4 metal plates screwed together, and I was told to do earthing 4 times, one earthing to each metal piece. Oh my goodness, then I regretted to have started the project, or showing off my master piece in the forum! Anyway, I did follow the experts' advice, as shown below.

enter image description here

I also go severe warning on which good quality wiring, plugs, and which tools to use.

enter image description here

enter image description here

enter image description here

Then I started testing.

enter image description here

What I have not shown here is that my relay box has a 3 meter long input mains wire, and another 3 meters long switched output wires. And the Rpi GPIO 5V control signal wire going into the box is also 3 meter long.

In other words, everything mains project thing is 3 meters away from my Rpi!

As you see, it is a lot of boring hard work. So I think your idea of buying a wireless socket is good, because you can save much hard labour time to do your Rpi research!

Best Smart Plugs 2019: The best sockets to make your home smarter - David Ludlow March 11, 2019

  • Thanks for your effort. I think the wireless socket is more suitable for me.
    – duenni
    Apr 9, 2019 at 8:28
  • Your are welcome. Have nice Rpi research work!
    – tlfong01
    Apr 9, 2019 at 8:39

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.