Raspberry PI and OctoPrint

3D Printing, Electronics

Note: I had originally planned on posting this one after I had assembled my 3D printer but as it appears it’s going to be a while (FedEx has been waiting for it to be dropped off for a week in Hong Kong, don’t think it’s gonna make it to the US by it’s scheduled delivery Monday)

One of the things I wanted to do right away with my 3D printer is to make it a little bit smarter which is where OctoPrint comes in which is a nice piece of software that gives your 3D printer a web interface for management. With Raspberry Pi’s as cheap as they are it makes the OctoPi version a no-brainer.

In addition to a web-cam via the Raspberry Pi Camera Module the Pi’s GPIO pins for a filament run-out sensor and a relay to cut the power to be able to cut power to the printer through the Pi, even remotely.

Filament Sensor

For the filament sensor I found an inexpensive optical endstop sensor (can be found many places, just included Amazon link as an example) and then printed a housing for it. I went with this one as it includes mounts for my printer, but this one is much simpler if you don’t need a mount or want to design your own mount.

OctoPrint has an plugin called Filament Sensor which has instructions for configuring it. The sensor I got came with three pins labeled V, S, and G and absolutely no documentation so I guessed that G was ground, S was signal, and V voltage in. With that highly scientific deduction done I plugged V into one of the 3.3v pins, G into one of the ground points, and S to one of the GPIO pins. I chose GPIO24 as it was near both a 3.3v pin and a ground. Some testing found this appears to work so now I just need the printer so I can print the housing… and use it.

Power Relay

I got a dual relay board (getting the module instead of just two relays for cleaner wiring and mounting. One relay is for turning power on and off to the printer power supply and the other will be used later as a switch for some lighting for the print bed. I used this as a guide for wiring up the relays and configuring them in OctoPrint.

For wiring there were two sets of pins on my relay board. I relied on the internet on this one as I didn’t fully understand it but it seems to work. On the left side was JD-VCC which I wired to 5V, VCC which was wired to 3.3V and GND to ground. The other set of pins had GND (which had a trace to other GND so we don’t need to bother with it), IN1 which I wired to GPIO17, IN2 wired to GPIO18, and finally VCC I wired to another 5V pin.

I’ll defer to this documentation on configuring OctoPrint to have options to flip these relays. Make sure you change /etc/init.d/octoprint and ~/.octoprint/config.yaml. Also make sure you use a relay that can handle the power as for this purpose I’ll be running straight mains power through it.

Nice Hat

So I got it all working and even wired up an RGB LED that I have some ideas for future work but it’s kind of a mess and if anything gets unplugged it’s gonna be a hassle to make sure I have the right pins.  What I need is a hat… no seriously that’s what they are called (no I don’t know why). Basically it’s a board that can stack on a Raspberry Pi and provider an expanded interface for the GPIO pins. I picked a cheap one that came with support standoffs (I got this one) and wired it up so it was a little easier to hookup and disconnect as needed. I used some multicolored jumper wires to create cables for each of my purposes and used coloring to make sure I know where things plug in later.

Now all I need is a printer to finish this stuff off!

Advertisements

6 thoughts on “Raspberry PI and OctoPrint

    1. Oh yes I do! Ironically a lot of them are part upgrades for the printer itself. It did arrive on Monday, turns out FedEx just never updated the tracking number (still haven’t in fact) and I managed to get it assembled and get a print out of it (the bracket for the filament sensor https://1drv.ms/i/s!Ar6B48immuMBnZNzuLbHkq1lCCjo-Q ) just haven’t had time to write up a post about it. Maybe tonight or tomorrow I’ll have time to write it up

      1. They are a bit pricey, I lucked out and managed to win an Occulus Rift headset but had no interest in VR so I was able to turn it into credit I could use for a printer and associated parts. One of my next prints will be for a camera mount to do timelapse videos of prints

      2. OMW!! An Occulus Rift!!! Nice man!! Me and a couple friends do some gaming over the weekends, we have been looking into getting the Occulus, but at $900 on this side, we are still just drooling at the pictures… 😛

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s