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

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

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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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. (...it 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.

Comments

ioanniskar (author)2015-04-08

hello agan,

I' like to be able to use my machine with a LCD/SD card module when it's not connected to my computer. Without the USB connection the RAMPS doesn't get 5V and I won't be able to turn on the PSU.

I conneced the power cable to NORMALLY CLOSE pin of the relay but the PSU is turning on and off each second. Is it possible to invert the behaviour of PS_ON pin?

Googliola (author)ioanniskar2017-11-07

I'd like to use my printer without USB connection (and no external 5V input to RAMPS). So wiring the relay with NORMALLY CLOSE seems to be the only option. But is it safe to do so?

ioanniskar (author)ioanniskar2015-04-08

I have changed #define POWER_SUPPLY from 1 to 2 (from ATX to X-Box 360 203Watts) and it's working as I wanted to. Maybe the X-Box 360 power supply uses an inverted logic to turn on and off.

MindRealm (author)ioanniskar2015-04-08

I was just about to suggest the same thing...

Googliola made it! (author)2017-01-01

Thanks for sharing

vlado4 (author)2016-02-15

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.

MindRealm (author)vlado42016-02-15

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 http://reprap.org/mediawiki/images/9/91/Rambo1-2-schematic.png

Proceed at YOUR OWN RISK!

StefaanC (author)2016-01-29

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 .

ioanniskar (author)2015-03-02

Great instructions, exactly what I was looking for. I have some question about your setup.

Why did you use a two-relays module? Do you have the yellow (signal 2) wire anattached?

Why didn't you get GND for the relay from the V- of the PSU? You could have just 2 wires from the PSU to the ramps board that way (5V and signal). Am I missing something?

Have you connected ground of AC with -V of DC on the PSU?

I have a 20A PSU without a fan. Do you think I should install one?

MindRealm (author)ioanniskar2015-03-02

Hi, and thanks for the comment...

Why did you use a two-relays module?
I used a two-relay module because I didn't have a single-relay module at the time. I have since replaced it with a single-relay module.

Do you have the yellow (signal 2) wire anattached? 
No. It was connected to the second relay input, but not connected to the RAMPS board. It is not connected at either end now.

Why didn't you get GND for the relay from the V- of the PSU?
I used the RAMPS board connection for GND to ensure that I was using the same ground potential as the Arduino/RAMPS boards.

You could have just 2 wires from the PSU to the ramps board that way (5V and signal). Am I missing something?
By using a multi-conductor cable from the RAMPS to the power supply, it really wouldn't have saved me a wire picking up the ground in the PS. Picking up the GND on the RAMPS simplified the connections (all terminated with Dupont connectors at labelled pins on the RAMPS) and made the Instructable simpler (and safer!)

Have you connected ground of AC with -V of DC on the PSU?
No. I have not mixed the AC and DC wiring on the PSU. (Not a great idea...)

I have a 20A PSU without a fan. Do you think I should install one?
It would totally depend on the performance/efficiency of your PSU. If it is well ventilated and the doesn't run hot, there is no need for a fan. That being said, it never hurts to cool a power supply, and you will only lose a little current running the fan.

-David

avluis (author)2015-02-20

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: http://www.makershed.com/products/powerswitch-tail-ii

MindRealm (author)avluis2015-02-21

Hi!

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...

avluis (author)MindRealm2015-02-22

Unfortunately, I have the RAMBo 1.2d: http://reprap.org/mediawiki/images/b/ba/Rambo1-2-c...

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.

avluis (author)avluis2015-02-22

Here is an schematic for this that I am looking over to see if I can do this somewhere on the board itself: http://reprap.org/mediawiki/images/9/91/Rambo1-2-schematic.png

SteveRoy (author)2015-01-13

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

About This Instructable

19,489views

53favorites

License:

Bio: Hi! I'm a technology nut, dabbling in everything from mobile electronics to computers to 3D printing to website design and hosting. I work for ... More »
Add instructable to: