Enclosure Temperature / Fan / Light Control / Filament - Octoprint Plugin

It is going to work, but the signal back to RP will be 5V and raspberry pi are not 5V tolerant, using 5V as input will most likely fry your raspberry pi on the long run.

Now I put VCC of AM2320 to 3.3v of RBP and it works too, but my question is ¿what kind of rele can I use?

How I will connect the wires to RBP?

I thought in that:

http://www.ebay.es/itm/MODULO-RELE-5V-10A-DE-2-CANALES-ARDUINO-ARM-PIC-AVR-DSP-RELAY-RASPBERRY-PI-/201479976612?hash=item2ee92476a4

That is the same model that I’m using, read my GitHub instructions and there is an explanation on how to wire the relay to your raspberry pi.

Sorry for not understand correctly that you say here:

The relays module that I used can be found here. Those relays are active low, that means that they will turn on when you put LOW on the output of your pin. In orther to not fry your r-pi > connect 3.3v to VCC, 5V to JD-VCC and Ground to GND> .




Where I have to put the jumper?

The relay has two VCC and two GND

You don’t use the jumper, there are two VCC, one that is going to the input of the relay, and the other is going to be used to activate the transistor that will open the relay, so you need to REMOVE THE JUMPER, connect 3.3v from raspberry pi to the pin labeled VCC on the relay, 5V from raspberry pi to JD-VCC on the relay and Ground to GND.

Hi, I am very new to raspberry pi and having a little difficulty getting this setup, I am using a DHT11 sensor. In the octoprint web interface it says the temp is 588.8 and the humidity is 0. When using the instructions on this web page https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/software-install-updated I get temp = 23 humidity = 20% . Do I need to specify somewhere that I am using the DHT11 sensor for this plugin to work correctly? Thank You for any help.

try in settings. plugins, enclosure plugin.

OK Thanks I will do that.

One question: Have you ever thought in modify el main screen and below BED temperature put “enclosure temperature”?

You can make a “Safe plugin for printer” and plus telegram plugin if the electronic has to much temperature then disconnect the printer by rele and trigger a message to telegram, for example…or something like that

Thank you. That seems so obvious now. I am now getting accurate temp reading. However the humidity is still reading 0 in octoprint. I am not sure where to go from here. Does this tell you anything?

pi@octopi:~/Adafruit_Python_DHT/examples $ sudo ./AdafruitDHT.py 11 4
Temp=21.0*  Humidity=22.0%



pi@octopi:~ $ ~/.octoprint/plugins/OctoPrint-Enclosure/extras/GetTemperature.py
usage: sudo ./Adafruit_DHT.py [11|22|2302] GPIOpin#
example: sudo ./Adafruit_DHT.py 2302 4 - Read from an AM2302 connected to GPIO #4



pi@octopi:~ $ ~/.octoprint/plugins/OctoPrint-Enclosure/extras/GetHumidity.py
/home/pi/.octoprint/plugins/OctoPrint-Enclosure/extras/GetHumidity.py: line 1: syntax error near unexpected token `newline'
/home/pi/.octoprint/plugins/OctoPrint-Enclosure/extras/GetHumidity.py: line 1: `<!DOCTYPE html>'

It does not make any sense for me, why would you turn the printer off if your enclosure get’s hot? Marin already has fail stops if your printer somehow misbehave, for example if your thermocouple fail, or disconnect.

Yes, when you downloaded the humidity script you copied the html code, like the entire page, you need to copy only the script…

I’m guessing you did not use wget to download the code, you can open the file and remove the unnecessary part, or copy the code bellow:

#!/usr/bin/python

import sys
import Adafruit_DHT

# Parse command line parameters.
sensor_args = { '11': Adafruit_DHT.DHT11,
                '22': Adafruit_DHT.DHT22,
                '2302': Adafruit_DHT.AM2302 }
if len(sys.argv) == 3 and sys.argv[1] in sensor_args:
    sensor = sensor_args[sys.argv[1]]
    pin = sys.argv[2]
else:
    sys.exit(1)

# Try to grab a sensor reading.  Use the read_retry method which will retry up
# to 15 times to get a sensor reading (waiting 2 seconds between each retry).
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

# Note that sometimes you won't get a reading and
# the results will be null (because Linux can't
# guarantee the timing of calls to read the sensor).
# If this happens try again!
if humidity is not None:
    print('{0:0.1f}'.format(humidity))
else:
    print('Failed')
    sys.exit(1)

Just for safe. My enclosure is made of wood abd the extrusor is to hot. Maybe in fail it could be dangerous.

Or a fail in electronic, it is for control electronic temperature and enclosure temperature.

I got this working now after fixing my mistakes. Thank You for all your help and work on this plugin its awesome. :smiley:

Hello,

Any news on upgrade with new functions ?
Thanks

I actually I coded everything, but did not had time to test.

I’m really busy on other projects and will try to test it and publish this weekend.

I have been working on getting your plugin installed, however I am running into some issues I suspect are being caused by another plugin. Here is the 1st Enclosure error message:

017-02-28 02:28:35,067 - octoprint.plugin - ERROR - Error while calling plugin enclosure
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.1-py2.7.egg/octoprint/plugin/__init__.py", line 229, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_enclosure/__init__.py", line 150, in on_after_startup
    self.startGPIO()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_enclosure/__init__.py", line 52, in startGPIO
    GPIO.setmode(GPIO.BCM)
ValueError: A different mode has already been set!

I am using Filament Sensor Reloaded which uses GPIO.setmode(GPIO.BOARD) - is there a work around so I can use both? I would use your filament sensor however I need a Normally Closed option for my sensor type.

Sure,

I can make part of the preferences to choose the GPIO type naming… I need to push some of the latest changes that I already made on this plugin. I’ll get it tomorrow and you can try it out…

Someday I will learn to wait to post until I exhaust all efforts. It never fails as soon as I post an issue, I find a resolution.

I changed GPIO.setmode(GPIO.BOARD) to GPIO.setmode(GPIO.BCM) in the Filament Sensor Reloaded, and commented out GPIO.setmode(GPIO.BCM) and GPIO.setwarnings(False) in the Enclosure plugin and everything seems to be working.

I know in a previous message you mentioned you are busy on other projects, however if you find yourself bored one night I’d love a couple of small additions:

  1. An option for Normally Closed on the Filament Sensor
  2. An option for Fahrenheit. I was able to modify Adafruits code to show a Fahrenheit, and modify the template to show “F”, but I know as soon as there is an update I’ll forget how I did it.

Thanks Vitor - love this plugin!

You were a second faster on the submit button :wink: . Thanks Vitor.

New release is out. By the way the filament sensor being Normally Closed or Normally Open has nothing to do with active low and active high settings.

Active low mean that the sensor is triggered on is has a LOW input, example when it is connected to GROUND. You can use a Normally Closed sensor with a GROUND on one side and whatever pin you want on the rPI. when the sensor is triggered it will connect GROUND to RPI and pause the print job. Setting active low and active high only change the input pull resistor to UP or DOWN.