Recently, I aquired a Linksys SRW224G4 28 port network switch ( Datasheet and German brochure ). However, it has no power button and is turned on when the power cord is inserted in to the power plug. I wanted to add a power switch to this switch so I could manually turn it on and off when I want to:

power switch

For this, I used an ESP32 development board ( Datasheet, Pin list and pinout reference ) because I have more plans of adding functionality with the ESP to the server rack. First, I soldered the ESP32 to two pieces of stripboard so that I could create my own PCB:

esp32 esp32 bottom

The SRW224G4 is connected to mains power, and I don't think that running 220 volts through the ESP32 to switch on and off is a good idea, so I connected the ESP32 to a 250V relay. I want to keep the design modular so that I can remove the ESP32 and all it's components if I wanted to add anything. To achieve this, I added screw terminals to the relay so that I could unscrew the wires going to it. I wanted to keep the relay in place and only have to disconnect the wires that go to the ESP32.

relay relay screw terminals

The relay requires a 5V power line, an input connection and a GND line. The ESP32 only has a 3.3 V line, so I added a 5V boost stepup converter to create a 5V line that I could use for the relay:

5V step up converter 5V step up converter bottom

My first plan was to connect the input wire for the relay to pin D23 of the ESP32, and then write some code to detect if the switch is flipped on or off, but then I realised I could simplify the whole switching by just attaching a 3V3 wire to the switch and connecting that to the input of the relay:

connected esp connected esp bottom

To also make it modular on the side of the power switch, I crimped some circular terminals to the ends of the wires that connect to the power switch:

crimped wires

Lastly, I soldered two wires to a Molex extension connector, to connect it to the 5V and GND wires of the power supply of the firewall, that the ESP32 will be next to. This way I won't have to power it via a USB cable, and the extension connector can be disconnected from the power supply keeping the system modular:

connected to power supply

Here's a video of the firewall, new switch with power switch and this server powering up.