Laser Engraver (Or 3D Printer) Controller with Relay and Power Supply

With all the work I’ve been doing on my laser engraver I still hadn’t taken the time to put the controller board inside some kind of case.  As we know from my OctoPrint Controller post, we know I like to make enclosures for my toys, and apparently others do as well because it’s been by far my most popular post.  It’s also my most viewed thing in thingiverse where I’ve been publishing some of my STLs.  So for this controller box I wanted to incorporate a new element that I hadn’t before.  I wanted to be able to switch the LEDs and the venting fans that I added to the Laser Shielding box from within the GCODE.

My goals for the enclosure was to house the controller itself, a power supply to supply the power for the laser engraver with a 12 V and 5V and ground distribution block, and a relay board to easily switch large loads which in this case is the fans and the LEDs.  It also had to accommodate the LCD controller and make for a clean look adjacent to the laser shielding box.

Whenever I start these I’ve found it’s good practice to make test fit pieces.  No matter how much I practice measuring with my calipers or how tuned-in my 3d printer is I can’t get it right the first time and when the print takes 12 or so hours I’d prefer not to scrap it because the mounting screw spacing is a mm off.  My favorite 3D printing podcast says to not cherish your filament because inevitably some is going to go to waste but yowzah I can go through it fast when the prints are so large.

Test Fits for Laser Controller

So you remember how I said “inevitably” in my last sentence?…  I really did mean it, Haha.  I really took my time.  I got my test fit pieces nice and locked in and I still wound up with a wasted 12 hour print.  I didn’t account for the USB cable coming out of the controller board and it bit me real bad.  The worse part about it was that I even drew in the square that indicates where the USB cable would go, but I didn’t carry it across when I started moving beyond the test fit pieces.  OOPS…  there goes ~$8 worth of filament.  Haha.  Oh well I suppose.  You live and you learn.  This is the model of the one I printed out that ultimately didn’t work out.

Original Model Laser Controller

The rectangular prism inside of the controller is a representation of the power supply, but the USB cable for the controller that sits right in front of it didn’t clear the power supply by about 5mm.

By this point I like the foundation of the design so I looked for the least drastic work around.  So for this simple solution I made a piece to hang the power supply from the roof piece.  It’s not what I originally planned but it made screwing everything together much easier since the power supply was out of the way throughout the process so that’s good at least.

Laser Controller Final

After I printed everything out putting everything together wasn’t too difficult.  It was just a little messy with all of the wiring.  All holes are designed for 4-40 screws with little to no tapping of the holes.

Power Supply:

First connect the power supply hanger to the top piece.  Then slide the power supply through the hanger.  Make sure to consider the orientation of the fan and the AC input relative to the back wall otherwise they’ll be flip-flopped.  It would be no fun to pull it out after everything was wired.  I left a slot for a nut on the hanger portions.  It was a little cumbersome to get the nuts centered in the slot for the screws but I used some teeny tiny magnets on some pliers to center them up.  The magnets were just so that the pliers would clamp down on the nut instead of the printed piece.  It’s a little fiddly but it works.

Voltage => Distribution Block:

I pulled out the portion of the cable that had the 4 wire molex connector with red (5V), yellow (12V) and black (ground/return).  Connect each of these wires to a distribution block to provide voltage to the various devices.  The distribution blocks go onto the left wall on the bottom 6 holes; although I only used the top holes and skipped the bottom holes because it was too annoying to get to them.

Switch:

Pull out the green wire and a black wire from the main ATX connector, snip them near the connector to give yourself some slack to get to a switch on the back wall.  The green wire connected to ground is what tells the power supply to turn on; I have noticed that this power supply does necessitate a minimum load before it will turn on so keep that part in mind.  Make sure to pull the wires through the switch mounting hole before wiring them to the switch.  Wire the switch so that when you turn it “on” the green wire connects to ground and opens that connection when you want the power supply off.  Use a continuity tester on multimeter to confirm the correct terminals on your switch before wiring it up.  (When the switch is on the continuity will beep at you and will not beep at you when the switch is off.)

Relay Board:

Pre-wire everything that you want to the relay board before mounting it.  It makes mounting it annoying to hang, but it would be nearly impossible to wire it after it was already hanging.  For me, I have LEDs for the laser shielding on one relay, fans on another relay and I left two 3.5mm barrel connectors available for myself but prewired for whatever nonsense I plan on later on.  I figured to just go ahead and leave them in there so I don’t have to take it apart later.

LCD 2004:

This part is super easy and self explanatory, but you connect the LCD from behind in the proper orientation.

MKS 1.4 Controller board: 

So the reason why there is no wall on the left side is so that I can take the entire board and wrap it up and over the side wall and place it in the box without taking everything apart.  This is an extra precaution for me because I crimped the JST connectors for the motors and switches etc and thus I do not trust them.  Haha.  So the least I fiddle with them the better.

After everything is all wired up you just screw in the LCD portion to the main portion and then screw on the top.

After it’s all connected up it looks pretty sharp.  (I intended for it to be all black but when I goofed the piece from earlier I ran out of black and used some fun green filament instead.  I think the colors look good together anyway.)

I’ll work on the pin diagram but I’m anxious to get this post up and it’s surprisingly straightforward.  I’ve been working on it too long..   Might be a good intro to Fritzing.

I wound up using pins 64, 44, 40 and 42 for the relay board.

To turn on my LEDs for example I used the command

  •      M42 P64 S0; turn pin 64 off which turns on the relay to the LEDs

This is a built in command in Marlin.  I didn’t have to turn anything on.  I’ve never cared for the relays that turn on with a ground and off with a voltage, but whatever no big deal.

Hope y’all like my new box.  It’s taken a lot of work, but I think it’s worth it.

Related Products, Please see site disclaimer.


One Reply to “Laser Engraver (Or 3D Printer) Controller with Relay and Power Supply”

  1. I must say you have very interesting posts here. Your website should
    go viral. You need initial traffic only.
    How to get it? Search for; Miftolo’s tools go viral

Leave a Reply