Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4832

Device Tree • Re: DHT11

$
0
0
Update :
I tried to read the files (in_temp_input, and humadity)
on a kernel 64, and kernel 32.
Both giving me same error.
when i ran a python code :

Code:

import timedef getDHT11():    DevicePath = "/sys/bus/iio/devices/iio:device0"    tempFile= DevicePath+"/in_temp_input"    humFile = DevicePath+"/in_humidityrelative_input"    try:        with open(tempFile,'r') as f:            temp = float(f.readline())/1000.0        with open(humFile,'r') as f:            hum = float(f.readline())/1000.0        return temp,hum        except ValueError:        return None,None    except IOError:        return None,Nonetry:    while True:        t,h = getDHT11()        if t is not None:            print("Temp: {:.1f} *C \t Humidity: {}%".format(t, h))        else:            print("DHT11 sensor return nothing")        time.sleep(1.0)except KeyboardInterrupt:    pass
I got

Code:

DHT11 sensor return nothingTemp: 0.0 *C  Humidity: 0.0%DHT11 sensor return nothingTemp: 0.0 *C  Humidity: 0.0%DHT11 sensor return nothingTemp: 0.0 *C  Humidity: 0.0%DHT11 sensor return nothingTemp: 0.0 *C  Humidity: 0.0%DHT11 sensor return nothingTemp: 0.0 *C  Humidity: 0.0%DHT11 sensor return nothingTemp: 0.0 *C  Humidity: 0.0%DHT11 sensor return nothing
output of dmesg :

Code:

[  116.055028] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  135.809326] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  142.047936] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  333.202445] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  335.228192] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  337.253749] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  339.279279] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  341.304828] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  343.330309] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8[  345.355743] dht11 humidity-sensor: Don't know how to decode data: 47 0 29 8
I've changed the whole OS, installed new one and still facing the same error. I don't know if the problem is from me or there is a bug in the driver with raspberry pi 4.

Statistics: Posted by abdu744 — Mon Jun 17, 2024 2:29 am



Viewing all articles
Browse latest Browse all 4832

Trending Articles