Welcome! Log In Create A New Profile

Advanced

Duet ATX power control

Posted by jstck 
Duet ATX power control
April 15, 2014 11:10AM
I was looking at the schematics for the Duet board, and saw there is a pin for controlling the power supply (middle pin on the J20 header if I'm reading things right). Has anyone used that? I imagine you would need a cable from there to one of the pins on the ATX power board. How should that be connected? Is there any firmware support for it?

It would be pretty neat to run the Duet board off the +5V "standby power" rail, and just turn on the 12V power (for fans, steppers and heaters) when you need to print stuff. It could also serve as an "emergency stop" to have a button that just disconnects that signal to shut the power off. The Duet could keep running (for troubleshooting purposes) but everything else would definitely stop.
Re: Duet ATX power control
April 15, 2014 12:25PM
Yes, the hardware is designed so that you would connect the 3 pins on the distribution board to the 3 pins on the Duet (header needs to be soldered in). Then by installing J10 and removing J9 the Duet picks up its power from the standby 5v rather than using the on board 12v to 5v regulator. In turn the Duet can turn on the main supplies on the ATX supply by pulling the central pin low. BUT as far as I can see there is no support for driving the PS_ON signal from the current firmware. Apart from adding low level support for this, the power on strategy would need to be worked out.

Without this you can still use the connector with J10 to power the Duet directly from 5V. I do this in conjunction with a modified ATX supply to give more stable and tweakable 12V output.
Re: Duet ATX power control
April 15, 2014 05:07PM
Quote
bobtidey
Apart from adding low level support for this, the power on strategy would need to be worked out.

Thanks for the info. I'll probably toy around a bit with the power control things and see what it does.

I think most useful would be to have a separate M-something command for powering ATX on/off, that you can put in the custom start/end G-code snippets, and have it power up on bootup. That way it would be 100% backwards compatible but still very usable.

I guess it could be possible to have M0 ("all stop") power down, and power things on whenever you start a heater or move a stepper motor, but such behaviour should probably be configurable.
Re: Duet ATX power control
April 15, 2014 05:26PM
That already exists
M80: ATX Power On
Example: M80
Turns on the ATX power supply from standby mode to fully operational mode. No-op on electronics without standby mode.
Note: some firmwares, like Teacup, handle power on/off automatically, so this is redundant there. Also, see RAMPS wiring for ATX on/off
M81: ATX Power Off
Example: M81
Turns off the ATX power supply. Counterpart to M80.

[reprap.org]
Re: Duet ATX power control
April 15, 2014 07:07PM
I haven't tried it but I don't think the M80 or M81 have been implemented yet in Ormerod Duet firmware.
Re: Duet ATX power control
April 16, 2014 03:12AM
Nope, don't see anything about it in the firmware source code. Should be a pretty easy thing to implement though, just turn an output pin on or off. Could probably do it myself if I could just get the thing to build...
Re: Duet ATX power control
April 16, 2014 03:58AM
I can add this to my next firmware build if you like.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
April 16, 2014 05:21AM
Quote
dc42
I can add this to my next firmware build if you like.

That would be severely awesome.
Re: Duet ATX power control
April 16, 2014 05:50AM
I've just implemented that in version 057zb, but haven't tested it yet. You are welcome to try it. The state defaults to off after power on or reset, but you can change that by putting an M80 command in config.g.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
April 16, 2014 09:03AM
Cool, I'll give it a spin.

BTW, does anyone have a schematic of the power-adapter circuit board? I guess I can measure my way out on what to connect where, but it would be nice with some solid documentation.
Re: Duet ATX power control
April 21, 2014 06:05PM
I finally got around to trying this out. Hooked up the cable between the Duet and the power adapter board, and I can now use M80/M81 commands to turn 12V power off and on. Here's how it's done:

  1. Get a new enough firmware, 057zb-dc42 or later. I got 058-dc42.
  2. Get an appropriate cable. I took an old RC servo cable and moved the cables (colors) around to make more sense. It originally had black (ground) in the middle as per RC servo standards, I put white (the "control signal") in the middle instead. The important part is that the cable just hooks up the right pins, so any "straight" 3-pin cable will work if you're careful
  3. Completely power the whole printer off. Remove USB, switch off (or unplug) the ATX power supply.
  4. Seriously, re-read make sure you've done the above.
  5. Connect the cable to the Duet, to the 5V_PS header right below the 12V screw terminals. The bottom pin is +5V (from PSU), middle is PSU control, top is ground, and the pins are clearly labelled. I used red/white/black for that, which seemed to make sense.
  6. Connect the other end of the cable to the power adapter board. There, things are not as well labelled, but ground is closer to the square PSU connector, +5V is nearer to the two red LED's. See attached picture. You probably have a jumper there (between the ground and "control" pins, which hardwires the PSU to be on all the time), remove that and save it.
  7. Put the jumper controlling where the Duet gets its power from in the right place if need be. Behind the ribbon cable for the bed heater there are two jumper headers, remove it from the 5V_EN one (the top one, if it is there) and put it on ATX_5V_EN (the lower one).
  8. Double check that you have the cable facing the right way at both ends (so that the three pins line up). I don't know if anything will fry if it is hooked up wrong, but you're probably happier not finding that out.
  9. Power up the ATX power supply. The firmware enables the power on bootup so it should all power up as normal, but you should now be able to use M80/M81 to switch it on and off. It's easy to tell, the hotend and the PSU fans both stop when powering down. When "on", both LED's on the power adapter board should be on, when "soft-off", just one of them (provided the PSU is still switched on).

See attached images for steps 5, 6, 7.

You can now for example put M80 at the top of the "start custom g-code" and M81 at the end of the "end custom g-code", to power down almost everything when the print is finished.

Again, thanks to dc42 for the firmware support.

Edited 1 time(s). Last edit at 04/21/2014 06:08PM by jstck.
Attachments:
open | download - 5_connector_duet.jpg (350.6 KB)
open | download - 6_connector_power.jpg (323.8 KB)
open | download - 7_jumper_duet.jpg (363 KB)
Re: Duet ATX power control
April 21, 2014 06:24PM
jstck, I'm glad you got it working. One word of warning: after the print has completed, you should continue to run the fan for a few minutes until the hot end has cooled down, before turning off the power with M81.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
April 21, 2014 06:41PM
Yep, I had that earlier as well, running the hotend fan for two minutes after turning off the heater (I got it hooked up so it is controlled via M106/M107). That's enough to get temperature down to under 100°C.
Re: Duet ATX power control
April 22, 2014 10:27AM
Thanks for the info jstck!

I am assuming that there is a transistor that just grounds the white wire to switch on the ATX PSU? I have one of these coming for my 30a PSU, but I am thinking it wants a high signal to switch it on. I guess I'll find out when it arrives.

Regards,

Les


Pointy's Things
Pointy's Blog
Re: Duet ATX power control
April 22, 2014 11:27AM
Quote
Pointy
I am assuming that there is a transistor that just grounds the white wire to switch on the ATX PSU? I have one of these coming for my 30a PSU, but I am thinking it wants a high signal to switch it on. I guess I'll find out when it arrives.

Yes, the output is an open drain small signal mosfet, that grounds the white wire to switch the power on.

If you will be switching the 12V supply, where are you going to get the 5V supply for the Duet from - a separate voltage regulator?

If your main reason for switching the 12V supply is to turn the stepper motors off, that could be accomplished more easily in the firmware. Perhaps I should make M80/M81 turn the stepper current on/off as well as controlling the ATX power supply signal.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
April 22, 2014 11:33AM
Rather than relying on a set time could the switch off ( M81 ) be dependant on the hot end fan being turned off by the firmware? At least that way a known temperature has been reached so it is safe to turn off.
just a thought


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Duet ATX power control
April 22, 2014 11:52AM
I guess I could make M81 first turn off all heaters and stepper motors, then wait for the hot end to each 40C or below, and only then turn off the ATX power. Although under some circumstances, 40C might be too low to be reached.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
April 22, 2014 12:42PM
I think it would be better to leave the existing commands doing the simple thing they do, but possibly implement some separate "shutdown procedure" command. And I guess since it's a fairly advanced topic, users would probably be fine with applying a few individual commands and appreciate the fine-grained control it gives them (at least I would winking smiley).

Another way of accomplishing it would be to put an optional timeout on the "wait for temperature" command (M109). For example, you could do something like
Wait for temperature to get to 100 degrees no matter what (no timeout)
Wait for temperature to get to 50 degrees, but wait no longer than 120 seconds
Shut down

Though if the temperature is already lower for whatever reason or the PID settings are just right, it might actually run the heater for a bit during that kind of cooldown. So, yet another option could be a separate "cooldown" command (not run heater, and just wait for a certain temperature to be reached for an optional maximum amount of time).
Re: Duet ATX power control
April 22, 2014 12:43PM
Quote
dc42
Quote
Pointy
I am assuming that there is a transistor that just grounds the white wire to switch on the ATX PSU? I have one of these coming for my 30a PSU, but I am thinking it wants a high signal to switch it on. I guess I'll find out when it arrives.

Yes, the output is an open drain small signal mosfet, that grounds the white wire to switch the power on.

If you will be switching the 12V supply, where are you going to get the 5V supply for the Duet from - a separate voltage regulator?

If your main reason for switching the 12V supply is to turn the stepper motors off, that could be accomplished more easily in the firmware. Perhaps I should make M80/M81 turn the stepper current on/off as well as controlling the ATX power supply signal.

5V could probably be obtained from the standby (always on) 5V that ATX PSU's have available. I switch off the steppers via the "M0" command in my end code, so no mods are needed to do that. I think the main advantage of switching the 12V would be safety (provided it is included in the firmware as well). If the firmware detects a runaway temperature situation (e.g. heater mosfet gone s/c), it could switch off the 12V supply. A secondary advantage is that it stops the fan running - though that could of course be connected to the Duet and controlled via firmware separately.

Dave
(#106)
Re: Duet ATX power control
April 22, 2014 12:51PM
Quote
dmould
A secondary advantage is that it stops the fan running - though that could of course be connected to the Duet and controlled via firmware separately.

Or you can use one of my hot end z-sensor boards, which turns the fan off when the hot end is cool.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
April 22, 2014 02:22PM
Quote
dmould

5V could probably be obtained from the standby (always on) 5V that ATX PSU's have available.

I think you get that automatically with this mod. The 3 way header onto the Duet is Gnd, PSON, and 5V standby. So when those are connected through to the power board and the ext 5V jumper used then the Duet is powered from the standby. There is an extra benefit in that this is a little cleaner supply than the 12V.
Re: Duet ATX power control
April 22, 2014 04:02PM
Quote
dc42
If you will be switching the 12V supply, where are you going to get the 5V supply for the Duet from - a separate voltage regulator?.

I was hoping I could get in from the USB

Quote
dc42
If your main reason for switching the 12V supply is to turn the stepper motors off, that could be accomplished more easily in the firmware. Perhaps I should make M80/M81 turn the stepper current on/off as well as controlling the ATX power supply signal.

I really wanted to turn everything off in case of a fault as well as at the end of printing.

This is why I asked about a charge pump/watchdog output in another thread. I know you have put some stuff in the new firmware, but what happens if the chip locks? I presume the firmware stops running, so would all the heaters stay on, could motors continue? If like Mach3 for example you put out a 12.5khz square wave signal on a spare pin, this could be monitored externally and shut off if something goes wrong.

Regards,

Les


Pointy's Things
Pointy's Blog
Re: Duet ATX power control
April 22, 2014 05:51PM
Quote
Pointy
I know you have put some stuff in the new firmware, but what happens if the chip locks? I presume the firmware stops running, so would all the heaters stay on, could motors continue?

If the chip locks, then the on-chip watchdog timer will reset it in a few tens of milliseconds. This is one of the improvements I added.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet ATX power control
October 09, 2015 01:15PM
Idiotic post sorry.

Edited 1 time(s). Last edit at 10/09/2015 02:50PM by Mike43110.
Sorry, only registered users may post in this forum.

Click here to login