Converting 12v/24v Power Supply to Remote (G-code) Switching

Introduction: Converting 12v/24v Power Supply to Remote (G-code) Switching

About: Hi! I'm a technology nut, dabbling in everything from mobile electronics to computers to 3D printing to website design and hosting. I currently build and repair 3D printers. Thanks for stopping by, stay safe!

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
  • Solder
  • #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!!)

  1. 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!
  2. Remove the six Phillips screws along the lid of the power supply. Do not remove the screws from the fan.
  3. Remove the cover and unplug the fan from the board. (You will need to cut the "inspected" label)
  4. Remove the center screw from each of the two heat sinks, holding the bracket so it will not turn or fall onto the board.
  5. 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!)
  6. Remove the five Phillips screws from the circuit board. (one on each corner and one in the middle)
  7. 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!

  1. 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!!
  2. 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!)
  3. Solder the ends of the wire into the two holes where the fuse was removed.

Step 3: Put the Fuse Back in the Circuit

  1. Cut the wire approximately 1-1/2" from the circuit board on the side that is near the screw terminals.
  2. Strip and tin the ends of the wire where you just cut it.
  3. Solder the ends to the fuse as shown, making sure NOT to hold the fuse with your fingers while soldering it.
  4. Cut the wire in the middle, so that each end is the same distance from the circuit board.
  5. 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

  1. Route the two wires away from the screw terminals, cutting them both even with the black component marked BD1 on the board, as pictured.
  2. 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

  1. 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.
  2. Locate the relay module on top of the black component (BD1) and the neighboring capacitor (C10).
  3. Connect the two wires to the COMMON and NORMALLY-OPEN terminals on the relay module.
  4. 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.
  5. 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

  1. Place the circuit board back into the chassis, making sure that none of the new wiring is pinched or routed beneath the board.
  2. 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.
  3. Hold the heat sink brackets and loosely reinstall the two long screws. Do not tighten them yet.
  4. Reinstall the five Phillips screws in the circuit board (one in each corner and one in the middle)
  5. Tighten the two heat sink bracket screws.
  6. Route the control wiring out of the chassis, exiting near the power LED and voltage adjustment pot.
  7. 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

  1. Reconnect the power cord wiring and the 12v (or 24v) output wiring to the power supply.
  2. 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.
  3. 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.)
  4. 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)
  5. 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.

  1. At the G-Code prompt, type M80
    This turns on the relay module, resulting in a click and the power supply should come on. ( may already be on)
  2. 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.

1 Person Made This Project!


  • Anything Goes Contest

    Anything Goes Contest



3 years ago

Great Instrauctable. Just one question, what if i don't wanna use power from USB. I'm using LCD on my Ramps 1.4 and don't need USB cable. So how can i keep my Ramps ON ?
I'm thinking about tearing apart a regular 5v phone charger and place it inside the case. But i don't know where the (+-) of that should go to.


Reply 3 years ago

You'd need to use a wall charger, not a vehicle charger. The high voltage inputs (the plug) from the charger would connect to the same screws as the 120v wall cord connects to the power supply. Since this is AC power, there is no polarity. The low voltage outputs could then connect to the RAMPS: Positive 5v DC to the 5V terminal beside the reset button, and the ground at any of the GND or - terminals, the closest being in the AUX-1 section on the other side of the reset button. The GND terminals are the 4 terminals along the edge, marked with a minus (-) sign.

This should power the Arduino with 5v for the logic only. Please let me (us) know if it works as you expect.



Reply 3 years ago

Ooh how stupid i am. i was putting the arduino on a metal part when testing and when i plugged the USB cable the board moves and short circuits some soldering under the board :))). I wonder it happened three time. OK man, IT WORKS PERFECTLY without any problem. thank you


Reply 3 years ago

Thanks for the reply. i tried what u said right now and IT WORKED, BUT as soon as i connect the USB cable to the arduino it stops responding. I know i said that i don't wanna use it but sometimes we may have to connect the USB to transfer a file. I connected the positive to VCC terminal beside the reset button and the GND to GND of AUX1. Here is what i get in pronterface after hooking USB cable:
[ERROR] Could not connect to COM8 at baudrate 115200:
Serial error: Cannot configure port, something went wrong. Original message: WindowsError(31, 'A device attached to the system is not functioning.')
I think something is interfering with the USB.


4 years ago


Please correct me if I am wrong.

You are breaking AC power on fuse. So why not breaking AC power before it gets to power supply? It would be easier.


Reply 4 years ago

Sajovicd - Thanks for asking.

Interrupting the power inside the power supply provides a measure of protection since the high voltage connections remain inside the protective enclosure and only low voltage connections are needed outside the enclosure, except for the original screw terminals, of course.

Plus, I didn't want another component between the wall outlet and the screw terminals.

If you want to install the relay outside of the enclosure, please exercise caution and provide some means of protection (3D print an enclosure for the relay?) to prevent shock.



Reply 4 years ago

Thanks for you fast reply...
I am a little woried about relays if they will survive the "sparkling" inside when powering the power supply.
I am looking for a solution of somekind "soft start"...

Thanks again


6 years ago

Very nice instructable. I setup the relays, power supply, etc. with the Rambo controller. However, there is somewhat of a problem. I have Rambo rev 1.2h which has isolation between the USB power and the other power rails. So when the relay for the power supply is switched off, there is no power to the Rambo board.

The 5V pin next to the PSU_ON pin (pictured in the comments below) does not have any power when the power supply is off.

I don't see an easy way to resolve this issue... Perhaps a separate power supply (e.g. wall wart) which has 5V to the 5V pin? This would power the Rambo board even when the main power supply has no power and let the logic board stay on. Not sure this is a correct way to do it and what additional circuitry is needed to make this legit. For example, would there be a conflict between the 5V power coming from the two power supplies when both are on??

Seems this is a bug with the Rambo board and I have not found a solution or good documentation for this issue after much googling.


Reply 6 years ago

It looks like the 1.1 boards had a PSEL jumper to choose whether to power the board's 5v logic from the power supply or the USB, but this is absent on the 1.2 boards. I suggest unplugging the power supply inputs from the board and connecting the USB. This should power the board. If so, then use a volt meter to check to see if 5v is present at pin 1 of any of the following connectors: SPI, ICSP, I2C.

If so, you can use this 5v for the relay power and pick up the signal in the PS_ON terminal beside the power inputs.

DISCLAIMER: I have no experience using RAMBO boards. This information is provided from examining the schematic at

Proceed at YOUR OWN RISK!


6 years ago

Hello ,i like the modification

I have a Rumba board do you now with pins connect to ?

what is the G code to switch on and off ??

Kind regards stefaan .


7 years ago on Introduction

I take it that the RAMPS board gets powered on via USB so it is able to send the 5v to power on the relay.

Unfortunately I am using a RAMBo 1.2d which isolates the USB from the Arduino side so if I want 5v, I need the power~

I am thinking I can implement this a bit different, but will take some good tinkering.

Does this look like a good alternative while I work out the power issue:


Reply 7 years ago on Introduction


The part that you linked is switched in exactly the same way as the relay module in my Instructible. It requires + and - voltage and an on/off signal wire. Here's where you'd make the connections on the RAMBo board...


Reply 7 years ago on Introduction

Unfortunately, I have the RAMBo 1.2d:

So I am not seeing the 5v input (standby pin) - but I do have the PS_ON pin.

I am planning on using a Raspberry Pi 2 for OctoPrint as a print server so that will always have power - I could use that to trigger the power supply on - only issue is that I wouldn't be able to use the G-code to trigger it would I.


Reply 7 years ago on Introduction

Here is an schematic for this that I am looking over to see if I can do this somewhere on the board itself:


7 years ago on Introduction

Great Instructable - since I need to replace a noisy fan in my i3 power supply I may as well add a relay!