Switch 230V devices with Raspberry Pi

Working with 230v mains can be dangerous. So, for hobbyists switching 230v devices can be a challenge.
But with a special multiple socket adapter it's easy! Only a few components are needed to switch
230v devices with the Raspberry Pi.

USB multiple socket adapter

The main part of this project is a USB multiple socket adapter. There are mainly two types of this
adapters out:

Intelligent adapters which communicates with a host computer over USB. Software on the host is needed. Software controlled.

Simple extension lead socket which integrates a relay and switches the whole adapter just with the 5V USB voltage. Hardware controlled.

We need a socket of the second type, the "hardware controlled" type. I use this one:

Interface to Raspberry Pi

The interface for a USB voltage controlled adapter is simple:

One GPIO of Raspberry Pi is used to switch a transistor. The transistor converts the GPOs output voltage of 3.3V to 5V and provides
enough current to switch the relay integrated in the multiple socket adapter.
I've choosen GPIO15, but you can also use other GPIOs. I soldered SMD components directly onto the USB connector and fixed it with hot glue.