NathanSmith
Posts: 2
Joined: Thu Feb 20, 2020 9:23 pm

Has anyone be able to get the AHT10 i2c temp/humid sensor to work?

Thu Feb 20, 2020 9:50 pm

Has anyone be able to get the AHT10 i2c temperature/humidity sensor to work with a Raspberry Pi?

I have a Pi-0-w that is working great with the GY-21 i2c temperature/humidity sensor (https://www.aliexpress.com/item/32757326265.html).

I recent bought three AHT10 sensors (https://www.banggood.com/AHT10-High-Pre ... rehouse=CN) with the idea that I could connect both sensors to the same i2c circuit since they have different addresses.

All three AHT10 sensors have failed to work. I can remove the GY-21 sensor from the circuit, and replace it with the AHT10, but when I try
i2cdetect -y 1
all I get is double dashes.

I've tried piscope. It shows that the SCL line is being held high for most of the time. There is no short between the SCL line and +3.3V. It's about 20kohm between the +3.3V terminal and SCL terminal on the sensor. I've checked all my wiring with an volt-ohm meter.

When I disconnect the SCL terminal on the sensor piscope looks normal as near as I can tell.

An AHT10 sensor plus a GY-21 sensor connected in parallel causes the GY-21 sensor to stop working, further confirming the SCL line is being screwed up by the AHT10.

I have a hard time believing that all three AHT10 sensors were dead on arrival. Also my soldering skills are not bad enough to kill all 3 sensors. I've successfully soldered three GY-21 sensors no problem.

Any ideas?

Thanks!

mbath
Posts: 1
Joined: Fri Feb 21, 2020 11:47 am

Re: Has anyone be able to get the AHT10 i2c temp/humid sensor to work?

Fri Feb 21, 2020 12:33 pm

Yes, on my old model 1 A

But I have a problem when connected together with a CSR 4.0 bluetooth USB stick, when using bluetooth -> system halt, reason unknown

pi@raspberrypi:~ $ i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Code: Select all

# -*- coding: utf-8 -*-
#!/usr/bin/python3
#https://github.com/Thinary/AHT10/blob/master/src/Thinary_AHT10.cpp
#https://myhydropi.com/raspberry-pi-i2c-temperature-sensor
#i2cdetect -y 0
import smbus
import time
# Get I2C bus
bus = smbus.SMBus(0)
config = [0x08, 0x00]
bus.write_i2c_block_data(0x38, 0xE1, config)
time.sleep(0.https://www.raspberrypi.org/forums/mcp.php?i=main&mode=topic_view&f=56&t=265796&sid=8727f0c7ad2bfbd29ec556c7f007852b5)
byt = bus.read_byte(0x38)
#print(byt&0x68)
MeasureCmd = [0x33, 0x00]
bus.write_i2c_block_data(0x38, 0xAC, MeasureCmd)
time.sleep(0.5)
data = bus.read_i2c_block_data(0x38,0x00)
#print(data)
temp = ((data[3] & 0x0F) << 16) | (data[4] << 8) | data[5]
ctemp = ((temp*200) / 1048576) - 50
print(u'Temperature: {0:.1f}C'.format(ctemp))
tmp = ((data[1] << 16) | (data[2] << 8) | data[3]) >> 4
#print(tmp)
ctmp = int(tmp * 100 / 1048576)
print(u'Humidity: {0}%'.format(ctmp))
pi@raspberrypi:~ $ python3 temp.py
Temperature: 21.7C
Humidity: 40%

NathanSmith
Posts: 2
Joined: Thu Feb 20, 2020 9:23 pm

Re: Has anyone be able to get the AHT10 i2c temp/humid sensor to work?

Sat Feb 22, 2020 7:01 pm

Thank you mbath. Good to know that someone has been successful with this sensor.

vgy
Posts: 1
Joined: Tue Mar 10, 2020 6:30 pm

Re: Has anyone be able to get the AHT10 i2c temp/humid sensor to work?

Tue Mar 10, 2020 7:15 pm

Hi guys!

I had/have the same problem.

AHT10 alone works, that is no problem, no question. BUT: when there are other devices on the i2c, somehow-sometime the system freezes. Was a voodoo.

The reason is, that the AHT10 CAN NOT WORK WITH OTHER DEVICES ON I2C. For an unknown reason, the module interprets any 01110001 bytes on the i2c as an own read command, and begins to send the 6 bytes. I did not know it, and had to fight, till I found what the problem is. And than what do I see/found in the PDF of the AHT10? This line on page 8 under Figure 11:

"3) Only a single AHT10 can be connected to the I2C bus and no other I2C devices can be connected ."

And that's it guys. They know it, they put it down - no other devices with the AHT10. And - is really so. I did not see that remark, and found myself alone the problem with 01110001 bytes. Then I saw the remark, and the picture was clear.

For the time being, I do not have any else solution to the problem, than to change all 01110001 bytes going out on i2c to 01110010, then the AHT does not activate itself unnecessarily. In my application that only causes two LCD pixels to change, and I can live with it. In other applications, of course, not a good idea to "hack" a byte that is to go out on i2c...

Hope I could help or clear up a little bit.

Regards,
George
from Hungary

Return to “Troubleshooting”