logo elektroda
logo elektroda
X
logo elektroda

Wemos2mini and AHT20+BMP280 module - Tasmota only reads BMP280, no reading from AHT20

Nargo 3537 19
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20780746
    Nargo
    Level 22  
    Hello
    I bought AHT20+BMP280 sensor module on I2C, connected to Wemos2mini, uploaded tasmot-sensors and BMP280 reads and AHT20 no longer, displays VEML6070.
    I do I2CScan = {"I2CScan": "Device(s) found at 0x38 0x77"}.
    Response correct.
    I2CDriver = {"I2CDriver":"7,8,9,10,11,12,13,14,15,17,18,20,24,29,31,36,41,42,44,46,48,69,76"}.
    I2CDriver12 0 = {"I2CDriver": "7,8,9,10,11,!12,13,14,15,17,18,20,24,29,31,36,41,42,44,46,48,69,76"}.
    I VEML6070 disappeared and still no AHT20.
    I make my own compilation
    #ifdef USE_BMP
      #undef USE_BMP
    #endif
    #define USE_BMP
    
    #ifdef USE_AHT2x
      #undef USE_AHT2x
    #endif
    #define USE_AHT2x
    

    I still only BMP.
    I unplug AHT+BMP module and plug separate BMP and AHT modules and everything works as it should.
    Not discouraged I fire up the Arduino and upload the AHT demo compilation and BMP plugs in the AHT+BMP module
    #include <Wire.h>
    #include <SPI.h>
    #include <Adafruit_BMP280.h>
    #include <AHT20.h>
    AHT20 aht20;
    
    Adafruit_BMP280 bmp; // I2C
    
    void setup() {
      Serial.begin(9600);
      while ( !Serial ) delay(100);   // wait for native usb
      Serial.println(F("BMP280 test"));
      unsigned status;
      //status = bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID);
      status = bmp.begin();
      if (!status) {
        Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "
                          "try a different address!"));
        Serial.print("SensorID was: 0x"); Serial.println(bmp.sensorID(),16);
        Serial.print("        ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
        Serial.print("   ID of 0x56-0x58 represents a BMP 280,\n");
        Serial.print("        ID of 0x60 represents a BME 280.\n");
        Serial.print("        ID of 0x61 represents a BME 680.\n");
        while (1) delay(10);
      }
    
      /* Default settings from datasheet. */
      bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                      Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                      Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                      Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                      Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
      Serial.println("Humidity AHT20 examples");
    
      Wire.begin(); //Join I2C bus
      //Check if the AHT20 will acknowledge
      if (aht20.begin() == false)
      {
        Serial.println("AHT20 not detected. Please check wiring. Freezing.");
        while (1);
      }
      Serial.println("AHT20 acknowledged.");
    }
    
    void loop() {
        Serial.print(F("Temperature = "));
        Serial.print(bmp.readTemperature());
        Serial.println(" *C");
    
        Serial.print(F("Pressure = "));
        Serial.print(bmp.readPressure());
        Serial.println(" Pa");
    
        //Get the new temperature and humidity value
        float temperature = aht20.getTemperature();
        float humidity = aht20.getHumidity();
    
        //Print the results
        Serial.print("Temperature: ");
        Serial.print(temperature, 2);
        Serial.println(" C\t");
        Serial.print("Humidity: ");
        Serial.print(humidity, 2);
        Serial.println("% RH");
    
        Serial.println();
      
        delay(2000);
    }
    

    Result:
    Temperature = 27.20 *C
    Pressure = 98470.20 Pa
    Temperature: 26.80 C	
    Humidity: 51.00% RH


    I search and search and I can't find a solution.
    The module works but not under Tasmot.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • Helpful post
    #2 20780858
    khoam
    Level 42  
    Nargo wrote:
    I uploaded tasmota-sensors and the BMP280 reads and the AHT20 no longer reads, it displays VEML6070.
    In the standard Tasmota binaries there seems to be no support for the AHT20.
    https://tasmota.github.io/docs/AHT2x/
  • #3 20780999
    Nargo
    Level 22  
    khoam wrote:
    In the standard Tasmota binaries there seems to be no support for AHT20.


    As I wrote I added in my own compilation, the single AHT sensor is read, while the AHT+BMP module is no longer.
  • #4 20781032
    khoam
    Level 42  
    The AHT20 and BMP280 use different default I2C addresses, 0x38 and 0x76, so there is unlikely to be a conflict here. What is the value of the resistors that "pull up" SDA and SCL to 3V3 (I assume these lines are not pulled up to 5V).
  • ADVERTISEMENT
  • #6 20781078
    khoam
    Level 42  
    Nargo wrote:
    I have such an AHT20+BME280 Module
    What is the voltage on the VDD?
  • ADVERTISEMENT
  • #7 20781108
    Nargo
    Level 22  
    The whole thing is powered from 3.3V connected on a pin,
    In this connection it works, when I switch to the other module it is only BME.
    When I upload the program via the arduino I get a reading in both cases.
    Breadboard with connected modules and wires. .
  • #8 20781311
    khoam
    Level 42  
    I'm a bit lost in your descriptions. Maybe it will be easier if you answer the questions:
    1. Using the Arduino program (from post one), are the sensors read correctly on all modules from the above post?
    2. On which modules after loading the tasmot-sensors firmware the AHT20 cannot be read?
    3. Has the tasmot-sensors firmware been compiled by you with the AHT20 option checked?

    Nargo wrote:
    AHT20+BME280 module

    This module should be powered from 3V3.

    Nargo wrote:
    And the AHT20 and BMP280 kit

    These modules should be powered from 5V.
  • #9 20781495
    Nargo
    Level 22  
    khoam wrote:

    1. Using the Arduino program (from post one), are the sensors read correctly on all the modules in the above post?


    All are read by the program in Arduino.
    khoam wrote:

    2. On which modules after loading tasmot-sensors firmware the AHT20 cannot be read?
    On none. Only BMP reads correctly.
    khoam wrote:

    3. Has the tasmot-sensors firmware been compiled by you with the AHT20 option checked?

    I compiled with the option checked
    
    #ifdef USE_AHT2x
      #undef USE_AHT2x
    #endif
    #define USE_AHT2x


    I read BMPs from both, but only AHT20 single.
  • ADVERTISEMENT
  • #12 20781976
    khoam
    Level 42  
    Did you build the tasmot-sensors firmware with the drayer disabled for the VEML6070?
  • #13 20781991
    Nargo
    Level 22  
    Only BMP, AHT20 and AM2301 from sensors and HA and MQTT communication
  • #14 20782545
    khoam
    Level 42  
    We are slowly entering the realm of magic. One more thing I would check.
    When you connect two independent modules to the ESP, the resultant value of the SDA and SCL pull-up resistors is about 3.2 kΩ.
    When you connect one "double" module it is 4.7 kΩ.
    In the latter case, I would connect additional pull-up resistors of 4.7 kΩ - 10 kΩ to the SDA and SCL lines for the 3V3 supply.
    The value of the pull-up resistors may be important because there is no I2C hardware controller in the ESP8266 - support for this interface is software.
  • #15 20782730
    Nargo
    Level 22  
    I have fitted 10 kΩ resistors.
    Still no AHT20 from the AHT+BMP module.
    I have checked in ESP Home and it is the same as in Tasmota, the single is visible, from the double only the BMP.
  • #16 20782753
    khoam
    Level 42  
    Can you post a picture of the top of the AHT+BMP module? In reasonable detail.
  • #17 20782979
    Nargo
    Level 22  
    Probably the best I can do.
    Electronic module with labels SCL, GND, SDA, VDD on a breadboard

    Added after 7 [hours] 26 [minutes]:


    I figured out what, I didn't figure out how.

    For AHT10/15 the initiation command is binary 1110'0001 hexadecimal E1
    For AHT20 binary 1011'1110 hexadecimal BE

    In the AHT20 library for Arduino there is a definition
    sfe_aht20_reg_initialize = 0xBE,
    .
    And in Tasmota
    #ifdef USE_AHT2x
      #define AHTX_CMD     0xB1 // Cmd for AHT2x
      const char ahtTypes[] PROGMEM = "AHT2X|AHT2X";
    #else
      #define AHTX_CMD     0xE1 // Cmd for AHT1x
      const char ahtTypes[] PROGMEM = "AHT1X|AHT1X";
    #endif


    Now I only have the problem how to compile Tasmota with the changed file from AHT20 support Tasmota-.13.2.0



    EDIT
    I managed to compile the distribution with the change and it WORKS!!!!
    I used PlatformIO .
  • #18 20783619
    khoam
    Level 42  
    Congratulations. Interesting that no one has reported this bug so far (I checked).

    For AHT25 the initialisation code is just 0xB1 - AHT20 and AHT25 have different ones, contrary to what the Tasmota developers think.

    Added after 31 [minutes]:

    It remains an open question why the module only with AHT20 was correctly recognised.
  • #19 20783670
    Nargo
    Level 22  
    It's from the brothers from the east that maybe they have "improved" something.
    In any case, after changing only

    #define AHTX_CMD 0xB1 // Cmd for AHT2x


    to

    #define AHTX_CMD 0xBE // Cmd for AHT2x

    All my AHT sensors are detected correctly.

    Thanks for your help.
  • #20 21145553
    grzegorzpilu
    Level 2  
    Hi
    maybe someone will find it useful
    in order for the module to be recognised correctly, all you have to do is add the following
    sensor:
    - platform: aht10
    variant: AHT20
    temperature:

Topic summary

The discussion revolves around issues with reading data from an AHT20+BMP280 sensor module connected to a Wemos2mini using Tasmota firmware. The user reports that while the BMP280 sensor is recognized, the AHT20 sensor is not, despite attempts to modify the firmware to include AHT20 support. Various troubleshooting steps are suggested, including checking I2C addresses, pull-up resistor values, and ensuring proper voltage supply. Ultimately, the user discovers that the initialization command for the AHT20 in Tasmota was incorrect and successfully compiles a modified version of Tasmota that correctly recognizes both sensors.
Summary generated by the language model.
ADVERTISEMENT