I’m really enjoying my new 3d printer, but I just can’t leave my laptop connected to the printer all the time. I know that i could simply use SD cards or use another host computer, but there are better options. In order to untether myself from the printer I am using a Raspberry Pi and the OctoPrint printer host. This allows me to take g-code that I have generated and upload it to the Pi. Now I can start a print, check on the status, and view the printer through an attached webcam. The webpage also works well on the iPhone so I can keep track of what is going on from anywhere. I can also easily abort failed prints without having to come home to find a stringy mess. As great as that is I don’t like to leave the printer powered on if I’m not using it and I don’t like to leave the lights on when I’m not home.
Step 1: Circuit layout
The solution that I came across was to leverage the different power modes of the ATX power supply (see Ugifer’s Arduino treatment of the topic at Instructables). ATX power supplies have a standby mode that allows them to supply 5v at 2.0A while not fully on. This is the ‘standby power’ mode that most PCs use to sense the button press that turns them on. It provides more than enough power to run the Pi and still have the printer off. The printer runs off the 12V power rail when the power supply is in full power mode. The only issue to contend with is that the Pi’s GPIO pin that I want to use to turn on the power supply is 3.3V and the ATX supply needs to sink 5v to turn on. Using just a 2n3904 transistor and a couple of 1k ¼ watt resistors I am able to turn on the powersupply from the Pi.
Step 2: Physical Layout
The lights that I am using are some 12v white LED panels that came from Ebay. They are inexpensive, less than a dollar each, and are common in automotive world for interior car bulb replacements. They can be wired to any black and yellow connector on the ATX supply.
I didn’t want to have a separate board with the components on it or have to buy an ATX connector so I put the parts inline with the wiring and then sealed them in tape and heat shrink tubing.
To get a good connection to the ATX header I pulled some pins off a broken motherboard and put them on the ends of my wires. To hold them in place I just used nylon zip ties around the connector.
Step 3: Software: Wiring Pi and OctoPrint Configuration
To control the GPIO pins on the Pi I installed WiringPi. This library makes it easy to read and set GPIO pins. I chose pins 5 and 6 on the Pi so that I could have a GPIO right next to GND.
The Pi will default to Input mode on GPIO pins so the first step was to issue a command to set the pin mode to Output. (note that the WiringPi pin numbers are different from the physical pin locations on the Pi. The ‘gpio readall’ command will provide a chart of software to software pin mappings. Pin 5 on the board is really 9 in software) From the command line:
‘gpio mode 9 out’
To make this change permanent I added ‘/usr/local/bin/gpio mode 9 out’ to my ‘/etc/rc.local’ file before the ‘exit 0’. (rc.local requires the full path to gpio)
For more detail: Using the Raspberry Pi to control an ATX power supply
Current Project / Post can also be found using:
- raspberry pi control atx power supply
- control atx power supply with raspberry pi