Install a relay to turn power on and off



  • is there a link or can someone guide me on where i can install a software power switch i have a relay connected to the 240v input and i want to be able to switch it on and off with the web interface



  • https://www.duet3d.com/wiki/Power_wiring#Standby_power

    I don't believe you can use a relay to do such a thing, if you're using an atx power supply you can use the standby power feature as detailed in the link above.



  • You can use an external five volt power supply and a relay to control the 12v power supply and mains heaters.

    On my set up, i have an always on 5v power supply that sends power to the board, and then using the method that Dino linked to, the out of the psON goes to the 5v relay which controls my 120v mains to the heat bed, heat chamber, and power supply.

    You just need to make sure if you are controlling 120v mains, that you get a reputable relay. As mains is dangerous.



  • Its a good idea to break both the hot leg and the neutral. (in case of reverse polarity)



  • I'm using a wifi plug that detects the power consumption. I've setup it to shutdown the plug if the consumption is below the idle value, so after 5-10 minutes of the end of the print, if I don't start another print, the printer shutdowns automatically‚Ķ

    Regards



  • What make/model? I like this idea, I wonder if there a way to control it using the duet?



  • Is that the tp link smart plug? Doesn't octoprint have a plugin for it?



  • I keep seeing packs in shops with a handful of 433Mhz controlled wall sockets and a remote for silly money.

    And I stumbled across this nice article:
    https://www.rs-online.com/designspark/control-wireless-mains-sockets-with-arduino-and-raspberry-pi

    My (eventual) plan is to have the Octoprint server permanently powered; and control printers + some lighting using a bunch of these plugs and appropriate scripting; It looks pretty easy in theory.

    edit: 433Mhz, not 533 as originally written.



  • But useful as Octoprint is for controllers without WiFi and Web interfaces isn't using it with Duet just duplicating? Or do you think its worth seeing if the code can be incorporated into RRF?



  • I believe octoprints code is based in this: https://github.com/softScheck/tplink-smartplug/blob/master/README.md



  • For Octoprint I'll first get it up and running via std shell/python scripting; once I can run from the cmdline I'll just work out the correct YML to put in octoprint and bingo! I'll have power on/off buttons in the control panel.

    Doing this natively on the Duet should be possible, a worthy addition; all the libs and info you might need are available with suitable googling, and someone with the relevant skills (eg. not me..) should not find it too hard to connect a 433mhz transponder and plumb into the firmware behind the appropriate Mcommands.



  • @DjDemonD:

    But useful as Octoprint is for controllers without WiFi and Web interfaces isn't using it with Duet just duplicating? Or do you think its worth seeing if the code can be incorporated into RRF?

    Yes.. to both.

    • If someone took the time to get this working in RRF as a firmware option it would probably get used; the transponders are very cheap and just use a single data wire. The RF controlled switch packs are the sort of thing I see hanging on the aisle-ends in supermarkets and DIY shops a lot. By the time you have sourced a big enough relay, isolated and mosfetted it, connected to Duet and made it all neat and safe this might actually be a cheaper and easier solution.

    • Err; yes a bit embarrassing.. I already used Octoprint for my cartesian; If I only had the Duet web interface I'd be just dandy, but after commissioning and several weeks of using the Duet control I have got round to configuring a parallel Octoprint service for the Delta; though I still prefer to use duet web control for configging, testing and casual control as needed.
      With the resources of the Pi3 behind it Octoprint does a better job of managing files, multiple sessions, resisting disconnects, guest sessions, print history, it's impressive gcode visualizer, timelapse and more.. Customizing it is solid (if you grok yaml) so I have buttons for calibration etc. If anybody is interested I'd be happy to share my thoughts on this and my config, but lets not pollute this thread further (says the worst offender..)
      https://photos.app.goo.gl/Km9cT4PY9wjs9kuI2 has a shot of this in operation.. two printers+cams running, and 90% idle on all cores.



  • There are suitable relays that will just connect direct to psON https://m.fr.aliexpress.com/item/32839999205.html?src=google&albch=shopping&acnt=494-037-6276&isdl=y&albcp=774771304&albag=47555573664&slnk=&trgt=61865531738&plac=&crea=fr32839999205&netw=g&device=m&mtctp=&gclid=CjwKCAiAqvXTBRBuEiwAE54dcDnxVY6kvQcCgXNrZeAvdgEwVUiL7j-Vd2At8iSZwjfNL7jQ07_D6hoCtUcQAvD_BwE
    These have opto coupler and transistors etc.. So are quite safe and isolate the mains supply from the low voltage side. They also protect from flyback current when the relay switches. All you need is permanent 5v power for the duet such as USB charger.



  • it would be nice to control an Alexa plug socket is i wonder can there be any IOT integration in the future.
    as I have various IOT Alexa controlled wall sockets.

    IE Alexa turn off 3d printer would be nice



  • You could do that with an esp8266 and a 3.3v relay


Log in to reply