Raspberry Pi All-in-one Power Strip With Relay Controlled Outlets

by ibkhayyat in Circuits > Raspberry Pi

346 Views, 1 Favorites, 0 Comments

Raspberry Pi All-in-one Power Strip With Relay Controlled Outlets

Pi Box all-in-one -05.png
Pi Box all-in-one -12.png

I wanted to turn my 3D printer on/off remotely, to heat the extruder, prepare the printer, changing the filament, also since the printer is in a darkish room, I also wanted to control a light to check on my prints.

Supplies

  • Power strip, bought from a local store, anything similar will work just fine
  • Raspberry Pi 3 B+
  • Raspberry Pi NoIR Camera V2*
  • Flex cable for raspberry pi camera* (aliexpress)
  • 2 channel 5V relay module (aliexpress)
  • 8x bolts 3M 20 mm
  • 10x nuts 3M
  • Jumper wire, female to female
  • USB cable to connect the Pi to the printer
  • Light, with always-on switch, to turn on once power is running

* items are optional

Equipment:

  • Cable stripper/cutter
  • Screwdriver
  • Electrical mini drill with 2 mm and 3 mm bits, circular saw blade, grinder wheel
  • Instant glue

Installation

Pi Box all-in-one -11.png
Pi Box all-in-one -02.png
Pi Box all-in-one -03.png

I started to plan a project to build an all-in-one combo case for the raspberry and the outlets. I found a 6-outlet power strip wide enough to fit the Pi, and started to modify it to fit the Pi and the relay.

I removed the copper connectors and cut the plastic parts until I exposed the base. I had to open the base to remove any elevations.

I had to print a surface, hexagon bottom surface, to reinforce the base while keeping vent openings, and glued one on each side of the strip to keep balance.

Arranged the Pi and the relay module in place, taking measurements, marked the holes. Drilled through the original base and the printed plate. I also had to cut the right side of the power strip to expose the USBs and LAN on the Pi, also the lower (long edge) of the strip to allow exposure and use of the connectors (power, HDMI, AUX). I inserted the bolts and applied nuts to keep them in place, then I put the boards accordingly in the preassigned place, applied nuts to keep them in place (one or two is enough).

I had to drill through the original holes of both boards with 3 mm bits to allow for the bolts to smoothly go through.

Connections - Power

Pi Box all-in-one -04.png
Pi Box all-in-one -01.png

I chose to keep the center outlets as the main outlets, always power on, on which I connected the Pi. I fed the relay module and then connected the left outlets (one on each channel, to control separately). I was lazy to look for other cable colors, I only used yellow. (colored picture also attached)

The roof (strip cover) opened to allow insertion of the camera cable and its attachment to the Pi. Close the cover, connect Pi to the power... Almost ready, one more step.

Connection - Pi to Relay

Pi Box all-in-one -08.png

Remove jumper on the relay module if you have one, then connect as follow

Relay Pi

RY-VCC -----------brown----------- pin 2 (5v)

VCC ----------------------------------- none

GND ----------------red-------------- pin 6 (ground)


GND ---------------------------------- none (since GND are connected internally)

IN1 ------------------orange--------- pin 12 (GPIO18)

IN2 ------------------yellow---------- pin 16 (GPIO23)

VCC ---------------green------------ pin 4 (5v)

Relay Setup

Pi Box all-in-one -09.png
Pi Box all-in-one -10.png

Using octoprint, add octorelay plugin, assign the GPIO number connected to each channel on the relay.

Since GPIO18 and 23 were used, applied in the relay setup accordingly

Relay modules with more channels can also be attached, assigning the GPIO number accordingly for each channel

I also setup to turn off the printer after printing is done, with delay of 10 mins

Ready to octoprint, control the power remotely.

Happy 3D printing

Thanks

Thanks to the author of the following projects, worth reading

Controlling a Relay Board From Octoprint on a Raspberry Pi (link)

OctoPrint 3D Printer Power and Lighting Control (link)

Turn Your 3D Printer On/off Using Octoprint (link)