Using OctoPrint with PSU Control to turn off and on your 3D Printer.
Вставка
- Опубліковано 5 вер 2024
- In this video we wire up a simple 5 volt mechanical relay between our printer and its power supply. Using OctoPrint and a Raspberry Pi we can then turn the print off and on via the relay and a GPIO pin on the Pi.
Visit our forums for the full parts list used in this video.
www.crackedcon...
Hey man, this is very dangerous. Your relay is rated for 10A and the printer can output up to 15A on the DC side - FIRE HAZARD!!!. Safer would be wiring it on the AC where the current is smaller. I know that you would lose the ability to power the RPi directly but safety should come first. I guess a higher-rated relay would do the job but I would still be more rested cutting the power to the power supply.
I know more people have brought that up in the comments and you have acknowledged but they are too far below for people to see. I really think you should address this in the video and description.
I am grateful for your videos and see that you are helping a lot of people but this specific issue can become a tragedy for someone. Thanks and good luck on your channel
Yes, I agree with all this. Here's what I have done for my Ender 3 V2:
1. I built an enclosure for the printer and pulled all the electronics out (minus the steppers and limit switches, of course) and mounted them inside their own enclosure that sits on top of the printer enclosure.
2. I used the same relay as in this video, but I wired its N/O output in parallel with the physical power switch, and control the relay via OctoPrint on my Raspberry Pi. The relay is in parallel so that the physical on/off switch will still be usable should I have a relay or Pi failure.
3. The Raspberry Pi is powered on a separate wall outlet that has a smart plug that I can control with my Amazon DOT.
4. I also have LED lighting and a charcoal air filter inside the printer enclosure, both of which are powered by a buck converter inside the electronics enclosure, and both of which are separately controllable via OctoPrint.
So, I turn on the Pi remotely with my Amazon DOT, then load up OctoPrint in a browser and use it to turn on the printer power and optionally the internal LED lighting and/or air filter. Works a treat and greatly reduces the number of trips I have to make to my garage where the printer is kept.
Next project: build a servo/OctoPrint-controlled nozzle wiper so I don't have to go to my garage just to "wipe the printer's nose" before it commences a print. Gonna be fun.
I know Im pretty off topic but does anyone know a good place to stream new series online?
@Remy Miller meh I'd suggest Flixportal. You can find it if you google:D -caiden
@Caiden Cristiano thanks, I went there and it seems like they got a lot of movies there :) Appreciate it !
@Remy Miller glad I could help :)
Thanks for video
It's normally open, COMMON and normally closed
Instead of switching the 24V side do it on the AC side.
Get a relay module which already has an optocoupler included.
That way you can turn the printer completly off, including the PSU.
For the RPi, just use a 5v power supply.
That way, if something happens, you can switch the whole printer off (safer).
As i'm finishing my enclosure, i'm thinking about including a smoke detector and temperature sensor.
Write some code, and just let the RPi monitor the inside of the enclosure ambient. If something goes bad that is detectable by the sensors (supoosing there are no bugs), just let the raspberry pi shut the printer automatically off.
wifi socket on the lot is what i use, simplest solution that and a fire ball in the enclosure. No playing with the electronics and so much simpler.
Also better for the relay since the most can only handle 10 amps
@@sitgesvillaapartmentneilsc7924 can u explain to me how to do it? Thank you
@@--3D all I use is a normal wifi socket on my printers cables /cabinet where it sits, that connects via wifi back to alexa from amazon and I can tell alexa to switch it on or off or do it from my phone, alternatively you can use a small relay and add some gcode to the end of your program that sends the x azis up to the top of the gantry hits a microswitch which turns off the ac power, because that would have 220 volts in it or 110 you would have to ensure that its safely enclosed and the wires can. not touch the frame, that way at the end of the job the x gantry rises and switches off, in cura you can set some finishing gcode that can lift the x gantry to the top. The fire ball is from amazon and as my machine is in a steel cabinet with a double glazed door on it it hangs at the top of the cabinet , should the printer catch fire then the fire ball will pop and put out the fire i hope, but to be honest the safest bet is not to leave your printer. Hope that answers your question if not please be more specific and I will try and help.
@@sitgesvillaapartmentneilsc7924 thank you so much for your time and answer.
You gave me a lot of options to think about.
I have a sonoff switch laying around I think is 10Amps. Do u think it'll work for an ANET A8 PLUS
thanks for posting, I didnt realise the plugin was available, I have done a similar thing a couple of years ago on my old a8, but I used the relay to switch the mains side using 2 shell scripts on an orange pi zero, they are runable through octoprints menu, I prefered to switch the mains side rather than the low voltage side as that way the psu is completely off when not in use
I've seen a couple of people do it at the mains side, either with the plugin or without. Since I had already connected my Pi to the printers PSU, I went this route. Though I still do shut off my printer each night when in use. (at the PSU)
Great video! Your quality is improving and it doesn't sound like you are whispering over top of porn music anymore. Looking forward to more content.
You really should use a transistor, mosfet or a transistor driven by an opto isolator on the GPIO line. The Pi's GPIO are wired directly to the Broadcom CPU and are not really capable of driving a relay coil. A flyback (reverse biased) diode across your relay coil is pretty essential to prevent the induced back emf from spiking right back into the Pi's CPU. Sure, many relay modules have this all on the PCB but you should warn folk not to wire a relay directly to the GPIO and the "Closed" contact is correctly called the "Common" just to be consistent. HTH, G
SSR is a better solution as well, more rugged, no back EMF, no movable component hence no possibility of contact welding. I preferred to go for another XT60 cable instead cutting those in place, with a splitter and step-down i am able to power the RPi too.
This relay Is really operated by the Pi's 5 vdc, The 3.3 vdc GPIO voltage simply switches on the relay boards on board switching transistor that applies the 5 vdc to the relay. Not as good of isolation as an optocoupler but plenty good for this application. It's amazing how many people think the 3.3 vdc is what actuates the relay. But you are right, using this relay board is fine but you do need to be sure that the relay you use has those on board components. Hope this clears up things a little
great videos im still getting a under voltage running through the power supply so i switched back to a raspberry power supply but i love the mods that you have
Interesting video I will try to the same in my ender 3 Pro... just a little suggest: the C on the relay means Common not Closed... so we have Normally Open, Common and Normally Closed ;)... Escuse me for my poor english
You are correct, in my late night editing binge I missed that detail.
Good call!
I've got a couple questions I hope you can answer.
1. Are you powering the RPi through a wall brick or off of the printer's power supply? I saw that you plugged in a USB cable on the Pi's USB power port but I can't tell if it goes to a wall brick or if you modified the cable to grab power from the printer's PSU. My goal is to do just that and grab power from the printer's PSU when flipping the printer's power switch without that actually turning the printer on and then turning the printer on via OctoPrint and PSU Relay Control. So I hope that's possible.
2. What do those 2 white switches on the side do? It looks like the top one controls the printer's overhead lights. Does the bottom one just control the hotend lights? Or does it do some other cool thing?
Thanks for the video, it's helped me understand the setup I'm aiming for a bit better as well as given me some new ideas!
very strange I wanted to test the plugin first. Used jumper wires to connect the relay. That powers up but with minimal settings it refuses to switch.
You don't wash the screws before use???
I just bought a $7 wifi smart outlet
Yeah, plug & play, as well as turn off, and on :) Alexa controlled also ;)
Considering the DC output of a lot of printers (like the ender 3) is 15A and the relay you're using is 10A... couldn't this be pretty dangerous? If the system ever pulled the full load then that relay connection would burn.
Mine has since been replaced. I had one sitting around that I used in the initial build but have replaced it to match the Ender 3's output.
@@lifeasanerd4202 can you provide a link to the new relay that you used?
@@JoshKindhart amzn.to/35YzBt5
But also amzn.to/2QiGCP5 could be an option. Both are rated at 30amp 240v AC
@@lifeasanerd4202 The first relay does not have a transistor/mosfet driving it. Using that likely will kill the output port short/midterm...
@@thinking-laaf That is a possibility, though in the year its been in service, no issues as of yet.
Hi, I'm not very good at electronics, but I have a question. This relay says it is for 10A and the Ender 3 PSU say at 24V with 15A, no problem if you use it at maximum print temperatures to burn something? And other question, if use led strip, just conect at same wire to power with motherboard of printer? thanks and sorry for my poor english.
I have yet to have issues with mine and I print at 210c with 60c bed and fans at 100%. Longest print I've done with this setup is 12 hours. No overheating or burnt parts in my case.
As for the LED strip, I used a Buck Converter coming off the same print power wire. The Buck Converter allows you to adjust the output voltage so I could lower it to 5V for the LEDs to be powered.
You need to switch your AC input, not the DC output, and, why you solder the cables to the raspberry pi, you can just put Dupont conectors at the end!
The point of this video is to demonstrate how to run the Pi off the printer PSU, with out needing an external power supply.
If that is what you are looking for, I'm sure there are plenty of videos on how to do that.
At 7:03 - 7:06 your wiring diagram changes the positive and ground pins... which pins are the correct ones?
Looks like an editing error on my side. Good catch!
The first 2 pins are 5v the 3rd pin is ground
Hey man thanks for your tutorial, I've a orangepi and using the system command to power off and my printer. Can I power off my orangepi at the same time?
I haven't seen a way to do so via the PSU Control Settings.
But OctoPrint does allow for custom GCODE scripts, you could create a shutdown script for your OrangePi, tie it to a custom GCODE and then add that GCODE to the shutdown commands on the PSU Control plugin settings.
I've seen this tutorial from other youtubers using the COM and NC for the power but you suggest to use the NO. Is there a difference in the setup to use the Normally Open instead of the Normally Closed?
NO means by default the printer will not be getting power. I have to either log into the Octoprint UI and tell it to activate the relay or set OctoPrint-TFT's plugin to "Auto power on" at boot.
In the event of an issue or failure and the relay loses power, it kills power to the printer.
I see it as kind of a fail safe.
Great explanation. Thank you.
Thanks for the video!
is 10A relay enough?
depends what printer and the max power output of the power supply the printer uses
I know the ender 3 needs a 15 amp iirc
I think it has a 350 watt supply that can do about 15 amps at 24 volts
@@BenCos2018 I was thinking the same thing. I'm probably going to switch the AC rather than the DC on my setup.
@@benjaminlately yeah
I'd be careful with switching the ac though (make sure it's unplugged fully before you touch any of the wires though)
@@benjaminlately switching AC is going to be inconvenient because now you need an independent PSU to run the relay and rpi.
Did you not have trouble switching that 5v relay with the Pi's 3.3v gpio logic pins?? I know the Pi has a few 5v power pins, but all the logic pins are 3.3v
There are no issues switching the relay with the 3.3v logic.
@@lifeasanerd4202 hmm, it must just be a luck thing then with some 5v relays, because I've seen some people say it doesn't work and others say it DOES work. I have a 5v dual relay board I use with arduino (specifically a ywrobot brand) and I tried it with my Pi and it doesn't work. It will trigger but it won't release.
I have mountet the relay like you say, but the usb cable from the pi to my cr10 pro keep the motherbord powerd up. how do i fix that?
The relay should be wired in between the power supply and printers mother board.
It's purpose is to control power from the supply to the motherboard.
You ha e to cut the 5V wire in the USB cable.
couldn't you have cut the power cable going to the wall as well?
That relay is only rated for 10 amps. 10x24v = 240w. Much less than I was reading the ender pulls at peak. Have you had any issues with this?
You are correct, I've since replaced the relay.
At the time I was only printing PLA at low to moderate temps and did not have an issue.
@@lifeasanerd4202 i think you should edit the video to avoid confusion
hi i followed your instructions and it shuts off the psu but not the screen,is there anything else i can do?Thanks
The Pi itself and Screen should all be powered from the PSU via the buck converter in this example. Thus when the PSU is completely powered off the Pi and Screen are as well
Much better would be to switch the AC side. There are lower currents and PSU will be completely off, so it is little bit safer.
It was done this way, as the Printers Power Supply is what is powering the Raspberry Pi.
If you utilized and external dedicated Power Supply for the Pi, this option would work.
I followed your steps. But i am using RPI 3A+. And it does not trigger the gpio signal to my relay at all.
The 3A should work as well, be sure you have the correct PIN setup in the Octoprint settings
you are overpowering your relay... it can only take 10 amps...
Yes, this particular relay can be used on mains electricity at 230V though so it's a similar process but on the mains cable. I have a 5Amp fuse fitted in my mains voltage cable to ensure the relay cannot be overloaded.
you need a 15amp on the ender iirc
@@BenCos2018 since a 5amp fuse will break way before 10 or even 15amps are drawn, this seems way more than reasonable.
It looks lite Octoprint automatically connects to the printer after powering on the printer. Did this require any configuration? I have to manually press "Connect" after I power the printer on with PSU Control. I'm controlling the AC power of the printer PSU.
Depending on how long I wait to load up the Octoprint web UI after starting my printer.
If it is right away, it autoconnects, if its abit long I have to manually connect.
And if its real long, it will just give me an error and I have to reboot.
This there a particular relay you recommend? I've heard some people suggest 3.3v relays instead, also want to make sure I get one rated for the right amps for my CR-10S Pro V2.
The one used in the video was only a 10AMP, but I only printed PLA with a low bed heat if any heated bed at all.
This is a high amp 30AMP relay that may be a good substitute
amzn.to/2XGqKKX
My 3d printer go on if I close the settings. And after that it doesn't work? What is wrong? In the other app I can turn the realyy on and off, there it works but octoprint won't) :
Power off won‘t work
Octoprint running on a Pi communicates over a USB cabel connected to the printer. If you open the relay with PSU Control you cut the power from PSU to the printer. But the Pi sends still 5V over the USB cabel to the printer. The printer will not run this way (not enough power) but it is definitly not completly powered off. Fan for example is still running .......
You wire the relay between the PSU and the printer. The PSU will stay powered and you are just breaking the connection between the PSU and Printer. There are other ways to control power of your printer. This is the route I choose and it works fine for my needs.
Great but does this mean the pi is still on all the time when the printer is off as otherwise how do you turn the printer on and off, would it not be easier now just to use a wifi socket to do this and kill power to the pi and the printer? Just checking so I understand the electronics are not needed anymore. Thanks.
Yes the Pi is always on in this situation.
It was designed this way for this specific tutorial to use the existing Printer power supply.
I've been debating doing a second how-to for other options such as what you mentioned.
@@lifeasanerd4202 Ok thanks for the answer, I have resolved mine, I bought a pack of 10 decent power monitoring wirif plus that can kill both poles of power and I use those now, I have one set up on the printer , the pi takes its power from the printer and one set up on the workshop lights, What I do now is close the pi via octoprint and then tell Alex to switch off the 3d printer and switch off the workshop lights, God it saves my knees going up and down the stairs and gives me peace of mind that its all off,.
I just feel the relay doesn't give you enough control to turn off all the power at source. I also now have built in to my workshop a wifi 30 amp fuse board trip switch which I can in fact switch off all the power to the workshop completely, That an a ip camera in the workshop I feel happier now its safe.
I built a similar circuit, but when I power off the printer the printers LCD screen starts to screech because the 5v from the USB/PI is still powering the LCD. What is the fix for that?
You ha e to cut the 5V wire in the USB cable.
Or blank off the live tab on the usb plug with a small piece of insulating tape (there is a blanking piece to be printed on thingiverse but I could never get it to print satisfactorily)
hi
thanks for the tutorial
but the pi should boot up as soon as i switch the psu on
is that right?
in my case the pi seems not to get any current
so does the printer
if i switch the cable on the relay from NO to NC
the printers turns on
what am i doing wrong?
thank you
Are you splitting the power from the printer PSU and running 1 set of power into the relay to power the printer, and the other into a step down converter (Buck converter in this case) into your Pi?
Check the voltage coming out of the Buck converter to assure its 5v and can power the Pi
@@lifeasanerd4202 that's what I am doing, I had to adjust the buck converter to 5v, it was giving 19v
When I switch the printer on, it starts, then it switches off, then u hear the relay and it switches on again and stays on
@@derui75 The printer power supply should go into the buck, then down to 5v to power the Pi.
The Pi should then control the relay. Does the Pi boot and work with just a standard Pi power supply?
if your having problems with the relay because it always stay ON try this : community.octoprint.org/t/psu-control-relay-wont-switch-off/3428/27?u=seltix
Ok uused 5v grnd and gpio 2 so no3 in the circle, in settings i set up everything like u said, but nothing happens, if i plug in power my printer is on straight away
Do you have a multimeter handy?
Check to see if the Pi is sending power to the relay on boot and causing it to activate and check the pins coming out of the Relay (NO / NC and Common) to see if the relay is activating, or if the wiring is backwords.
@@lifeasanerd4202 both the red and green led a on on the relay and i connected no and closed
@@lucbisschops Swap between NO and NC on your relay and see if that makes a difference?
@@lifeasanerd4202 thanks
Ok nice, i have this working for a anet a6, but on my ender 3 i have a screen and touch ui on my raspberry, can i use psu controle on my toch ui aswell?
That should be possible. OctiPi PSU Control is just another OctoPrint plugin. They can both be installed
can i run my RPI 24/7 without the printer on all the time with your setup? i need to use my RPI for other stuff.
The Power supply for the printer would always be on, just not the printers main board and heaters etc.
But the Pi has to be in place and running OctoPi, there wouldn't be much you could do with the Pi in this situation outside of that
What Raspberry Pi that you use for that build
In this build it was a Raspberry Pi 3B+
Guys buy a Kasa Wi-Fi device. This is dangerous as the Current is too much for the relay
What model touch screen is that?
It is a Landzo brand touch screen.
amzn.to/2V2cZ6N
Great! What ui are you using with octoprint?
For the Ocotprint Web UI, I am using Themeify and just modified the page widths to fit my screen.
For my touchscreen I use Octoprint-TFT and its default UI.
www.crackedconsole.com/community/3-general/wip-installing-and-configuring-octopi-octoprint-for-raspberry-pi-to-control-your-3d-printer/
Спасибо, сломал флешку голову тоже сломал как настраивал! Лайк
@life as a nerd
would normal jumper cables work
If you are referring to what wire you can use in assembly, yes any wire should work as long as the gauge is thick enough.
Power off won‘t work
You wire the relay between the PSU and the printer. The PSU will stay powered and you are just breaking the connection between the PSU and Printer. There are other ways to control power of your printer. This is the route I choose and it works fine for my needs.
ITs not working for me , thanks
What part are you having an issue with? I would be glad to help
@@lifeasanerd4202 i have 8 channel 5v relay module, i connect from psu to motherboard to relay and i connect pi to in1 for signal and gnd and vcc for + and - for pi..... When i do this pi doesnt power on, nothing powers on, only the psu itself. when i connect psu to relay to pin 1 and 3 and it works but it defeats the purpose no switch in between whiteouth raspbery pi signal, its basically direct wired trough relay.
@@kalisto1 Use Pin 4 for 5v + Pin 6 for Ground and pin 40 (gpio pin 21) for signal
@@lifeasanerd4202 my pins on the relay are first pin is GND secound pin is IN1 (in1 is for relay number 1) third pin is IN2 ( IN2 is for relay number two and so on for another 6 pins are for relay then last pin is VCC then on the far right there are 3 more pins first pin is GND secound and third pin got a pin connector and they are connected, pin two is VCC, pin three is JD-VCC... Maybe i have the wrong relay it says its 10a 250v, 16a 125 v, these are writen on relay itself. Thanks so far :) IF u write on google 8 channel relay this is the one i got its TONGLiNG.
@@kalisto1 The Pi may not be able to trigger those relays only 5v. Hook up a 5v source and see if you can manually trigger the relay.
The Pi voltage out is 5v to power the relay, and the pin signal from the pi is only going to be 3.3v, this may not be enough to power and trigger those relays.
Next video.... how to put out a fire. Im kidding, delete this video its just wrong. Relay, wires, pi, zap, boom, fire.