Hi guys
I am trying to get reading from the DHT22 Grove sensor via i2c port on the 2-Mics Pi HAT.
Can’t get any readings, can you please help?
It is connected to the i2c-1 port on the board.
I try every code I could and cannot get it to work.
the last code I tried was this:
both the Play With Raspberry Pi (With Grove Base Hat for Raspberry Pi) section
and Play With Raspberry Pi (with GrovePi_Plus)¶
and neither worked.
i2cdetect gives me this:
$ i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- UU – -- – -- –
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
when i try this code:
git clone https://github.com/Seeed-Studio/Seeed_Python_DHT.git
I get this result:
$ python dht_simpleread.py
DHT22, humidity 0.0%, temperature 0.0*
DHT22, humidity 0.0%, temperature 0.0*
I wonder if i need to change this line to something else?
sensor = seeed_dht.DHT("22", 12)
salman
November 6, 2020, 6:11am
#3
Are you connecting the Sensor GPIO12 grove connector ?
1 Like
Hansen
November 6, 2020, 6:11am
#4
Hi @Tom_Zamir :
I would say, you connect DHT22 Grove sensor with the 2-Mics Pi HAT via GPIO12 port.
1 Like
Hi guys
So I thought it would go in the I2C port, like with the DHT31, but I tried the GPI12 port and indeed it works now with the code above.
but… I have very high error rate, most readings result in 0 temp and 0 humidity, and once in a while I get a good reading.
using this code base, any idea how I can improve this fault rate? I have 3 different zero pi and 2-mic hats and 3 sensors, and it happens with all of them .so i don’t think it is hardware specific.
not sure how to allow the sensor more time during sample with this dht_sensorsample.py
thanks in advance!
You are right, changing to GPIO12 sort of works as I wrote in my other reply, it misses alot of readings
is there a way to connect it to I2C or do something about all the missed readings?
salman
November 7, 2020, 1:27pm
#7
You want to read the reading via I2C Protocol, or you want to use the pins?
Hi Salman
Well currently it is not working well on the GPIO12 pins with this code:
before I used SEEED SHT31 with this code:
connected to I2C port, and it works like a charm
so I am trying to get the same stability/performance with the SHT22 humidity-temp pro sensor.
Any idea how to make this happen?
well guys, i found that this script works just fine:
Wiring up the sensor First things first, let’s connect the sensor to the Raspberry Pi. Red wire connects to pin 1 Black wire connects to pin 6 Yellow wire connects to GPIO4 pin 7 (you can connect this wire to any of the GPIO pins, just make note of...
connecting the dht22/am2302 to GPIO12
and running:
sudo AdafruitDHT.py 2302 12
gives me accurate results every time… not sure why the Seeed library is failing in this instance…