Just over a week ago, I decided to take one of my Raspberry Pi boards I had laying around my shop and implement an Octoprint server for my TAZ 6. I was, and still am blown away by the genius behind Octoprint. If you are unfamiliar with Octoprint, in summary, it turns a Raspberry Pi into a web server for your 3D printer. It can do everything from printing a gcode file, to slicing an STL file. Additionally, it is loaded with great features and is very flexible with integrating your own hacks. I use Simplify3D for slicing and was apprehensive to try Octoprint because I was unsure of compatibility. I am so glad I tried it - it works awesome with S3D! Get more info on Octoprint here.
Octoprint has quite a few extremely convenient plugins including Filament Sensor Reloaded by Kontakt. This convenient plugin uses a selected pin on the Raspberry Pi in combination with a filament sensor to pause your printing if you run out of filament. Combine that with Octoprint's 'Pause Script' setting and you can send virtually any gcode when you run out of filament. In my case, I set Octoprint to play a series of beeps and run an M600 filament change command when my filament sensor triggers.
For my sensor, I used Lulzbot's Feed Tube Spinner concept and redesigned it with a built in optical sensor. Installing it is as simple as replacing Lulzbot's Feed Tube Spinner and running 3 conductors to your Rasberry Pi header pin.
- (1) EE-SX472 Omron Optical Sensor - Please Note: I know cheaper sensors exist out there, however I am a huge fan of Omron Sensors and they are well worth the investment. Before I buy them on Digikey, I always look on eBay first. Many times you can get them on eBay between $5-10.
- (2) 3mm Plastic Screws (Flat or Button depending on Cap)
- (1) 1kOhm 1/4 Watt resistor (for output of Omron Sensor)
The GPIO I/O on the Raspberry Pi can only take 3.3VDC and the EE-SX472 sensor is 5VDC. Adding a 1K 1/4Watt Resistor between the OUT and GPIO pin solves this issue.
I used GPIO4-PIN7, however you can pick whichever pin you have free. The Pin number can be set in the Filament Sensor Reloaded plugin settings.
A good way to test your sensor outside of Octoprint, is to SSH into your Octoprint server and use the simple command 'gpio read 7' (7 being your pin number). If using the SX472, this will show either a 1 (filament in tube) or a 0 (no filament).
After you get your Octoprint Server setup, you will need to install the Filament Sensor Reloaded plugin - goto:
Settings-> Plug-In Manager-> Get More...-> Filament Sensor Reloaded-> Install
Once Octoprint completes installing your plugin, you will need to reboot. After Reboot goto:
Settings-> Filament Sensor Reloaded
If you are using an SX472 Sensor on the same pin I am, the above screenshot is exactly the settings you need. They are pretty self explanatory once you have your sensor operational.
Filament Sensor Gcode
Hopefully the developer of the "Filament Sensor Reloaded" plugin for Octoprint will add a spot for custom gcode right in the plugin. Until then, gcode can be added in the Octoprint settings:
Settings-> GCODE Scripts-> After print job is paused
ENCLOSURE PLUGIN: These are my Settings in Enclosure Plugin.