Switching PSU on/off
-
Hi there. Yet another post about using a relay to switch on and off the PSU with the Duet Wifi 2.0.
I did my homework, but I haven't found an actual wiring diagram. Throughout my research I've found the last post in this topic interesting :
Thoughts on powering on/off Duet remotelyHere is the wiring diagram of what I understood :
Is it correct ? The L switch is for disconnecting the relay from power when I'm not using my 3D printer. The push button is to start the printer. This would allow to use M80 and M81 in my gcodes without having to power the Duet via USB for example.
I plan to use this power module : https://www.banggood.com/5V-1-Channel-Level-Trigger-Optocoupler-Relay-Module-For-Arduino-p-915614.html?rmmds=detail-bottom-alsobought__3&cur_warehouse=CN
I know that PS_ON operates on low level so I will have to plug the jumper accordingly on the relay board.
It seems to have optocoupler isolation, but what about the "flyback diode across the relay coil" dc42 is talking about in his post ?Thanks for your feedback and have a good day.
-
Yes that looks correct. No need for a flyback diode because that relay module has its own driver transistor and flyback diode.
-
Ok, thank you for your original post and this reply, I will do this.
-
@MickaelB said in Switching PSU on/off:
a relay to switch on and off the PSU with the Duet Wifi 2.0
did you implement this? some questions:
- will this approach allow to start the printer with a push button ? (how long the push should be?)
- would it be possible to switch printer off after print in automatic mode?
and for my understanding - why pushing ON button for a short while will keep printer ON ?
thanks!
-
I assume he uses the M80 in the config.g file, a LED connected to an output could be used as indicator that it is safe to release the Button.
The only thing I'm asking myself. The 5V on EXP1, where do they come from in case the PSU is switched off?
I want to be able to switch the PSU on via command OR Button. Is EXP1 powered with 5V even if the only connection to the Duet is via USB?
If this is not sufficient, an efficient 5V powersupply (USB Charger) connected to 5V input could solve the issue.
Just thinking loud as my Duet is not connected at the moment (rewiring my delta, thinking of having a 24V PSU for the heated bed only, but with this approach I could remove the ATX power supply).Cheers
-
@c310 said in Switching PSU on/off:
did you implement this?
Not yet, I am still doing the theory.
- will this approach allow to start the printer with a push button ? (how long the push should be?)
Yes, there is a push button Normally Open on my diagram. As for the duration of the push, I don't know but it won't be long, I guess you could tell with the LEDs on the Duet or the relay when it is powered on.
- would it be possible to switch printer off after print in automatic mode?
Of course, that's the whole point : just send M81 in your end Gcode and PS_ON will rise to high state (don't forget to adjust the logic accordingly on the relay module, usually via a jumper). This will turn the relay (hence the printer) off.
and for my understanding - why pushing ON button for a short while will keep printer ON ?
When everything is off, as the Duet board doesn't have any 5V input in this configuration, EXP1 doesn't supply 5V and PS_ON is not active. Which means that the relay is off. The push button is here to "jump start" the relay, by turning on the PSU, which will turn on the Duet, which will turn on the relay (assuming you added the M80 command in your config file). As soon as the relay is on, the push button is no longer needed to allow the L connection of the PSU. You can then release it.
@crynool said in Switching PSU on/off:
I assume he uses the M80 in the config.g file, a LED connected to an output could be used as indicator that it is safe to release the Button.
That's right, or use the existing LED as an indicator. I plan to connect a cooling fan for the Duet to the same 5V output as the one for the relay, so the fan starting up will be my signal to release the button.
The only thing I'm asking myself. The 5V on EXP1, where do they come from in case the PSU is switched off?
I want to be able to switch the PSU on via command OR Button. Is EXP1 powered with 5V even if the only connection to the Duet is via USB?
If this is not sufficient, an efficient 5V powersupply (USB Charger) connected to 5V input could solve the issue.See my previous reply in this post. This method is meant to avoid the use of an external 5V power supply for the Duet, as I want to turn off the printer AND the Duet board when the print is finished. The drawback is that you have to start the printer using the push button. If you want to start the printer remotely, say via the web interface, then you need a 5V input for the board (like USB). This will indeed allow you to draw 5V on EXP1.
-
I have actually implemented this on mine a few months back now, and it works perfectly for me. Answering a few of the questions that came up:
How long the push should be? On mine I can simply press and release the button. I have a Meanwell LRS 24V unit inside my printer and its startup is very quick. Within a second I can hear the relay engage (so the PSU is up, and supplying enough to get the Duet booted, read config.g and engage the relay). If you use a mechanical relay, you might be able to hear it engage; if your power supply have the capability to handle slight dips in power a shorter press of the button is all that is required.
Turning the printer off automatically after a print. Yes, it is actually quite easy. Either place the M81 in your ending Gcode (useful if you know beforehand that the printer should shutdown while unattended), or if you have the DWC you can enable the Auto Sleep after print option (and then ensure the M81 command is in the sleep.g file of the printer; this is useful if you realize the printer should shutdown after the print already started).
To make my setup slightly easier, I use a 24V relay connected between the PSU and PS_ON pin (the PS_ON pin, is simply a drain to 0V when enabled) with a protection diode. I am not sure if there could be other issues by using it with this higher voltage, but so far I have not experienced any (the only time there is 24V on that pin is for the few moments before the PS_ON is switched on and the few moments after PS_ON is switched off before the power drops).
If there are more questions, please ask.
-
I'm using an ATX PSU and powering the duet with the 5VSB from the psu which is active with the PSU off so I can use the duet to control the power supply. I actually just finished wiring up an external pushbutton with a normally open contact block that shorts one of the E#STOP pins on the expansion header to gnd. That with a M581 command in the config allows me to turn the PSU on via external pushbutton as well as from DWC. I set up another pushbutton to turn ATX off but it doesn't work for some reason. Though I also have a button wired to pin 44 to reset the board and that also turns the PSU off so I guess a dedicated ATX off button isn't necessary.
-
I am interested in building what the @MickaelB described in the first post. Only my purpose is different. I want to have it solely as an emergency cut-the-power-function. This means the PSU must not turn off on a simple reboot of my Duet.
I think this can be achieved by setting the jumper so that the relay will close the circuit on the default level of
PS_ON
pin and shutting down will then be realized by usingM80
- which usually is meant to turn the PSU on but I don't care for this reverse logic.What I like to know is if there will always be 5V on the external 5V rail as long as there is power to the Duet? Because that would be required to keep the relay closed even across a reboot.
-
Just a few things you should note about the design of the board, related to what you want to do (I am using the image at https://duet3d.dozuki.com/Wiki/Duet_Wiring_Diagrams as reference):
- +5V (at the PS_ON) is a 5V power input - you have to supply this 5V and then select the External 5V Jumper* to power the Duet from the supplied 5V. By default the internal regulator is used to create 5V from the voltage input (Vin) and from whatever 5V is used, the 3.3V is regulated from it. The Ground at the PS_ON is common between all power (Vin, 5V and 3.3V).
- The PS_ON pin is floating when "Off" and Ground when "On" - this is how I wire a 24V relay through it (while off, it is floating at 24V and no power runs through; when on, it is pulled to ground, creating the 24V needed by the relay to switch). The reason this pin works like this is ATX power supplies have an always on 5V rail (which simply to to the +5V In and the Ground for the common reference) and a PS_ON wire, that switch the main unit on, if that wire's 5V is pulled to Ground - this allows the board to switch the main 12V power on and off, when it is needed (heaters, fans and steppers).
For you idea to work, you will need a 5V power source to feed in at the +5V and Ground of that connector, that will supply power even when the power supply is off. Many people simply use a USB charger to give the 5V via the USB port (as that is also a viable option to power the board - you can then pull the 5V out to your external circuit via the 5V Fan Jumper Select, if you don't use 5V fans).
You will have to then decide how to use the PS_ON pin, to achieve what you want. Personally I would rather build a signal invert circuit, so that On means 5V and Off means Ground and then it can run what you need.
Remember that on startup the firmware have the PS_ON pin floating aka Off until it is turned on by command- if Off means it enables your power supply, just keep in mind failure modes**
*-The jumper is part of the jumper group near the fan outputs. The 3 pins is where you select fan voltage (and can find the +5V used by the board), the next one have by default a jumper on for internal 5V regulation (the 5V regulator have an enable pin which needs to be pulled to ground to enable) and the 3rd one have no jumper to select the external +5V from the PS_ON connector.
**- I once used an inverted signal to power a heatbed, and it once heated up due to not getting the signal to remain off - I fixed it immediately after I noticed.If I understand correctly from your description, you want to wire the relay in its Normally Closed position, so that the mainboard can Open it and shut the power supply off. If the Duet runs on the same power as what is coming from the power supply, it will shutdown as well, releasing the relay back to the Closed state, switching everything back on.
For your use case, I would simply use it as intended: provide a consistent 5V to the board, have the relay between the 5V and Ground, using a Normally Open contact. This way the Duet keeps running, and when you need high power, it can switch the power supply on for high power and shut it down when it is done.
-
@jacotheron OK, I actually did not realize that the
+5V
pin next toPS_ON
is an input. But that does not stop my plan I think.Also you are right about
PS_ON
being floating as a default value is problematic so I would probably introduce a pull-up resistor (or a similar approach if that makes more sense) to have it at 5V by default and pull it to ground to switch the relay off.I definitely want to run the relay in Normally Open configuration but have it automatically close the circuit as soon as it gets powered and only open the circuit again on signal or power-loss. To prevent the latter I of course need a consistent 5V power supplied to the relay by the Duet.
As I wrote I though I could use the pins next to
PS_ON
by putting a jumper toEXT 5V EN
but you pointed out that this won't work as it is an input. But there are other 5V output pins on the Duet like on thePANEL DUE
header or the one on the fan header (I am using my fans atVin
). What I am looking for is any pin that will output 5V as long as the Duet is powered viaVin
and that is not affected by a reboot/reset.I do not want to add any additional 5V power supply. So if there is no constant 5V pin on the Duet I will switch to a (totally) different solution.
EDIT: Looking at the status LED for the
+5V
rail (next to the ones forVin
and+3.3V
) it does seem to be stable even while holding the reset button pressed. So that is a first indicator that this might be possible. But a confirmation that there is also a pin that will output these 5V unconditionally would be great. -
@jacotheron said in Switching PSU on/off:
Remember that on startup the firmware have the PS_ON pin floating aka Off until it is turned on by command- if Off means it enables your power supply, just keep in mind failure modes**
Just to confirm the PS_ON pin is pulled down not floating:
This is the safest way as it requires the Duet to be instructed to turn on the power supply.
-
@t3p3tony said in Switching PSU on/off:
Just to confirm the PS_ON pin is pulled down not floating:
That gets me another step closer to my goal. Could please also confirm (or deny) that there is at least one pin that delivers +5V unconditionally as long as
Vin
is powered? -
@wilriker The 5V comes from 3 possible sources:
- USB input - only present when USB is plugged in obviously
- On board 5V regulator - only present when VIN is supplied and the onboard regulator is enabled using the jumper (normal configuration)
- the external 5V input on the 3 pin PS-on header - only present if you supply 5V seperately (this is designed to allow an external power supply to have the main powered turned on and off as required with the Duet remaining powered - like a PC using the ATX power supply)
Once there is 5V on the board (from any of the three sources described above) it is present at various points:
- Expansion header
- Panel Due header
- Conn_SD
- V fan select.
HTH
-
@t3p3tony That helps a lot! Thanks. I think I should be able to implement what I am planning then.
-
-
-