View Full Version : Converting 12v/24v power supply to remote (G-code) switching

04-08-2015, 08:36 AM
Converting 12v/24v power supply to remote (G-code) switching

by MindRealm





Hi everyone!

This Instructable shows you how to remotely switch your 12v or 24v power supply, using G-Code or by adding buttons in Pronterface. The process voids the warranty on the power supply, but they are only around $25 so not the end of the world if it dies, right?

This projects should cost less than $5.00!

A necessary word of caution: During this conversion, you will be modifying the power supply by relocating the line-side fuse, which requires some confidence in soldering and common sense. If you follow the instructions carefully, the process is easy and only takes around a half-hour.

You will need the following parts and tools:

Soldering iron
#2 Phillips screwdriver
1/8" flat screwdriver
Heat gun or lighter
3/16" heat shrink tubing
18ga. stranded wire
3- or 4-conductor 24ga cable (I used a stranded telephone wire)
1/4" thick self-adhesive rubber feet (purchased mine at Lowe's)
Dupont connectors: two female 1x1 and three female 1x2
5v relay module (search eBay for "Arduino relay module")

Before you begin, get all these things together and unplug the power supply from the wall.

As with any project, you must exercise care and diligence. I cannot be responsible for any damage or failure due to these instructions. I have performed this modification and have had zero problems.

Step 1: Open the power supply and remove the circuit board


Disconnect the power supply from the wall outlet. (...just in case you didn't already!!)

Disconnect the power cord wiring and the 12v (or 24v) wiring from the power supply terminals. Keep track of where they go so you can put them back later!
Remove the six Phillips screws along the lid of the power supply. Do not remove the screws from the fan.
Remove the cover and unplug the fan from the board. (You will need to cut the "inspected" label)
Remove the center screw from each of the two heat sinks, holding the bracket so it will not turn or fall onto the board.
Remove the two remaining screws from each heat sink and life the aluminum out of the chassis, making sure not to detach the rubber insulator. (Careful not to touch the heat sink compound or it will get all over the place!)
Remove the five Phillips screws from the circuit board. (one on each corner and one in the middle)
Remove the circuit board from the chassis.

The fuse is located right beside the L terminal, where the AC hot wire goes (see photo)

Step 2: Remove the fuse


Now we'll remove the fuse. Be careful not to damage it as it will be needed later!

Flip the board over and locate the two leads that are attached to the fuse and heat them to allow removal of the fuse. Either desolder them with solder wick or a vacuum tool, or melt one end at a time while lifting the fuse away from the other side of the board. DO NOT use your fingers or you will get burned!!
Strip and tin each end of a short length (6-8 inches) of 18ga stranded wire. (I used left-over wiring from my hot end heater!)
Solder the ends of the wire into the two holes where the fuse was removed.

Step 3: Put the fuse back in the circuit



Cut the wire approximately 1-1/2" from the circuit board on the side that is near the screw terminals.
Strip and tin the ends of the wire where you just cut it.
Solder the ends to the fuse as shown, making sure NOT to hold the fuse with your fingers while soldering it.
Cut the wire in the middle, so that each end is the same distance from the circuit board.
Slide two piece of 3/16" heat shrink tubing on the fused wire to insulate the fuse as shown. Apply heat to shrink the tubing.

Step 4: Prepare the wire for connection to the relay



Route the two wires away from the screw terminals, cutting them both even with the black component marked BD1 on the board, as pictured.
Strip and tin the ends of the wires.

Not that I used another small piece of heat shrink tubing to keep the wires together. This is not necessary, but keeps the wiring tidy.

Step 5: Prepare and connect the relay




Apply two self-adhesive rubber feet to the bottom of the relay module, to serve as a spacer and to keep the solder side of the module from shorting against anything.
Locate the relay module on top of the black component (BD1) and the neighboring capacitor (C10).
Connect the two wires to the COMMON and NORMALLY-OPEN terminals on the relay module.
Prepare the relay control wiring by installing female Dupont connectors as pictured. If you are using a single-relay module, you will only use three wires. Make sure to cut the unused wire out of the cable, or fold it back onto the cable and insulate it.
Connect the relay control wiring to the pin header on the relay. I bent the pin header over some to ensure that the wiring would not be pinched by the chassis cover. (pictured on the next step)

Note here that I used a relay module with two relays. This is because I didn't have a single-relay module on hand. I simply left the second relay screw terminals vacant. I'll either use it later or replace this module with a single-relay module at some point.

A single-relay module requires three wires: 5v, GND and signal
A two-relay module (as pictured) uses four wires: 5v, GND, signal 1 and signal 2.

Also, I made a point to connect the fused wire to the normally-open terminal and the non-fused wire to the common terminal. This is a small safety measure that prevents the normally-closed terminal from being powered when the relay is not energized. You can connect the wires either way, as long as you use common and normally-open.

Step 6: Reinstall the circuit board


Place the circuit board back into the chassis, making sure that none of the new wiring is pinched or routed beneath the board.
Place the two aluminum blocks back between the components and the chassis, making sure that the rubber insulators are touching the components, NOT the chassis. Reinstall the four Phillips head screws to secure the heat sinks.
Hold the heat sink brackets and loosely reinstall the two long screws. Do not tighten them yet.
Reinstall the five Phillips screws in the circuit board (one in each corner and one in the middle)
Tighten the two heat sink bracket screws.
Route the control wiring out of the chassis, exiting near the power LED and voltage adjustment pot.
Plug the fan back in and reinstall the cover.

The cover will fit tight over the relay module due to the rubber feet serving as spacers.

Step 7: Connect the wiring



Reconnect the power cord wiring and the 12v (or 24v) output wiring to the power supply.
Cut the control wiring long enough to reach the Ramps board. I secured my wiring to the 12v wiring thar goes from the power supply to the ramps board.
Install Dupont connectors to the other end of the control wiring as shown. (Again, I used a two-relay module so I had four wires. If using a single-relay module, you will only have three due to not having the fourth one connected to the module.)
Connect the power terminals (mine are 5v=red and GND=black) to the servo power and ground terminals as shown. (make sure your polarity is correct or the module will not work)
Connect the control wire (mine is green) to the PS-ON pin, right beside the reset button.

That's it! The wiring is complete. Now to test your work...

Step 8: Test your work



Now the moment of truth.
If you followed the instructions, insulated the fuse properly, and installed the heat sink insulators correctly you may now plug the power cord into the wall outlet or power strip. Don't worry if the power supply doesn't come on - it is not supposed to.
Re-confirm that everything is connected and connect to your printer in your host application (Pronterface, Repetier, etc.) so you can pass G-Code commands to it. If the power supply comes on when you open your application, that's okay.

At the G-Code prompt, type M80
This turns on the relay module, resulting in a click and the power supply should come on. (...it may already be on)
Type M81
This turns off the relay module, resulting in another click and the power supply should go off.

If there is a problem, recheck your wiring and confirm whether the relay module is clicking when passing the M80/M81 commands.
I added buttons in Pronterface to evoke the commands, as pictured.


04-08-2015, 04:42 PM
I am doing the same but from the RaspberryPi and Octoprint and not from the printer it self.
The main reason I do this is because of the connection issues.
If the printer shuts itself off, the USB connection will not be disconnected gracefully, and it will be harder to connect the printer again to the computer.

Using the Octoprint (or something else) to shut the printer AFTER disconnecting it, it always work perfectly to bring it up again.

Also, (probably even more importantly) to turn the printer ON, you can't do it with this way since the printer is Off :)

04-08-2015, 08:11 PM
Can you share your solution for the RasPi combo? I'm interested, also in adding it to the menus.


04-08-2015, 08:47 PM
I am going to replace my relays from the 5V to the 3V version and making a better case for all of those.
I will share the instructions for everything when I get the hands on it.

04-08-2015, 08:49 PM
Why the voltage version change?

04-08-2015, 09:23 PM
The RaspberryPi pins are 3V.
To have 5V I need to use additional supply to the relay, also coming from the RPi, but its an extra cable and I like things very optimised. The 5V from the RPi measures 4.2V, so I guess it might be a good idea to use the 3V pins since those measure 3.1V.

My 5V relays got 'stuck' at the ON position, maybe because the arc generated by the 350W power supply is too much for these (i tried 2 already).
So I am going to try the 3V version to see if they are a bit resistant.

05-08-2015, 10:08 PM
bolsoncerrado, this is an excellent step by step tutorial. You’ve actually gone into the details of how to place the circuit board inside the assembly and how to connect various terminals which to be honest, most people don’t do. Now I’m just waiting for Joao’s guide as well because together, you can actually present a general solution for clients.

quick turn pcb assembly (http://www.7pcb.com/Quick-turn-PCB-assembly.php)

05-09-2015, 09:25 AM
What are you now missing ricardo?

01-25-2016, 03:32 PM
We are looking for gcodes for engraving to put on our web site:

We already have some on Endurance web site. So feel free to send gcodes so we can upload them

06-30-2016, 04:24 PM
Hi everyone...i am new user here. I worked with Raspberry Pi during my hobby projects and as per my knowledge to have 5V you need to use additional supply to the relay, also coming from the RPi, but its an extra cable and I like things very optimised. The 5V from the RPi measures 4.2V, so I guess it might be a good idea to use the 3V pins since those measure 3.1V. It may happen that the 5V relays got 'stuck' at the ON position, maybe because the arc generated by the 350W power supply is too much for these.