Temperature/Humidity Sensor Setup Issue

What is the problem?

I am trying to wire a DHT11 temperature/humidity sensor to interface with the enclosure plugin. I am following this walk through https://awesomeopensource.com/project/vitormhenrique/OctoPrint-Enclosure and have run into an issue installing the packages need. This is the terminal inputs which have been used.

cd ~
git clone https:// github.com/adafruit/Adafruit_Python_DHT .git (remove the spaces. put there to remove hyperlink)
cd Adafruit_Python_DHT
sudo apt-get update
sudo apt-get install build-essential python-dev python-openssl
sudo python setup.py install

All scripts run expect "sudo python setup.py install". At this step I receive this error:

Traceback (most recent call last):
File "setup.py", line 1, in
from setuptools import setup, find_packages, Extension
ImportError: No module named setuptools

What did you already try to solve it?

I have tried testing the file path which appears to be valid. I have restarted the process of installing the packages. I have rebooted the system.

Have you tried running in safe mode?

No.

Did running in safe mode solve the problem?

WRITE HERE

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

octoprint-systeminfo-20210821214914.zip (34.4 KB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

OctoPrint 1.6.1
Python 3.7.3
OctoPi 0.18.0
Logging in with MacOS

Hello @matt !

The driver that is mantioned in the instructions is deprecated:

You may use the new one:

It should be supported by my plugin:

It should be pretty easy to wire up. My plugin should auto detect it.

I followed that tutorial and I am still unable to get values through OctoPrint Enclosure Plugin or terminal. The libraries/packages installed without error. The sensor has a led which is on so the unit is receiving power and ground. In respect to plugin setup, do I specify the physical PIN number or the GPIO PIN number? The plugin dose not specify. I have tried both without success.

Have you tried to run the test ( python3 dht_simpletest.py) that is mentioned in the second half on the site (Python Setup | DHT Humidity Sensing on Raspberry Pi or Beaglebone Black with GDocs Logging | Adafruit Learning System) ?

In the Top Temp plugin, I cannot find an option to accept data from a GPIO pin. Can you point me in that direction?

In top temp, you have to all a python command script to get the values:

Ahh if you were using an DS18B20 it would autodetect them and show under predefined. I will have to try and setup a DHT11 later today. I would highly recommend a DS18B20 - they are a lot more rpi friendly and supported directly in the hardware.

Hi There. I case of a not well working Enclosure Pluginat the moment i found my own solution working with a DHT22 and the TopTemp Plugin. Thank you for this great job .

I just modified AdafruitDHT.py
Edit the following Line:
print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity))
to: print ('{0:0.1f}'.format(temperature))
so vou will get a Value only. Working great. You can get the Humidity by doing a renamed copy of AdafruitDHT.py as well with: print ('{0:0.1f}'.format(humidity))
In the Plugin you can call them with:
/home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 4
eg. /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT**(copy)**.py 22 4
best regards Michel

Just to include, there is a relatively* easy way using "device tree overlays" to include support for both types of sensor at the linux level, which can then be read with cat

I also ran into the Problem with old Libaries, after upgrading to octoPi 1.0.0.0 RC3 and here ist, how I brought my DT22 back to life:
First, IΒ΄ve written a dht_v1.py :

#!/usr/bin/python3
# SPDX-License-Identifier:

#import time
import board
import adafruit_dht

# Initial the dht device, with data pin connected to:
dhtDevice = adafruit_dht.DHT22(board.D3, use_pulseio=False)
# you can pass DHT22 use_pulseio=False if you wouldn't like to use pulseio.
# This may be necessary on a Linux single board computer like the Raspberry Pi,
# but it will not work in CircuitPython.
# dhtDevice = adafruit_dht.DHT22(board.D18, use_pulseio=False)
temperature_c = dhtDevice.temperature
humidity = dhtDevice.humidity
print(
            "Temp: {:.1f} *C    Humidity: {}% ".format(
                temperature_c, humidity
            )
        )
quit(0)

Now, you can call this Script in Top Temp as a customer script like this:

Humidity:
python3 /home/pi/dht_v1.py |cut -d ":" -f3|cut -d"%" -f1

Temperature:
python3 /home/pi/dht_v1.py |cut -d ":" -f2|cut -d"*" -f1

Happy printing !

1 Like