Best cheap materials to encase a rasbperry pi project?

I currently have an almost finished project where I have a raspberry pi control a relay module, which acts like a switch in an extension cord. The goal of the project is to remotely control my christmas lights through my raspberry pi.

Everything is done and working except I don’t know how I should encase it (for long term use I’d rather have it neat and tidy in some form of a case rather than just having open wires taped to my wall.)

Since (sleeved, but still live) wire directly from the outlet is running through the case, what material(s) would be best to use? My first though was cardboard since I have an abundance of it but common sense tells me that’s just a fire waiting to happen. Aluminum seems like an obvious choice however I don’t have any scrap aluminum laying around nor don’t have a welder on hand. Plastic from old Rubbermaid’s might work but would be hard to cut out for the exit outlet.

a small electrical box?


I would think to use plastic but *I’m not a certified electrician

3 Likes

Yeah same as above, k was thinking some plastic, acrylic/plexiglass, cut then into simple rectangles and glue them together.

Or if you can find one the right size conduit box is a good idea I would not have thought of. They should be electrically safe.

one thing to consider is there are local laws and code about not running low and high voltage cables together

1 Like

Ah yes… Laws. I always forget about those when it come to DIY PC controlled stuff.

Good call.

3 Likes

I almost exclusively 3d print my pi cases. Might end up making a rack at some point for a cluster.

1 Like

If it is just AC in and AC out then there aren’t any long runs of DC wires that could pick up power via induction. If the only DC is in the box then it is just like any other electronic device that has the power supply built in, as opposed to a power brick.

You could keep things separated in a box, with the relays and Pi PSU on one side, and the Pi on the other. The low voltage wires on the PSU/relay side would be short and direct to the Pi, not some huge coil or long parallel run. You could add a divider to make certain parts stay on their respective sides, much like a PC PSU keeps the power in away from all the DC wires and equipment.

A lot of keeping different wires separate is more about interference or damage to the low voltage device. Like those FCC warnings “This device must accept all interference”. You would have to go to great lengths to actually cause a fire via induction. Loose parts in a live box would be immensely more dangerous.

And along those lines, having the Pi extremely close to the high voltage contacts on the relays opening and closing mostly certainly can cause interference, particularly with wifi and bluetooth. You may want to do an external antenna mod or USB dongles for those, as well as some magnetic shielding on the power supply side like any other home electronic device employs.

If you aren’t terribly familiar with working with high voltage then I most certainly wouldn’t do a test run indoors or near anything expensive or flammable.