Communication with AHT10 failed!

Hi.
I’m trying out a NodeMCU board with an AHT10 temperature / humidity sensor attached to it.
But it’s not working.
The PINS are connected like this:

VIN → 3v
GND → G
SCL → D1
SDA → D2

The errors says:

[i2c.arduino:038]: I2C Bus:
[i2c.arduino:039]:   SDA Pin: GPIO4
[i2c.arduino:040]:   SCL Pin: GPIO5
[i2c.arduino:041]:   Frequency: 50000 Hz
[i2c.arduino:044]:   Recovery: bus successfully recovered
[i2c.arduino:054]: Results from i2c bus scan:
[i2c.arduino:056]: Found no i2c devices!
[switch.gpio:050]: GPIO Switch 'NodeMCU Internal LED'
[switch.gpio:050]:   Inverted: YES
[switch.gpio:051]:   Pin: GPIO2
[switch.gpio:073]:   Restore Mode: Restore (Defaults to OFF)
[status:034]: Status Binary Sensor 'NodeMCU-Test Connection Status'
[status:034]:   Device Class: 'connectivity'
[aht10:135]: AHT10:
[aht10:136]:   Address: 0x38
[aht10:138]: Communication with AHT10 failed!

And the configuration in ESPHome looks like this:

sensor:
  - platform: aht10
    i2c_id: bus_a
    temperature:
      name: "NodeMCU1 Temperature"
    humidity:
      name: "NodeMCU1 Humidity"
    update_interval: 60s

i2c:
  scl: D1
  sda: D2
  scan: True
  id: bus_a

What am I doing wrong?

Thanks

Double check your wiring.

Also check you have the correct board type specified.

1 Like

But that’s exactly the problem. The wiring seems just fine to me.

And according to this picture.

D1 = GPIO5 = SCL
D2 = GPIO4 = SDA

Just like in my i2c settings
and according to other posts I’ve seen, VIN on the sensor should go to a 3v pin on the board.
and G is G.

Don’t really know what more to do.

Thanks

You say that, but did you actually:

Oh, I have checked it many times.
It is wired exactly like it says in this post:


Unfortunately, he does not use ESPHome.

But the config, does that look correct at least?

Is there no one else in here that has successfully connected a AHT10 sensor to a NodeMCU board?

Do you have pull-up resistors on data lines? They should be 10k or 4k7, or anything in that range.
And, check if your sensor really have address 0x38…
EDIT: maybe i’m missing something, but above picture has SDA connected to D1(SCL) and SCL to D2(SDA)…? Wrong…

Yes, I see that the picture is wrong. I have tried to flip those two pins, but with same result
I’m new to this… pull-up resistors? Is that necessary to have between the board and this sensor?
Isn’t that needed only while switching between 5v and 3.3v? This board delivers 3.3v out of the box

The sensor has printed both 0x38 and 0x39 on it. Tried them both

To bad I didn’t buy more than one. That way I could determine if it’s broken or not.
They are dirt cheap, so it’s not a problem to buy plenty, but it takes 2 months to deliver…

I don’t know what more to do. I have to assume this one is broken. The NodeMCU board seems to work fine otherwise.

Thanks

No, it is not necessary. The ESP will automatically enable its internal pull-up 10K resistors when you define the I²C bus.

As you have said the wiring diagram was a mistake, then everything you have done is correct and it looks like you may have a faulty sensor.

The only other thing you could try is to specify a bus frequency of 100kHz:

i2c:
  scl: D1
  sda: D2
  scan: True
  id: bus_a
  frequency: 100kHz

The AHT10 datasheet says it supports 0 to 100kHz (400kHz in high speed mode) and the default frequency ESPHome uses is 50kHz. Generally slower is more reliable, but it’s worth at try. I can’t think of anything else.

The datasheet also says the AHT10’s maximum input voltage is 3.6V. You didn’t accidentally power it from 5V at any time did you?

How long are the cables to the AHT10?

You’re right. But, despite the fact that ESP does have pullups and many sensors have them it did happen to me that sensor didn’t work without them, mostly if cable was too long - in this case 10k is somewhat too high. It worth a try.

The datasheet also says the AHT10’s maximum input voltage is 3.6V. You didn’t accidentally power it from 5V at any time did you?

This can be tested: define two other pins as I2C bus. If inputs 4 and 5 are “gone”, the new ones will work, if not it’s faulty sensor. It’s not mandatory to have GPIO4 and 5 as I2C.

No, not at any time.

10cm

Testet. Same result :frowning:
Thanks for helping out, guys. But it might just be a case where a $1 gadget just don’t work :slight_smile:

I have another board I’ve could have tested it on, but I’m not able to get it to work in ESPHome.
It is called:
UNO R3 Official Box ATMEGA16U2 / UNO+WiFi R3 Original ATMEGA328P Chip CH340G For Arduino UNO R3 Development Board WeMos ESP8266
But I guess that is a story for another day.

You could say my ventures into the ESPHome world has had a bad start.

Thanks again

can your sensor board be powered by just 3.3.v?
maybe it needs 5v
a google image search shows some aht10 breakouts do feature power regulation
but not everyone has this

check your ground connection, sensor may not be properly grounded. I had this issue where there was a difference of 0.5v between the sensor ground and the power supply ground.
hope this helps

So… I have the same problem and I am confused. I’ve spent hours reading several forums, trying different things, but I hope someone can help me. I have a AHT10 as well. I hooked it up to an Arduino Mega with some pull up resistors and it worked the first try. I have an esp8266 NodeMCU that says “LoLin ver 0.1” and on the back it says “New Nodemcu V3”.

I see a “Found no i2c devices!” followed by “Communication with AHT10 failed” a little later.

What I’ve tried:

  • With and without pull up resistors
  • Confirmed the sensor is working fine with an Arduino Mega
  • Swapping the SCL/SDA pins
  • Tried many different configs, e.g. pins “D1, D2”, “GPIO5, GPIO4”, different frequency (100kHz for instance)
  • Soldered everything to a perfboard and again triple checked wiring to avoid wonky breadboard issues (regretting this one a little lol)

My relevant config:

i2c:
  scan: true
  sda: GPIO4
  scl: GPIO5
  id: bus_a

sensor:
  - platform: mhz19
    co2:
      name: "MH-Z19 CO2 Value"
    temperature:
      name: "MH-Z19 Temperature"
    update_interval: 30s
    automatic_baseline_calibration: true
  - platform: aht10
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 30s
    i2c_id: bus_a

Wiring:
Wires are as short as they can be. I connected the SDC to D1 and SDA to D2 with 2x 4,7k resistors going to the 3V. VCC connected to the pin that says “3V”, GND pin connected to “G”. I triple checked all the connections with a multimeter and I am sure nothing is shorting, everything seems to be connected exactly as I intended. There is ~3,3V on the VCC pin. It’s wired exactly the same way I used it with the Arduino when it did work, with the only difference being that Arduino runs at 5V. But the AHT10 says it can run 2.2-5.5V so that should be fine.

I also have a MH-Z17C connected to the same NodeMCU on the UART, using VU (5v) and the rx/tx/gnd pins. That one is working fine. I’m using the same ground pin for both the MH-Z17C and the AHT10 but that should also be fine…right? The store where I purchased it, shows the same pinout as is mentioned by @Dal above, except the picture I got does not mention SCL and SDA.

I can’t figure out why I can’t get this to work. There must be something simple I’m overlooking. What am I doing wrong? :frowning:
I can’t imagine specifically those 2 pins on the NodeMCU are fried. It’s a new NodeMCU and I never used those pins for anything else before. Is there anything I can do with a multimeter to check, or, anything else to debug this further?

Did you try without mhz sensor?

Thanks for the suggestion @Protoncek, I will give that a go!

Hi I´m tring to make it wor too, but I´m not undeertand the message error:

ARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 1.2.2
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 2.1.0
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
|-- Wire @ 2.0.0
Compiling /data/teste/.pioenvs/teste/src/esphome/components/api/api_pb2.cpp.o
xtensa-esp32-elf-g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
*** [/data/teste/.pioenvs/teste/src/esphome/components/api/api_pb2.cpp.o] Error 1

My code is:

sphome:

  name: teste

  friendly_name: teste

esp32:

  board: esp32dev

  framework:

    type: arduino

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: "uHkCyFmg+XMqlymFHRFr3mgh9roNtGvMBxTjX5Go7W4="

ota:

  password: "umidade"

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Teste Fallback Hotspot"

   

captive_portal:

i2c:

  scl: GPIO5

  sda: GPIO4

 

sensor:

  - platform: adc

    pin: A0

    id: 'LDR_1'

    name: "ESP8266 ESP-12E Brightness"

    update_interval: 10s

    filters:

      - multiply: 3.3

  - platform: aht10

    update_interval: 60s # Intervalo de leitura em segundos

    # Sensores individuais

    temperature:

      name: "Temperatura"

      unit_of_measurement: "°C"

   

    humidity:

      name: "Umidade"

      unit_of_measurement: "%"

Hello All,

Sorry to bump this old thread, but I just wanted to say, that I was also having “Communication with aht10 failed” error, even though address 0x38 showed up on the i2c boot scan!! Which means the wiring is correct.
It turned out that using AHT10 in the config was causing the error, I had to use AHT20 to fix the problem. My module says aht10 on the silkscreen, the chip has aht10 laser engraved into it. But it speaks aht20 with esphome!!
Probably got scammed on AliExpress for buying from a choice seller, instead of my goto freeshipping store. aht20 relabled as aht10 is my guess as to this problem

Kind regards

3 Likes

Yes, this works.
I had the exact same problem, probably bought from the same listing on AliExpress as it says AHT10 on the module and only works with AHT20. Thank you so much, if I hadn’t of seen this message I would have been trying to figure out why it wasn’t working for hours.

Funny a while back I bought this one. Although it is clearly advertised as an AHT20 it is only working as an AHT10. There are no markings on the chips,

f.y.i. information I bought the black one with I2C connector/cable; perhaps the purple does contain the AHT20 chip and/or for the black one they received a new shipment. You never know.

Also compared to the BMP280 the AHT10 is 0,5 Celsius lower. Both readings are a bit higher than the real temperature.

See also a lot of read attempt errors but likely I should have done some additional stuff according to the doc?
[15:30:49][D][aht10:099]: Read attempt 1 at 32ms
[15:30:49][D][aht10:107]: AHT10 is busy, waiting…
[15:30:49][D][aht10:099]: Read attempt 2 at 69ms
[15:30:49][D][aht10:125]: Success at 74ms

AHT10 from AliExpress

sensor:
  - platform: aht10  # Use aht10 platform as ESPHome may not have aht20 specific support
    variant: AHT20  # Specify the model as AHT20
    temperature:
      name: "AHT10 Temperature"
      id: aht10_temperature
    humidity:
      name: "AHT10 Humidity"
      id: aht10_humidity