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

Octoprint Ultimate Lights / Fan / Temperature Control

by vitormhenrique Apr 13, 2017
Download All Files

Thing Apps Enabled

Please Login to Comment

Hi! thank you for our plugin. I am using it to light my printer w/ neopixels. I appreciate your work!

Hey there, so i am having trouble getting a readout from my BME280 within the plugin. i checked system and reps and i can get readouts from the sensor in the cmdline. any idea why the sensor only displays 0C & 0% ? i2caddress is standard 0x76... am i missing a rep or system plugin?

also is there an option to use a TCA9548A i2c multiplexer to add more bme280's ? i want to add a couple of sensors in various spots of my enclosure since i have connected "systems" with de-humidifying agents, cooling area etc. that would allow me to switch out my arduino controller to your plugin and control flowrates etc. directly from octoprint server.

cheers

After searching for hours to do the stuff I want I stumbled onto your plugin. Several hours later I still can't find an answer to which led lights to use. I see "neopixel" but not what type. The regular neopixel rgb, rgbw or the dotstar? Adafruit says the regular neopixel requires high timing and suggest using the dotstar lights with the pi but I don't see them referenced anywhere in the plug-in documentation. A link would be much appreciated and I'll figure out the installation from there. Help lol

regular rgb ws2812b led strip, any led strip that can be controlled by relays or signals from gpio

Hello,

I wanted to say thank you for this great plugin. I wanted to use it just for the IO function using Raspberry pi 3+ and IOT four outlet relay. It works without fail, even after only installing it by flashing octoprint directly to the ras pi's SD and not loading Python 2.7 from pi. Sadly the PWM signal does not work to control my 12v 4pin nactua at octopi server start, which I know you touched on in a previous thread. I can't even get it to dim my led, which is just on. I've posted the thread I used as a wiring guide. I can only assume I'll need to start from scratch to get this functionality. You must be using a separate library for PWM than what was used for the IO switch.

This is my first Raspberry Pi project, as I've always used UNO.

Thanks Again!
Nate

https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=221374&sid=b8a747a0f729d06249045f6641d2dbd2

I've been trying to get the relay control to work but not having much luck. I have it wired as following
jd-vcc 5v
vcc 3.3v
ground ground

ground ground
IN1 GPIO20
IN2 GPIO26
VCC 3.3V

In the plugin setting i have tried ticking and un-ticking low which has made no difference.

Ive tested the GPIO's and relay using the below script and it works as it should.

Can anyone help?

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)

GPIO.setup(20, GPIO.OUT)
GPIO.setup(26, GPIO.OUT)

while (True):

# Turn all relays ON
GPIO.output(20, GPIO.HIGH)
GPIO.output(26, GPIO.HIGH)
# Sleep for 5 seconds
sleep(5) 
# Turn all relays OFF
GPIO.output(20, GPIO.LOW)
GPIO.output(26, GPIO.LOW)  
# Sleep for 5 seconds
sleep(5)

if you still have issues create an issue on github, you might want to check the wiki first.

Hello,

I want to use your plugin to control 12v fans with pwm based on a temperatursensor. Can I use this to connect the fans with my raspberry pi to use pwm? http://vi.raptor.ebaydesc.com/ws/eBayISAPI.dll?ViewItemDescV4&item=232640070939&category=65507&pm=1&ds=0&t=1516687678000&ver=0&cspheader=1

thanks for your answer

Christian

I was hoping you could tell me if what I would like to do is possible since you obviously know more about this than probably anybody I know.

I am building an enclosure right now and I would like for it to have the following and be completely controlled by a single Pi 3B+:

Run Octoprint as usual. (handling the gcode directly to the printer, no SD cards).
Control addressable WS2812B type LED strips.
Monitor temperature and humidity and make automatic adjustments as necessary with fans and heaters to stay within specified parameters in 2 separate zones.
Make everything fully interactive and display through a 7" touchscreen.
Be able to monitor live camera feed via the same 7" screen.

Am I asking to much from 1 Raspberry Pi 3B+?

Thanks for all your amazing hard work that you share with us. Once I figure out what I am going to do I will be willing to donate to your project for further advancements!

Based on your work, I made it to support the octo printer hat for my raspberry pi.

https://www.thingiverse.com/thing:3151403
https://github.com/mocona05/OCTO-PRINTER-CONTROLER

OCTO PRINTER SHIELD

nice application!

Great plugin. Been using some of it for a while now but just added a temperature sensor to trigger two a 120mm fans to get temperature down for PLA and PETG prints, but set the temperature really high for ABS so the fans don't kick in.

I have a couple of questions though.

1) When setting the temperature for triggering the cooling, is it supposed to persist between restarts of Octoprint? It seems when Octoprint gets restarted, the goes back to Off.

2) Is it possible to populate the trigger temperature drop down box with several canned settings (say one for PLA and PETG and another for ABS?

DS18B20 sensor?

I bought a 3 pack of these and figured out after the third try that I couldn't get 10k ohm resistor to last very long. I ended up using a 5K ohm resistor and that fixed my problem as I didn't have a 4.7k ohm. Has anyone else seen this issue? Is there some other reason why 10k ohm does not work. My symptoms are that the sensor outputs temp data for several hours, but usually before a full day is over there are no more updates. Are the sensors now damaged? Did they go into parasitic mode or something?

I will try to read them again on a simple Arduino set up at some later time when time permits.

Thanks for all the work and I hope we can explain this so others don't have the same issue I have. It may be the specific brand I bought too.

Update:

Don't know why I never tried this before but today I was seeing the frozen temperature again even with the 5K resistor. I ended up unplugging the Raspberry Pi and plugging it back in then it worked again. I had tried Octoprint restart and Raspberry Pi reboot before with no luck. Not sure why a power off shutdown did the trick on this temp sensor. Hopefully my others are OK too.

LOVE THAT PLUGIN!

My old SD Card crashed and i had to reinstall it again (i wish there is a backup option for that). I installed OctoPi and the plugins again but can´t get the temperature displayed in the web menu.

All outputs work fine and also the input via command line works (see picture attached) the gpio is correct and it won´t work.

Any suggestions?

keep up the fine work!

Disable sudo on the advanced section....

Yeah! Works! Thanks!

Hi, I'm trying to setup my Raspberry Pi 3 to read a DHT22 sensor. I've followed your guide but I can't make it works. It always shows me: "ImportError: No module named Adafruit_DHT" I double checked the installation procedure (even with a fresh octoprint build) but it doesn't works...

if you followed the guide I'm guessing you installed the Adafruit_DHT python library on your main python environment and tested the regular adafruit test code and got the sensor working before even trying to set it up on the plugin, right?

Hi, thank you very much! I followed all the guide but when I try the test I have the message that I wrote in the last message. Everything via Putty terminal... I think that something went wrong with the installation...

you need to properly install the library, follow this guide:
https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/software-install-updated

if you can't make that work the plugin will not work.

Even with the guide I can't make it work... When I try to install it tells me what I show you in the photo. Something went wrong during the setup but I don't know what...

Try adding:

sudo apt-get install python-pip

before the:

sudo python setup.py install

It works!! fantastic!! :D Now I try in the Enclocure plugin! thank you very much!!!!

P.S. Added to Enclosure plugin and works perfect! there's a way to show values direct on nav bar instead in a sub window?

Tahnk you very much, that's ok! ;) and what about the neopixel control? I'm trying to install the library following the Adafruit's guide but I have similar error (like when I was trying to install the DHT22 library) when I run sudo python setup.py install... thank you again!

I honestly don't know, I googled your last issue and figure it out how to fix, I guess you need to do the same....

Hi, I fix the problem with "sudo pip install rpi_ws281x" and now I can run the Strandtest without problems! But I can't make them work inside Enclosure Plugin... I set neopixel direct, GPIO18 (the same as the strandtest) but I can't make any color works...

it's better if I help you over the gihub page, follow the troubleshoot guide, provide the necessary documentation and open a ticket there....

trouble shooting guide

issues

Hi !
Is it possible to control a Fan (3 Pin) with the plug in ?
Actually i have 1 pin on the 5v another pin on ground and the signal pin on the GPIO12 but when i try to switch off the fan nothing happen in the plug in...
Thanks !

3 pin fans have the following pins: Signal (to measure the rotation of the fan) VCC and Ground. If you connect VCC to 5V and Ground to Ground of course the fan will rotate and spin forever! If you connect the VCC pin to any GPIO when you turn on the GPIO the fan would spin, when you turn off the gpio the fan will stop.
HOWEVER: you should NEVER NEVER NEVER plug a dc motor (that is what basically a fan is) directly on your raspiberry pi, motor is a big inductor, that generate energy spikes, and it will be very likely that it will FRY your raspberry pi fast! You need to use a mosfet, or a motor controller ic or a relay to properly control fans using a raspberry pi.

Read the following:
controlling using a transistor / mosfet

controlling using an IC

Thank you sooo much for your explanation, know i understand.
Should I use a relay like for my PSU ?

Again thanks for your help !!

Messing with mains voltage can kill you, be careful, if you don't have experience and are comfortable with electricity don't try to control mains voltage.
I use relays, but a powerswitchtail is a better option for safety!

I know it's a lot to ask, but could you or someone here write up a small "Explain it to me like I'm 5"? It doesn't need to be crazy detailed because I will take it and fill in the blanks as I go and post it back. I'm familiar with electrical work, but I do it so rarely I always forget and have to google and overthink everything (I have bad memory problems).

Basically I'm trying to use a RPI 3 B+ to control lights, a heater (2x 100w AC or DW cartridges) + 80mm DC noctua fan, and a pwm vent fan. I know I need certain components like a relay and something to handle voltage changes, but I can't remember or isolate exactly what I need.

I always write guides for my projects and share them because I know other people have issues like me or need more details. Would someone have a guide like that or be willing to help? I did read the github readme, but I'm uncertain as to the exact wiring I need and how the PWM controller can actually regulate the vent fan's speed. The heater fan is not pwm. I promise I did research before asking.

My suggestion for you is do everything by steps, get part of it working and them you worry about the other stuff, for example get the heater working and them you get the PWM fan working.

Also, you need to figure it out how exactly you want your system to behave, heating while printing, then turn on the fan when the print is done? PWM the fan while printing? Have some buttons on the UI with pre sets to control the fan?
What temperature sensor are you going to use? I suggest DS18B20 as they are very reliable, only use one wire and are VERY cheap, follow this guide to get it working on the system, then I can help you with the plugin: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing?view=all

If you want to use DHT sensors (I don't recommend) use this guide https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/overview

Yes, you will need relays to control mains voltage, if you don't have experience, don't do it, it can kill you, if you want to do it, check this guide: https://howchoo.com/g/m2qwmte5nzk/how-to-use-a-relay-with-a-raspberry-pi

That is the exact same relay that I use on mine setup. For something safer, use something like PowerSwitch Tail II, same setup...

Get the individual parts working, and build on top of it, doing something all in once will only get your head spinning and you will get no where...

I would say that I have VERY good documentation on my github, if you go on the relay area I explain how to wire the relays and things to look for...

I was thinking I could use a AC power brick to run a 12v supply to the relay and then just use the RPI to control what is open and closed. It's extra cables, but I thought it'd be safest with 2 12v fans and 2x 100w AC/DC heater cartridges. Last thing I want to do is melt down the Pi.

Your github is excellent and I'm a database architect by career so I'm extremely familiar with git and github. Thanks for the documentation there, it was and will be very helpful when I put my hands to the table and keyboard. My main degree is computer science, but my minor was electrical and masters in industrial, so it's been years, but I do have enough experience not to kill myself. That being said, I do fry things and shock myself sometimes, lol. Thanks for the reminder though, always helps.

I already have some leftover temp sensors from automate aquarium design I made two years back and they were listed on your github (DS18B20). I planned to mount it on the top rail of my CR-10 since I thought that's be the best ambient temp area. My heater cartridges (amazon link at the bottom) claim to run on AC or DC and both the 80mm fan for that and the 120mm pwm fan are dc, so I can avoid mains.

Basically I want to left my bed and nozzle get up to temp, then left the heater turn on as necessary. I'm hoping to let the vent run 20/7 using pwm to control how much it spins or if it's on at all, but I don't know if that's how that works or if I've totally misunderstood. That is complicated by the fact that you can directly connect a 4-pin pwm fan to a RPI. The heater I was planning to put the 12v fan and heater cartridges on one circuit and they're either on or off, controlled entirely by the Pi and relay. they are DC if I understand the heater cartridges right.

That leaves me with the issue of understanding how a PWM fan is actually controlled by the Pi, the issue of how to handle 12v DC with a 3v Pi, and a 12v pwm fan, then the last issue of making sure I understand the heater cartridge correctly.

By the way, thank you for the reply, especially the fast reply. I owe you and I believe there was a link for something to that effect on your github. lol

Heater cartridges: https://www.amazon.com/gp/product/B01COPT7BG/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
80mm fan for heater: https://www.amazon.com/gp/product/B00NEMGCRQ/ref=ox_sc_act_title_6?smid=A1Z5H6ZGWCMTNX&psc=1
120mm pwm vent fan: https://www.amazon.com/gp/product/B00OP2PUB8/ref=oh_aui_search_detailpage?ie=UTF8&psc=1

Those heaters will not work well on 12V. You would be better using a portable heater like this one and use a relay board to control main ac voltage to it.

Do you plan to use the fan even when the printer is off? I don't understand why would you do that. But never the less, to control a fan with PWM from raspberry pi you need a MOSFET, not a relay, You would have something like this:
this but instead of 5V whatever voltage you want...

Check the links that I sent, they will tell you how to handle 12V using the relay, basically you control one pin of the relay with the 3.3V from the pi and the relay closes, like a switch and control the 12V circuit that is totally isolated from the PI.

That will however not work for PWM, this will require a mosfet, the picture that I sent explain how to set that one up as well.

lol, no I only plan to run fans when the printer is on. I just have the printer on a lot. I'll look into the 12v fan more, thanks, but I can't fit something as large as that heater in me enclosure. I'll likely power the heaters with AC in this case. And yeah... feel stupid for not realizing the circuits were separated.

lol, no I only plan to run fans when the printer is on. I just have the printer on a lot. I'll look into the 12v fan more, thanks, but I can't fit something as large as that heater in me enclosure. I'll likely power the heaters with AC in this case. And yeah... feel stupid for not realizing the circuits were separated.

Fantastic plugin Vitor. A joy and pleasure to use and setup, I have it driving a bunch of relays doing general safety watchdog functions as well as controlling the fans and heaters in my enclosure.

Thank you for your generous efforts.

Awesome! Be sure to click on the "make" button!

Hi guys, great app, thanks for putting in the effort to produce it.
I am have a small problem with my DHT22 temp sensor, not reading inside Octoprint for the enclosure, I have installed the libraries and when i ran the test code in the terminal it prints the current temp and humidity, so the pi is reading the sensor correctly, but Octoprint enclosure plugin is reading 0, I have configured the octoprint enclosure plug in to the correct I/O pin and sensor type, have you guys come across anything that would prevent octoprint reading the sensor? cheers

go to the advanced sections of the plugin, and disable "use sudo", usually that is the issue, check more info here: https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/146

Spot on mate works perfectly, thanks for your help, your a legend!

Could you please post a couple more pictures of your enclosure.

The enclosure it self is based on this one: https://www.thingiverse.com/thing:675652
I changed the dimensions a little bit and did my door as a whole side instead o section on the middle.
It is a really really expensive way to build an enclosure, acrylic is not cheap..

Lulzbot Taz Enclosure

Looks like your amazon links for hardware have been scrubbed. Probably should list part numbers, etc. Links aren't working.

Would it be possible to add a snip of code to run neopixels arduino side? It has the option to use the arduino to drive the neopixel, but I haven't the foggiest how to handle data from the plugin or even how to hook it up. Is there firmware that needs to be loaded on the arduino board? I can google the icsp connection but a little unsure on the setup as a whole past connecting those 6 wires. If there is a basic setup guide somewhere I missed while searching I apologize.
Thank you for your contribution to the community! Your work is great!

Now it is possible to connect neopixel directly on your by and using an arduino, you might want to try directly first.
If you want to go with the arduino route, the arduino firmware is here: https://github.com/vitormhenrique/OctoPrint-Enclosure/tree/master/extras/octoprint_neopixel
You need to connect the arduino and raspberry pi using I2C lines....
Check this for more info: https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/44

Thank you much! Working on the arduino part now. I tried the direct connect but i dont think the voltage is enough to drive data for my led strip.

Actually I tried direct and this level converter https://www.amazon.com/gp/product/B06XHBYJV2/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1
I try both pin number schemes as well since that's not declared. I made sure it was on a pwm pin and gpio only, I tested on about 8 pins to be sure both with converter and direct using both pin numbers. That is a lot of iteration and I am pretty much done. I had my strip up and running via arduino and connected to google home with a esp32 in about half an hr...then again those had guides.
Thanks for the work but this plugin just isn't compatible with me I guess, too bad it looked like it had possibilities.

It is very likely that you are doing something wrong, even if you want to use arduino + the raspberry pi, it should be as simple as connecting the i2c lines getting the address and configuring on the plugin, or using the level converter following the adafruit guide to get it working first on the rpi.
The advantage of the plugin is that the strip is directly controlled using the octoprint interface, you can even use gcode commands on your printer to turn on and off and change colors depending for example if you print finish.
Microcontrolers / linux require somehow some knowledge, i try my best do document everything as much as I can and to help as many users as I can, but I do this on my spare time after a 9 hours working day it's not easy
I initially coded this plugin to thermally control my enclosure and get big ABS prints with no warping, ended up making it available for users because I know this can help other people, but unfortunately there is so much time that I can donate.

I dont have the knowledge for your plugin or to use microcontrollers/linux so am not worthy. Attacking your user base isn't the best way to support your plugin. I already stated I had guides to help with the other setup and even theorised it was an issue with me not your plugin. Overstating this back to me is just a lash out that doesn't help anyone and isn't appreciated. I hope you have a better day going forward, and try to focus on helping not hurting.

I think you misread my comment, I was not, by any means attacking you, I was only suggesting that you should persevere, try a little bit more, and you will get it working. I don't think anyone is not worthy or not capable of understanding linux and microcontroler, on the contrary I hope more and more people use it, that kids play with it and we all build wonderfull things, I was only pointing out that There is so much that I can do to help, and you might need to spend few hours banging your head on the keyboard to get it working, trust me, that is not an insult, I do it ALL the time, things don't work on my projects all the time, I spend some times MONTHS making something work, that is normal, and it helps the learning process.

Well then I guess I did misread that. I do thank you for the work done and attempt at helping me. I will work more on it later when I have more patience.

This looks like a great plugin.

Is it possible to control any of the outputs via the API? I have rigged up some LEDs which I can turn on and off from the web interface, however I have a small 3.2" screen on the printer with some custom buttons on it. It would be ideal if one of these buttons could make an API call to the enclosure plugin and allow me to turn the LEDs on and off from there.

Vitor, thank you for very useful plugin!
I use an enclosure with heater and ventilation fan. My goal is to keep temp about 70-72C for printing ABS or Nylon. I will use your plugin to control the heater.
I also would like
1/ to have the fan working slowly (about 25% of its power) during print just to have negative air pressure inside the enclosure to make sure that toxic fumes will not come out through the gaps in my enclosure.
2/ this fan to rotate faster if temp exceeds 72C not to overheat the enclosure space.
3/ And when the print is done I would like this fan to work on full power for 5 minutes to ventilate the enclosure from toxic fumes. This can actually be easily done by adding M42 gcode command at the end of print.
Is it possible to achieve this regimen for the fan using your plugin?

Should I create two inputs for the same temperature sensor (one for heater to turn it off if temp is above 72C and one for cooler to turn it on if temp is above 72C)?
Should I create three outputs (one for temp below 72 for slow speed fan rotation, one for temp above 72 for faster speed fan rotation and one for 100% speed after the print has finished?)

Any words of wisdom from you?

I think that this will be a common scenario, so I just updated the development branch to allow auto shutdown for pwm linked to temperature.
So you just need to configure the heater normally, and one pwm linked to the temperature, under PWM, check this option.
On the default pwm value put 100, and enable auto shutdown with 300 seconds delay.
For the points, the plugin will calculate a linear interpolation between point A and B according to the temperature, so you can you can put point A being 25 on duty cycle and temperature 70 and 40% duty cycle for 80 for example, experimentation will tell you best values.
Uninstall and install again the plugin from the development branch, test it out and let me know.

Vitor,
thank you again. Could you please clarify the PWM output type. When is the "default duty cycle" applied: before the temperature in enclosure reaches temp A or during the shutdown delay?
Is there a way to set stable PWM (ex 25%) before the temp reaches temp A?

For regular PWM, the default duty cycle will only be used when you have auto startup, you don't want this.
Choose PWM, and on the bottom choose link PWM to temperature.
You will have few more inputs:
When the print starts the plugin will calculate a linear interpolation between point A and B according to the temperature, so you can you can put point A being 25 on duty cycle and temperature 70 and 40% duty cycle for 80 for example. So it will run your fan at a low duty cycle.
After the print end, it will default to the "default duty cycle", so you can use it as a high value for example 80% or 100%.
You can also choose auto shutdown with a delay of 300 seconds for example, them it will turn of the fan completely after 300 seconds when the print finishes.

Thank you. What would be your recommendation on the fan? I think it is also a common scenario, at least once it was addressed on your github. The fan should work slow (let's say 25%) during most of the time, when temperature is below 40c. It is needed to make negative pressure in the enclosure and suction fumes. But when temperature goes above 40c it should increase the rotation rate. Could this be set up?
P. S. This could be needed at prints when the heater is off but temperature goes up beyond the desired level only because of working heatbed and hotend.

the fan should be controlled by the pwm as I mentioned above, you only need the heater and the pwm controlled for the fan.

Vitor, thank you.
One more question. Is it possible to use ntc 3950 100k or 10k thermistors?
Something like this:
https://www.raspberrypi-spy.co.uk/2012/08/reading-analogue-sensors-with-one-gpio-pin/
I am asking because those thermistors are almost always available at hand by 3D makers.
Thank you.

read the documentation, all available temperature sensors are there
https://github.com/vitormhenrique/OctoPrint-Enclosure/blob/dev/README.md

Are you using the development branch?
If so I suggest using one heater, one pwm controlled by temperature with the default duty cycle of 100%, and chose the points to make pwm responde to the temperature as you want, them use a wait gcode of 5 minutes and enclosure specific gcode to turn the pwm off.
The only issue with this aproach is that the wait time gcode will make your printer unresponsive for that period.

Brilliant plugin! One small question> all works, but when having set the target temp, this value does not remain visible (in light gray as shown in example pictures). It displays a '-'. At the same time the target temp that I entered is being used, since the system starts to cool when coming above the target temp.
Any thoughts on what I could do to keep the target temp visible once I have clicked on the set button?

I'm guessing you installed the regular version using the plugin manager, right? that was a bug on the plugin on newer versions of octoprint.
I fixed on the development branch and will merge the changes when more people test.

A bunch of new features were added.

If you want to test it out uninstall the current plugin, go to the plugin manager, select get more, and where it says "from URL" use the development branch:

https://github.com/vitormhenrique/OctoPrint-Enclosure/archive/dev.zip

More documentation here:
https://github.com/vitormhenrique/OctoPrint-Enclosure/tree/dev

I'll push this to production after more people test it out.

Thanks for quick reply, indeed using regular version. Will uninstall and try dev branch tonight and report back.

That fixed indeed this bug and introduced a whole lot of more options! Great!
If there is anything specific you would like to be validated, just say so.
Appreciate your work and happy to assist!

That fixed indeed this bug and introduced a whole lot of more options! Great!
If there is anything specific you would like to be validated, just say so.
Appreciate your work and happy to assist!

Hello !
I have installed your nice plugin, and want to use it for a fillament sensor.
I have octoprint running on a RPI3 and I have connected a switch (see attachment) to GPIO25 (pin 37) and GND (pin 39).

SETUP:

Raspberry Pi Inputs
EVENT: printer
Input IO Number: 25
Input Pull Resistor: INPUT PULL UP
Event Trigger: FALL
Printer Action: fillament change
Filament Detection Timeout: 120
Use Board Pin #: not selected

When I start printing and press the switch during a few minutes: nothing happens. If I release the switch, nothing happens also..

I have this code in the fillament change codeblock:

G199 ; pauses the print immediately, and moves the head to X0, Y100.

Don't know what's the problem, doesn't work at all.. By the way: there is no TAB added for your PLUGIN INPUT-function...
If I add an PLUGIN output, I see a new tab with a button.

Can you help ? I think a lot off people wants to use your plugin..
Thanks in advance !

;-) Arthur

It is a little bit easier for me to help people on the official github page...

Create a new issue there and copy and paste your comment...

Also, attach your octoprint log. Also please adivise where you connected the pins on the sensor, on there are three pins on the sensor, C, NC and NO.

http://github.com/vitormhenrique/OctoPrint-Enclosure

I'm did not understand what do you mean with the TAB on the PLUGIN INPUT-function

Something that took me forever to figure out why pin 7 wasn't working: rather than use the pin numbers, you're addressing pins using the "BCM" numbers, which are laid out pretty arbitrarily. It seems pretty obvious now that I look at your examples.
Since I wanted to use pin 7, I needed to use "4". Which is the default value, ironically.

Seriously though, thanks for the plugin. I can't wait for my relays to show up so I can do more with it.

Sorry about that, you should have asked! You can actually use both BCM and PIN numbers, under the advanced tab, but once you get it working, don't go around changing that setting...

Hey, thanks for this. Looking forward to using. WIll post my results.

Thank you for making this plugin - it's great.

I've got everything set up and wired but I can't seem to get the output voltage on the pins. Every time I try to turn on the heater I don't see any voltage change and I get this error in the log:

2018-01-06 23:41:37,253 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on writeGPIO. Arguments:
('The GPIO channel has not been set up as an OUTPUT',)

I have the output pins set up as 23 and 24 with a driver of 5 volts to the relay. I've tested this configuration on my bench and I can confirm that it works. I can also confirm the wiring continuity is good as I bench tested it as well. This appears to be an issue with the pins themselves getting no voltage and the error seems to confirm that.

Can you give any advice on how I should fix this? I've tried the following:
1) octoprint service restart
2) raspberry pi restart
3) clear GPIO button on configuration
4) remove and re-add all of the ports.

I'm at a bit of a loss on what to do next.

Thanks!

what do you mean by a driver of 5 volts?
could you please take a print screen of your configuration, inside of the plugin settings and send it to me?

Also, the official github repo might be better to assist you.

Thanks for the fast reply.

You can ignore the driver of five volts part, I was just explaining my wiring and the fact that I'm powering the relay with 5 volts but it doesn't matter for this.

What it boils down to is that if I add a new output for port 23 and turn on that output then measure between pin 23 and ground I don't see a voltage. I've attached a screenshot of the configuration

I can go try asking in the github page. Thanks!

Outstanding plugin, thanks a million for your labor of love. I'm using it on a gMax 1.5 XT+ to control the heated bed and a custom heated enclosure. FWIW I'm using this relay board, which works great: http://a.co/iHOTrJu . I set it up so that the actual temp control is done by external hardware, I just added power relays in the mains power loop so the plugin can turn those controllers on/off using the relays on the Pi board. Right now I'm using an AM2302 for enclosure temp, but oh boy does it have a slow response time! I have a couple of DS18B20s on order, so hopefully I can use those for both the enclosure and the heated bed.

Couple of questions...

  • Will the plugin read multiple DS18B20s feeding into the one input?

  • I'm trying to enable the IFTTT notification feature. I've created an IFTTT account, but I can't figure out what to do next. Can you give me any clues?

Figured out the IFTTT thing. Had to use the "Webhooks" service. Apparently they've updated their nomenclature a bit. :P

I'm sorry I could not help you get IFTTT working, but I'm glad that you did. Last month was really busy and it was difficult to track issues and help people out with the plugin.

Currently is not possible to have multiple DS18B20, but multiple people requested this feature so I might include on next release.

Is it possible to use a 12v pwm fan that would have the speed of the fan increase as the temperature of the enclosure increased?

So you would have a setpoint when the fan would come on at low speed, and that setpoint would be different based on the material you're printing with?

There's not much gain with PWM fan control, the heat on a enclosure dynamic is not like your extruder. it takes minutes of turning on / off a fan / heater to actually see a temperature difference. That is because of the time of residence of the system. So PWM control would not be as effective as you might image.

Is is possible to control gpio with my own script while this is running? On print start if the bed temp target is above 100 then use enclosure heater(relay) to target a specified temp. I also want to run an exhaust fan(relay) for 30 seconds every 5 minutes and when a print is done turn off the enclosure heater and run exhaust for 5 minutes.

if you write a python script that access the same GPIO, and don't have any incompatibility with the scripts, I guess...

But a better solution would be adding time events directly on the plugin.

Anyway to add the temp to the graph?

hey, i installed lights but can't u say that when the printer is online the lights go on? i always need to wait until it is started and then turn it on manual.

I don't understand what you are saying.
You can turn on and off the lights even with the printer off.

Unsure why but my DHT11 would not read with my pi 2 B+ untill I made this edit in simpletest.py

Under examples enter ---> sudo nano simpletest.py

and make these edits if your having the same problem. Change to the pin your using. I have attached a screen cap

this plugin does not even use the simpletest.py code from adafruit, it has it's own code to talk to dht11.
Raspberry pi and dht sensors are not reliable. the other sensors that this plugin support are much better.

Maybe it just happen to start working after that then. Seems like if I reboot the Pi it takes a few minutes to start working. I used the dht11 because I had a bag full of them on hand. Everything seems to be working fine. Thanks for the plugin!

Im using my printer from a big 12V lithium battery pack for ups reasons. Could you add a feature for measuring the voltage of my battery pack with a gpio pin?

Currently I have a cheap voltmeter sitting in the background of the camera. :D

Thanks for the great plugin!

raspberry pi does not have an ADC, it is impossible to measure the voltage without one. Adding a adc functionality is definitely possible, but not much usable.
The best way to do this is to use a voltage divisor and a comparator (op-amp) with the low battery threshold, you can do this already with his plugin and trigger some sort of alarm.

Great information. I like the features. Having issue figuring out the one "Multiple filament sensors for dual or more extrusion"
In process of getting the hardware. I have already printed out the parts I need.
I have a Da Vinci Duo 2.0A mod it with repetier, and two E3D V6. Connected to my raspberry pi 3 with Octoprint.
The question is what settings and which gpio pin I would connect the 2nd sensor. I have seen other connects placing the two sensors in series like christmas tree lights. However I like the the feature of dual extrusion instead, and the control of which extruder needs to be loaded. Thank You

you can use any two different GPIO, and use the settings as two independent filament sensors.

that makes sense. I have my sensors arriving this Friday. I will attach and go through settings. Wonder for both switches can they share both power and ground pin? Just the signal would go do a different gpio pins, example gpio 23 extruder 1 and gpio 24 extruder 2.
The only part i find in examples of settings is for one filament sensor and no were to add another. I did notice that there are two different places to set for filament sensor One for Octoprint and the other for Octoprint-Enclosure.

Another thought I had would be to connect the two sensors routed through a circuit "AND" output to the one gpio pin. I can pick up a TTL 7400LS series chip. That would give a readings i need pause the print job for either filament sensor without messing with code.

hi,

tried your plugin on orange pi zero without any success.

a) DHT11 temp sensor is not working because adafruit-dht-lib is not working on orange pi
b) 5v-relay is not working (using https://github.com/xpertsavenue/WiringOP-Zero instead of wiringPI) - following error:

2017-09-30 09:55:43,299 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on writeGPIO. Arguments:
('Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)',)

I already set the gpio pins to mode output ... I also tried using wiringpi-pins (4 and 5) and baord-pins (16 and 18) - same result.

It would be great, if I could simply add the command in ordert to switch gpio-pins somewhere in the configuration... and use a dht11-libary of my choice (adafruit is not working in orange-pi).

otherwise top plugin and huge enrichtment for octoprint!

please provide some feedback! thx!"

for following requests on orange pi zero, please refer to this issue on github:

https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/67

Unless I can get a development board, we need to expect someone else to develop this.

What a great idea! I want to realize it for my enclosure (for the temperature thing). But... I have little experience with the Raspberry, software related. But when it comes to hardware-cable-connection-stuff I'm absolutely newbie. I think it's no problem for me to connect the temperature sensor (seems to be quite easy). But I think this relay-thing is a little bit to risky for me. And there seems to be no PowerSwitchTail alternative for 220V what I need. So my idea is to connect a 433Mhz transmitter to the Pi to control a wireless socket. So my questions:

  1. does plugin support this function (controlling a 433Mhz transmitter)?
  2. is it possible to connect the AM2302 AND the 433Mhz transmitter direct on the Pi (without a breadboard)?

Thank you so much for your help in advance!

You can not connect 433Mhz sockets directly, if you buy a socket that came with a controller you can hack the remote controller and use raspberry pi gpio to press a button and toggle the socket. You might need to add a arduino to only toggle the socket on transitions of raspberry pi GPIO, if you dont your button would stay pressed as long as GPIO is active, this might be a problem depending on your remote controller / socket. The best way would be build an edge detection circuit with a 555 timer and a inverter and connect it to rpi without the arduino, you also will need to open the remote, and understand how the buttons are wired and how to hack it.

PowerSwitchTail does have an 240V option: http://www.powerswitchtail.com/240vac-kits, so this is simpler.

You can use temperature sensor with all other supported functionalities, but I do not recommend using AM2302 or DHT temperature sensors, as they require fast GPIO timing, and RPI some times have trouble reading them. If possible use I2c temperature sensors, this plugin supports DS18B20, SI7021, BME280 and TMP102 some are very very cheap.

Thank you so much for your fast and detailed answer!

  1. I would really love to get this 240 Volt version, but i couldn't find it anywhere here in Germany or even Europe. Everywhere out of stock or not available :-(

But because I really love the idea of your plugin I need a solution :-) So my second question:

  1. I found this tutorial (sadly only in German https://tutorials-raspberrypi.de/raspberry-pi-funksteckdosen-433-mhz-steuern/) where you can see how it's possible quite easy to sniff the code of the remote of a wireless socket with "wiringPi" and how to send it then to switch the socket (without any other software or stuff). So is it possible to send this code/trigger this command with your plugin?

Thank you again for your answer and your patience!

The website that I sent you, ships worldwide.

It is not possible to send custom commands to turn on and off the heater, neither to connect any transceiver unless you use one of the methods that I mentioned before, hacking a controller is your best hope.

Honestly, I would just get a 240 V relay and use it, like this: https://tinyurl.com/yaadxmqu
You can use crimped connectors and make it very very safe and even enclosure it on a 3d printed case.

Ok... thank you so much! I will use the worldwide shipping. Didn't see it :-) Great! Looking forward finally to get big unwarped ABS prints!

Any chance of integrating a smoke or fire sensor like the ones available for Arduino sensor kits? (Thinking of the MQ2 sensor)

mq2 sensors gives an analog value as output, Raspberry Pi does not have an ADC to read analog values directly. You can however connect mq2 or any other analog sensor to an op-amp functioning as an comparator, set a threshold and connect the output to raspberry pi, this GPIO can be used to trigger events and notifications.
All you need is a op amp (https://www.adafruit.com/product/808) and a potentiometer to set the threshold.

Hello, i like your great work and i will do this but i read this only works on a Raspberry... Did you mean it works only on "Raspberry(1)" except Raspberry 2 and 3 or it doesnt work on any other platform?

This plugin only works with Raspberry PI family, any revision, even the zero. It rely on RPi.GPIO python library and utilize Raspberry Pi interrupts.
I have no plans to port this plugin to other boards. Those could be major changes, and I don't have any other sbc test.
So you have 3 options:

  • Use a raspberry pi
  • Fork the plugin, make the necessary changes to work on your specific sbc (for example if using an orange pi you should probably use this library: https://github.com/WereCatf/WiringOP)
  • Donate one SBC so I can properly test and implement the changes

Any way to make some of the control buttons be on the control tab?
I have a printer power control on this that controls a relay that powers the PSU. I'd like to make it have a button on the control tab.

Buttons are on the enclosure tab, each plugin should create a new tab.

It is possible to insert buttons on other tabs, but it's not the correct way to do. You can re-order the tab and make the enclosure plugin show up first on your octoprint.

Check instructions on how to do it on the "Tab Order" on my github page:
https://github.com/vitormhenrique/OctoPrint-Enclosure/blob/master/README.md

I did already change the tab order. I really just wanted the button to be on the control tab, since I'm often already on the control tab. I'm not so concerned with what's thought to be correct.

Thanks for sharing;
When will the GCODE outputs be implemented;
I'm thinking of some sort of filament-autoload for my Bowden setup.

Has anyone got this to work alongside PSU_Conmtrol plugin for OctoPrint?
Setting this to use Board Mode I get this error: ('The GPIO channel has not been set up as an OUTPUT',)
Unchecking this and I get: ('The GPIO channel has not been set up as an OUTPUT',)

I have been trying to get the filament plugin part of this plugin to work all day today and for some reason the print wont pause when the filament sensor is empty. (the sensor works because the LED comes on when empty). I have a Lulzbot Taz 6 with this filament sensor: https://www.amazon.com/gp/product/B00EVOKHPO/ref=oh_aui_detailpage_o07_s00?ie=UTF8&psc=1
I have tried using both numbering systems with the RaspBerryPi on both settings and none of them work. Is there also something I can use to check if the sensor is hooked up right? without printing? Like I said I am lost on why this sensor is not working. Hopefully you can think of something to help. if you need any more info about the printer sensors or any of that stuff just ask. I'm really excited to get this thing working finally.

please, read the discussion on this forum and see if that helps..
https://forum.lulzbot.com/viewtopic.php?f=16&t=2925&start=90

Also, if you want help you need to give me much more information, how is your connection made? do you know if the sensor is active low or high? (aka does it connect to ground when detects the end of filament or does it connect to vcc?) You need to setup the input according to all those informations, it does not matter what type of GPIO number you use.

Best way to test the sensor is start a print and trigger the sensor before the printer actually starts to print. Keep in mind that if the printer is on a "waiting" status, it will not respond to gcodes until it finishes whatever it is doing, for example, if the printer is "waiting for a temperature" you will not see the sensor being triggered, until it finishes getting up to temperature.

Thank you for the reply. I am currently trying to play with the settings a little bit but so far I have no luck. I am only using the RaspBerryPi though. Do I need any other piece of equipment to be able to make this code to work? I can tell that the sensor is working at least I just don't think that the Pi or the code are picking up the signal.

Again, if you need my help, I can help you, but If you don't give me details on your setup it is impossible to do so.
There are more than 100 of people using this plugin and the code works, it is just a matter of configuration. you need to give more details, pictures of your wiring and diagram in order for me to help you.

I'm using the RaspBerryPi B+ using this filament sensor exterior: https://www.thingiverse.com/thing:1789486 using this sensor: https://www.amazon.com/gp/product/B00EVOKHPO/ref=oh_aui_detailpage_o07_s00?ie=UTF8&psc=1 the ground is wired to GROUND Pin 14, the signal is plugged into the GPIO 18 (or pin 12), and the volt is plugged into the volt is plugged into the very first 5v power pin. using the diagram on: http://www.raspberrypi-spy.co.uk/wp-content/uploads/2012/06/Raspberry-Pi-GPIO-Layout-Model-B-Plus-rotated-2700x900.png . in the Enclosure Plugin under Raspberry Pi Inputs -> IO Label = Filament Loss, Event Type = Printer, Input IO Number = 12, Input Pull Resistor = Input Pullup, Event Trigger = Fall, Printer Action = Filament Change. Then under Avanced Options -> Enable debug info and Use Board Pin # (selected), Filament Detection Timeout = 20, Filament change Gcode =
G91 ;Set Relative Mode
G1 E-5.000000 F500 ;Retract 5mm
G1 Z15 F300 ;move Z up 15mm
G90 ;Set Absolute Mode
G1 X20 Y20 F9000 ;Move to hold position
G91 ;Set Relative Mode
G1 E-40 F500 ;Retract 40mm
M0 ;Idle Hold
G90 ;Set Absolute Mode
G1 F5000 ;Set speed limits
G28 X0 Y0 ;Home X Y
M82 ;Set extruder to Absolute Mode
G92 E0 ;Set Extruder to 0
Notification Provider = Disabled
I am running this on the Lulzbot Taz 6 using the program PuTTY to communicate to the RaspberryPi. If there is anything else that can be useful to you may you be specific. I'm fairly new to this stuff and am very sorry if I annoy you with some of the simple questions and the stupid ones as well.

Taz 6 optical filament runout sensor
by KodeKat

I LOVE this plugin! It's just what I needed for my enclosure. Great work.

Question: Is there any way to set a single input to 'toggle' an output? I have a few buttons that I'd like to have toggle an output. For example, I have push buttons to control LED lights and another to pause/resume a print, and one for a fan. Is there any way to do this with only a single push button (first press = on, second press = off), or is this a feature that could be added? This would save me a LOT of wiring and trouble.

Again, thanks for you work!

There are two ways to accomplish this:
You need to add TWO momentary push buttons, one to turn on the other to turn off...
OR
You can use ONE latching push button and create two inputs on the same button, one for the falling event and another to the rising event, each one will perform the action that you want.

I might add the feature to toggle the output for momentary push buttons on the future, but for now, I would just use latching ones....

I responded earlier, but it must have not posted for some reason, but I'm thinking about looking the code for the plugin and seeing if I can add the toggle feature myself. I've never developed with python and have never looked at octoprint's extensibility features before so it should be interesting. I'll send you whatever I come up with.

I was thinking about the latching switches, and I I've thought of a minor issue. For example, suppose I have a latching switch to control some lights in the cabinet. I can add the inputs as you suggest and all is well. However, if I turn on the lights via the web interface or automatically, say at the start of a print, the latching switch will become out of sync, requiring two button presses toggle the lights. This is a minor issue except that I have illuminated switches, and will have to redo some wiring to make them work in this case if I want 'illuminated' to always mean 'on'.

Thanks again for your input and the great plugin!

This really does look amazing mate! What i'd like to do with this and I was just hoping you can clarify if this will work before I start ordering loads of bits is...

I want to print ABS, but i'm not going to move all the electronics out of the enclosure. So what I'd like to do is add say a 120mm or 140mm 12v fan at the top of the enclosure & when the temperature of the enclosure say hits 40C, turn the fan on which will pull some of the hot air out of the enclosure.... I just wanted to check to see if this is possible?

Thanks for all your hard work though! This really does look good!

That is definitely one use case for the plugin.

I did not remove my electronics from my enclosure, but I opted to create holes on the size and having air flow from outside of the enclosure to the electronic compartment.

Inside my enclosure I have an active heater and I run my enclosure around 45 to 50C for big ABS prints to minimize warping.

You don't need loads of bits, buy a USB fan those a cheap and easy to control using 5V, a raspberry pi and a relay board for your PI.