Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

AiO Ender 3 Octoprint Set Up with Power and Light Remote Control

by giacomo30196 Aug 24, 2018
Download All Files

Thing Apps Enabled

Please Login to Comment

I do not understand why there is a relay to switch the ground to the printer. Once you open the relay for the +24V line, the circuit is open. If you feel the need to have two relays, place them in series with each other in the 24V line.

It is important that the GPIO driving relay coils:

  1. be buffered from the relay coil's load, AND
  2. the relay coil's inductive 'kick'; when switched off, due to the inductance of the coil current will attempt to continue flowing and there will be a voltage spike. Normally there is a diode (or similar circuit) used to limit this spike.
    Perhaps these are on the relay board? However this is not indicated.

A bit of research on the GPIO came up with (from :https://raspberrypi.stackexchange.com/questions/9298/what-is-the-maximum-current-the-gpio-pins-can-output):
"On the official Compute Module data sheet release 2 page 14:


The datasheet is applied to both CM1 and CM3, so as BCM2835 and BCM2837 when VDD_IO=3.3V. According to the table, It is safe to drive up to 18mA and sink up to 17mA by GPIO."
"A maximum of 16mA per pin with the total current from all pins not exceeding 51mA

From the Gert himself!"

Congradulations on creating an expensive boon-dongle, I attempted to build this thing and ended up with a completely burned out Pi and Ender 3 control board, please take this thing down before someone else is out $150 in replacement parts

Man you should not do stuff like this in that case. Have done it a works like a charm

In the circuit, why do you have two relays for switching the printer power, one on the high (+) side and one on the low (-) side?

What Diagram software are you using for that wiring diagram?

Please when upload update the design with holes that fits into safer relays
Thank you for you excelent work

Hi, i am currently waiting forse the relay, once i receive It i Will update the design

Comments deleted.

Is this setup for 24V LED's? Do you have a recommendation on which ones will work good to see the printer at night?

Good Job !
Could be this fitted behind from where it is right now ?

Comments deleted.

Hi giacomo :)

Could it be possible to design a model for the Ender 3 Pro or at least provide the design files to modify it by ourselves. Thanks for your work :)

Sorry for my absence, I've just uploaded them! i'm really excited to see how you'll improve it!

Congrats giacomo30196, it's a great job !
Any to chance to get some design file in order to adapt for en Ender 3 PRO ?

I think I discovered a problem with the circuit design. I keep destroying RPIs, and I suspect it's because the ground relay is sometimes not enabling before the power relay, which is causing the printer to source ground through the RPI's USB hub and destroying it. So I think just hardwiring the printer's ground should be fine.

Comments deleted.

Yes, the buck converter shares the ground with the printer. if the ground relay is disabled with power relay enabled, it only has one ground path to go, through the RPI and the buck converter.

I simply removed the ground relay from the equation, as it serves no purpose. Just make sure the USB cable has it's power rail disconnected, so the printer doesn't become energized from the RPI.

Thanks pickle15, would this explain why my buck converter suddenly read 24v out? I was thinking that when wiring it up that having three relays was a bit pointless...and yea I double checked I've cut the red wire on USB cable...thanks again for the reply

you shouldn't be seeing 24V coming from the buck convertor. the ground is still "0V", but it is carrying current from the printer that overwhelms the USB ground circuitry. At least that's my theory.

Hmmmm..I had another go at it and followed his diagram to a t..and can report its all working fine...I think on my first attempt I've some how got 24v on the 5v line. I just printed out his circuit and highlighted as I went.only thing is his shell script for the light change 18 to 04

Is the RBPi always "on" as well as the power supply of the Ender 3 in order to provide the 24V to the buck converter (and then the 5V to the RBPi) ?

Will this fit at the rear as well ?

Will this fit at the rear as well ?

When can you expect updates for more powerful relays?
It's nice if there was a second version of UP without going out on the camcorder's tape. And with some ventilation holes added so that the air from the windbreakers could somewhere free.

How do you power your rpi? In the fizz i don't see where is the power source...

Giacomo can you provide a top case with fan 30x30 ?


Hi Giacomo, Is it control outside(IT's mean using LTE not using wifi)

Hi Giacomo. Would you be willing to post your design file? I'd like to use all the same components but with the Ender 3 Pro. Basically, I want to shorten the width to 105mm, and rotate the relays so that they fit in the smaller space. I may have to take the fan off the front and keep the one on the side in the back.

He Giacomo,

thanks for the design.
I printed the case and changes some electronics to add a PIR to switch the light when i'm near the printer :-)
Unfortunately I have a Ender 3 pro and it does not fit. The case is 10 mm to wide.

I like to change the case to adjust the width and make it a bit longer (change the layout of the relay).
Any plans to update the design for the Ender 3 Pro or share the cad design?


Same here :D Wasted 8 hours. Came out really nice! :)

@Giacomo: Any chance to get the model in order to make it compatible with Ender 3 Pro ?

Hey giacomo,

first of all, nice design.
However please make sure that the two top relays are capable of at least 20 Amps @ 30VDC. The ones you linked in the descricption are only rated 10 Amps and the Enders PSU is capable to supply up to 15 Amps. So this could be a dangerous fire hazard, as the contacts in both relays will overheat at longer prints or prints with high temperatures.
Better use som like these :
wich are rated 30 Amps @ 30VDC.


you are absolutely right about this. I just measured the amps while the heatbed and the nozzle is both heating up and I measured 10.5 Amps. I just used the relays in the description and had sometimes sticking on the relay for the printer. I will not use those relays any more. I just ordered the one with 30 Amps.
@giacomo30196: I think you should change that in your description.


Yeah, and that is more than 10 amps with no motors moving!!! So if the machine is printing a file it will draw even more current from that power supply. I am glad that you will change the relays, so we dont get any "My Ender 3 burnt my house down" news. ;-)

10 Amps with no motor moving. I just measured the current while printing after heat up. The current is between 1.5A to 9.5A. Once the bed and the nozzle is heated up, the current goes down a little. But like giacomo already said, safety first. Thanks for this cool project. I already learned a lot :)

Hi guys, thank you for your research. i'll update asap the project with your suggestion. Anyway, I could be wrong, but the problem shoud be when you switch off the relay with more than 10 amps flowing through it because of the electrons arc... So in theory this should not be a problem if you turn off the relay when printer is idle...
ANYWAY SAFETY FIRST, so as i said i'll update the project

Forgive my adeptness.. But how can something be rated for 15A @ 125VAC be only 10A at 30VDC?

No problem. The difference makes the sinewave. AC is in alternating voltage in both directions. So it starts at 0V rises to positive voltage then goes down through 0 volts again and goes into a negative voltage value. All of this is done in one sinewave. Whilst dc stays steady. The problem is once you want to open the contacts there will be an arc keeping the output off the relay energized. This arc will overheat and probably burn down the relay. If you have 10 minutes to spare please check out KainkaLabs Video about it https://youtu.be/6mGCAw8q85g

Thanks for the response. I totally didn't think about arcing being the issue. Sucks now i'll have to wait nearly a month for the new relays to ship from china. But atleast my printer wan't spontaneously combust. lol

I'm using this as a base for my own enclosure / Pi switched setup, and I was wondering: What software did you use to create that beautiful circuitry schematic?

Please Help!
I have wired all this up, although unfortunately my PI will only stay powered a few seconds..... i have confirmed it has 5.3v going to it... PI works fine on original power cable.

there is an error in the code, you are wrong to write the PIN number



gpio export 18 out
gpio -g write 04 0



gpio export 18 out
gpio -g write 04 1




gpio export 04 out
gpio -g write 04 0



gpio export 04 out
gpio -g write 04 1

Please update your main post to reflect this fix. I had to figure out this issue as well.

Thank you for this, It is my very first project with a 3d printer,

1 Question - Is it still necessary to cut the 5v line on USB if using 3 relays?

what did you find was the best way to print the base?

Great design! Nice work.
Have you designed the whole machine or is it somewhere available to download?
It seems very detailed and ideal for someone that needs to design his own upgrades.

3d model is provided by creality3d itself!

Comments deleted.

Nice project. I think I have a better solution to the problem with powering the printer through USB. You can install uhubctl on your pi and switch of the power on the USB ports. You will stay conectet to your printer even when the power on the ports is off until you switch your printer off. With the custom gcode command plugin for octoprint, create a command that will run a script to switch off the power after your print is finished. In this case you will only need 2 relays.

Comments deleted.

Thank you for sharing this!

you're welcome. I have another thing what I would make different. It is better not to power the Pi through GPIO. They are made to power something. It will work, but you can easily fry your pi since the voltage is not regulated and has almost no protection as it has on the microUSB port.

Yeah, but there is a voltage regulator

Yes I know, but it is not recommended by the makers of the Pi... ;)

Okay, that's good to know. But i used Pi in that way many times and never happened... so i think it is quite safe to do like this

Yes I know, but it is not recommended by the makers of the Pi... ;)

Does this case fit the Pi 3 B+?

Hi, thanks for your awesome work! Can i power on the printer without using octoprint after this?

I have the same question. I would like to add manual power and light buttons, just in case the Raspberry Pi stops working. Would this be possible?

yes, just add a physical switch to the closest point to the output of the printer/led plugs on the positive the wires. (the switch will need to be on for it to be turned on via octoprint obvs) basically all it is doing is cutting each circuit right before exiting to the printer/led, so if octoprint says it is on and those switches are off the power is being cut by the physical switch. Does that make sense?

That would allow me to turn off the lights or the printer. But what if I want to turn them on and the raspberry pi is shut down or broken? I could theoretically still print from an SD card, but not without power.

that is the purpose of the switches... They'll trigger the relays instead of the pi. Basically a bypass.

I don't know how to copy the files into the raspi. Can you tell how or put a link to know how? Thank you!

Wich files do you mean? nothing is suopposed to be copied. you need to create them from zero. follow the link in the description

Finally I could introduce the code and apparently it's working, but when I try to start the printer it makes a "flash" starting and stopping at the moment. If I change the cables to NO (normally open) when I turn on the button printer, everything goes on, but if I try to turn off (in the code would be on because I didn't change) nothing happens. Any idea? everything is well connected. With this configuration I just connect the printer. Because led are configuring like other procedure. VCC and GND are PIN4 and 6 and the leds are connected to 2 and 9.

Hey, my octoprint doesn't detect serial port USB do you know this issue ? I cut the red cable on the usb port. thanks !

Can I use a 5v led strip instead 24v?

You can only if you change the circuit otherwise your leds Will bourns

You can only if you change the circuit otherwise your leds Will bourns

Will this fit on Ender 3 Pro? (It have 4040 on Y axis)

No it don´t fit. 1cm too wide.

Sorry i don't know

what about to add a smoke sensor to raspberry that interrupt energy ?

Good idea, someone already told me but i haven't got the time to develop It. If you want to help me answer this: i did a Quick research, and i found that many smoke detectors exists depending on wich type of gas/smoke you want to detect. Regarding the printer wich type of smoke should i expect? Because could bè smoke coming from motherboard or extruder?! I don't know i'm guessing..

I think the best thing is to see what the sensor 'see' in normal working condition, then you can choose where to put the sensor:
Take a look there: https://www.youtube.com/watch?v=c_3LxJFHDQc&t=500s


By default on the ender 3 when the power supply switch is "ON" the power supply fan start, is it stopped when you use execute "printer_off.sh" ?

No because you only cut Power to the printed. PSU fan is indipendent from my circuit

Ok so except using a 110/220V relay module between the power supply cable and the power supply power plug, or using a "Smart Plug" this power supply will be noisy. Thank you for your quick answer anyway!

Not in my experience. the power supply fan turns on when a big load is applied. Raspberry is not power hungry at all in comparison to the printer... so if you're only powering raspberry your fan should stay off.

Maybe we have a different version because mine turns on as soon as i power on the PSU (The following text is inscribed under the psu fan: "this power supply is built-in on/off fan control circuit...."). i abused when i said "noisy", it turn very slow when it's not printing and in all cases the extruder fan is for sure the most noisy. To be honnest i don't like the idea to power the raspberry using the printer psu because i want to keep the raspberry access even if the printer PSU die. I will use your design with the help of a dremel tool i will create a hole in the box side for the raspberry micro USB powering. By the way i read your comments about raspberry fried, so i will cut the red wire in the usb cable ;)

Hi giacomo3019,

So for some reason I think my USB ports are fried... I was able to get the printer to connect the FIRST time to ALL ports but every time I shut the printer down using the GUI, each one of the ports stopped working and now the printer will not connect to any of the ports. :(

I made sure to follow your instructions including cutting the red wire in my USB cable but somehow this still happened. Any ideas why?

Hi, i'm really sorry to hear that. I had a similar issue with a different setup. Before making this page I did a prototype with only 2 relais: one for light and one for the printer. In this way when I shot down the printer, the printer itself was not turning off because the usb cable was providing power
through the raspberry (wich is only capable to provide 0.5A, not enough). It worked 2-3 times then i fried the raspberry (yes the whole rasperry) AND the usb port of the printer. To avoid this happening to you guys I added a third relay: one for +24V and one for GND (cutting red wire of the usb too). In this way I am 100% sure that the circuit is not closed (once you disable relais) and the printer can't be powered from the raspberry. This setup has been working for me for more than a month without isusses and i'm quite sure it works well. So coming to your issue i would check few things:
1- Have you tried to connect the printer to a different computer? if that works it means that raspberry could be the issue.
2- I suggest to double check if both 24v relais work because if one of them doesn't, we fall back into the situation of my old prototype.
3- this one is unlikely but maybe the issue is a faulty printer's motherboard. That could be because of the pour quality control tests... Anyway when i broke mine i wrote to the seller and they were kind enough to send me a new one. Same as for the raspberry.

Let me know if you can track down the issue.

So if i understand, the problem was that the raspberry was providing 5v volts back to the mainboard, and that fried both the printer usb and the pi? Too sad to hear it.
If so the way i fixed it was just to put an insulation tape to the 5v rail of the usb plug that goes to the pi.
I only kept ground and data and everything works just fine.

This is awesome, you are designing these faster that I can keep up. Just one question, why are you using 3 relays. I don't see the purpose of the one switching ground, would it not work just keeping ground/common connected and switching live on and off? Awesome design though.

Hi, i made it like this because with only 2 relais I fried both raspberry and printer. I wanted to be sure it would not happen again, so i came up with this and it works well.

Thank you for this! I just put mine together last night. I still have to configure the PI and connect the lights and the printer but the bulk of the control box is done. I will be posting some pictures later. Again thank you!

Grest! You're welcome

HI there. I am having some issues with the code that was provided in the post you linked for the relays. Any change you could post your code? Also what version of OctoPrint are you running? I am on the latest and it appears that the syntax is a little different. getting close... thanks!

Hi i'm running octoprint 1.3.9 but it worked for 1.3.8 as far as i can tell. Anyway, I updated the description of the project with my code.

I am also on 1.3.9. I was making a stupid mistake with my code not splitting up each shell command. It looks like it is now working, I will just have to test the actual relays when I get home. Thanks!

FYI: looks like some of the links in your post are broken and are not showing up.

Awesome project! Do you think an absolute soldering noob - like me - can get this to work safely? Thanks in advance for your reply and keep up the awesome work.

  • Sent from 3D Geeks: Thingiverse Browser App for Android

Yes!. Be sure to follow the scheme and you'll be ok. If you want to be 100% sure check solderings one by one with a multimeter

Allright, will order the parts soon :-)

  • Sent from 3D Geeks: Thingiverse Browser App for Android

hello nice design, will you be able to provide the step files? thanks