Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 13 of 13

Thread: Getting DHT20 Temperature & Humidity Sensor working with Teensy 4.1

  1. #1
    Junior Member
    Join Date
    Sep 2022
    Posts
    6

    Getting DHT20 Temperature & Humidity Sensor working with Teensy 4.1

    I received a Teensy 4.1 today and one of these;
    https://wiki.dfrobot.com/Gravity_I2C...20_SKU_SEN0497

    Just trying to get it to work, but getting an issue.
    I don't have experience with Arduino or Teensy but it looked straight forward enough.
    I can't get their DHT20 library to initialize the sensor, I just get "Initialize sensor failed" from the 'begin' function.
    Are there some changes I need to make to get it working on a Teensy?

    Click image for larger version. 

Name:	0c199b2a14b3a550eef089f6f2fa24c0.jpg 
Views:	6 
Size:	101.5 KB 
ID:	29385
    I wired it up to A4 & A5 on the Teensy and used the DFRobot example code below.

    Library is here;
    https://github.com/DFRobot/DFRobot_DHT20

    begin function from the library is here;
    Code:
    int DFRobot_DHT20::begin() {
      uint8_t readCMD[3]={0x71};
      uint8_t data;
      delay(100);
      _pWire->begin();
      //check if the IIC communication works 
      writeCommand(readCMD,1);
      
      readData(&data, 1);
      //Serial.println(data);
      if((data | 0x8) == 0){
         return 1;
      }
      if(data == 255) return 1;
      return 0;
    }
    Code:
    /*!
     *@file getData.ino
     *@brief Read ambient temperature and relative humidity and print them to serial port.
     *@copyright   Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
     *@licence     The MIT License (MIT)
     *@author [fengli](li.feng@dfrobot.com)
     *@version  V1.0
     *@date  2021-6-24
     *@get from https://www.dfrobot.com
     *@https://github.com/DFRobot/DFRobot_DHT20
    */
    
    #include <DFRobot_DHT20.h>
    /*!
     * @brief Construct the function
     * @param pWire IC bus pointer object and construction device, can both pass or not pass parameters, Wire in default.
     * @param address Chip IIC address, 0x38 in default.
     */
    DFRobot_DHT20 dht20;
    void setup(){
    
      Serial.begin(115200);
      //Initialize sensor
      while(dht20.begin()){
        Serial.println("Initialize sensor failed");
        delay(1000);
      }
    }
    
    void loop(){
      //Get ambient temperature
      Serial.print("temperature:"); Serial.print(dht20.getTemperature());Serial.print("C");
      //Get relative humidity
      Serial.print("  humidity:"); Serial.print(dht20.getHumidity()*100);Serial.println(" %RH");
      
      delay(1000);
    
    }
    Last edited by Pook; 09-16-2022 at 08:02 AM.

  2. #2
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    868
    Code:
    // i2c_scanner
    // http://playground.arduino.cc/Main/I2cScanner
    //
    // Version 1
    //    This program (or code that looks like it)
    //    can be found in many places.
    //    For example on the Arduino.cc forum.
    //    The original author is not know.
    // Version 2, Juni 2012, Using Arduino 1.0.1
    //     Adapted to be as simple as possible by Arduino.cc user Krodal
    // Version 3, Feb 26  2013
    //    V3 by louarnold
    // Version 4, March 3, 2013, Using Arduino 1.0.3
    //    by Arduino.cc user Krodal.
    //    Changes by louarnold removed.
    //    Scanning addresses changed from 0...127 to 1...119,
    //    according to the i2c scanner by Nick Gammon
    //    http://www.gammon.com.au/forum/?id=10896
    // Version 5, March 28, 2013
    //    As version 4, but address scans now to 127.
    //    A sensor seems to use address 120.
    // Version 6, November 27, 2015.
    //    Added waiting for the Leonardo serial communication.
    //
    //
    // This sketch tests the standard 7-bit addresses
    // Devices with higher bit address might not be seen properly.
    //
    
    #include <Wire.h>
    
    // BUGBUG::Should put this in WireIMXRT.h
    #if defined(__IMXRT1062__)
    #define WIRE_IMPLEMENT_WIRE
    #define WIRE_IMPLEMENT_WIRE1
    #define WIRE_IMPLEMENT_WIRE2
    #endif
    typedef struct {
      TwoWire *_wire;
      const char * wire_name;
      IMXRT_LPI2C_t * const port;
    } wire_list_t;
    
    wire_list_t wireList[] = {
      {&Wire, "Wire", &IMXRT_LPI2C1}
    #if defined(WIRE_IMPLEMENT_WIRE1)
      , {&Wire1, "Wire1", &IMXRT_LPI2C3}
    #endif  
    #if defined(WIRE_IMPLEMENT_WIRE2)
      , {&Wire2, "Wire2", &IMXRT_LPI2C4}
    #endif
    #if defined(WIRE_IMPLEMENT_WIRE3)
      , {&Wire3, "Wire3"}
    #endif
    };
    const uint8_t wirelist_count = sizeof(wireList) / sizeof(wireList[0]);
    
    
    void setup() {
      // uncomment these to use alternate pins
      //Wire.setSCL(16);
      //Wire.setSDA(17);
      for (uint8_t wirelist_index = 0; wirelist_index < wirelist_count; wirelist_index++) {
        wireList[wirelist_index]._wire->begin();
      }
      Serial.begin(9600);
      while (!Serial);        // Leonardo: wait for serial monitor
      Serial.println(F("\nI2C Scanner"));
    }
    
    
    void loop() {
      byte error, address;
      int nDevices;
    
      for (uint8_t wirelist_index = 0; wirelist_index < wirelist_count; wirelist_index++) {
        IMXRT_LPI2C_t * const port = wireList[wirelist_index].port;
        Serial.print(F("Scanning("));
        Serial.print(wireList[wirelist_index].wire_name);
        Serial.println(F(")..."));
        nDevices = 0;
        for (address = 1; address < 127; address++) {
          // The i2c_scanner uses the return value of
          // the Write.endTransmisstion to see if
          // a device did acknowledge to the address.
          wireList[wirelist_index]._wire->beginTransmission(address);
          error = wireList[wirelist_index]._wire->endTransmission();
    
          if (error == 0) {
            Serial.print(F("Device found at address 0x"));
            if (address < 16) {
              Serial.print("0");
            }
            Serial.print(address, HEX);
            Serial.print("  (");
            printKnownChips(address);
            Serial.println(")");
    
            nDevices++;
          } else if (error == 4) {
            Serial.print(F("Unknown error at address 0x"));
            if (address < 16) {
              Serial.print("0");
            }
            Serial.print(address, HEX);
            Serial.printf("MCR:%x MSR:%x, MIER:%x MDER:%x MCFGR0:%x MDMR:%x MCCR0:%x\n",
              port->MCR, port->MSR, port->MIER, port->MDER, port->MCFGR0, port->MDMR, port->MCCR0);
          }
        }
        if (nDevices == 0) {
          Serial.println(F("No I2C devices found\n"));
        } else {
          Serial.println(F("done\n"));
        }
      }
      delay(5000);           // wait 5 seconds for next scan
    }
    
    
    void printKnownChips(byte address)
    {
      // Is this list missing part numbers for chips you use?
      // Please suggest additions here:
      // https://github.com/PaulStoffregen/Wire/issues/new
      switch (address) {
        case 0x00: Serial.print(F("AS3935")); break;
        case 0x01: Serial.print(F("AS3935")); break;
        case 0x02: Serial.print(F("AS3935")); break;
        case 0x03: Serial.print(F("AS3935")); break;
        case 0x0A: Serial.print(F("SGTL5000")); break; // MCLK required
        case 0x0B: Serial.print(F("SMBusBattery?")); break;
        case 0x0C: Serial.print(F("AK8963")); break;
        case 0x10: Serial.print(F("CS4272")); break;
        case 0x11: Serial.print(F("Si4713")); break;
        case 0x13: Serial.print(F("VCNL4000,AK4558")); break;
        case 0x18: Serial.print(F("LIS331DLH")); break;
        case 0x19: Serial.print(F("LSM303,LIS331DLH")); break;
        case 0x1A: Serial.print(F("WM8731")); break;
        case 0x1C: Serial.print(F("LIS3MDL")); break;
        case 0x1D: Serial.print(F("LSM303D,LSM9DS0,ADXL345,MMA7455L,LSM9DS1,LIS3DSH")); break;
        case 0x1E: Serial.print(F("LSM303D,HMC5883L,FXOS8700,LIS3DSH")); break;
        case 0x20: Serial.print(F("MCP23017,MCP23008,PCF8574,FXAS21002,SoilMoisture")); break;
        case 0x21: Serial.print(F("MCP23017,MCP23008,PCF8574")); break;
        case 0x22: Serial.print(F("MCP23017,MCP23008,PCF8574")); break;
        case 0x23: Serial.print(F("MCP23017,MCP23008,PCF8574")); break;
        case 0x24: Serial.print(F("MCP23017,MCP23008,PCF8574")); break;
        case 0x25: Serial.print(F("MCP23017,MCP23008,PCF8574")); break;
        case 0x26: Serial.print(F("MCP23017,MCP23008,PCF8574")); break;
        case 0x27: Serial.print(F("MCP23017,MCP23008,PCF8574,LCD16x2,DigoleDisplay")); break;
        case 0x28: Serial.print(F("BNO055,EM7180,CAP1188")); break;
        case 0x29: Serial.print(F("TSL2561,VL6180,TSL2561,TSL2591,BNO055,CAP1188")); break;
        case 0x2A: Serial.print(F("SGTL5000,CAP1188")); break;
        case 0x2B: Serial.print(F("CAP1188")); break;
        case 0x2C: Serial.print(F("MCP44XX ePot")); break;
        case 0x2D: Serial.print(F("MCP44XX ePot")); break;
        case 0x2E: Serial.print(F("MCP44XX ePot")); break;
        case 0x2F: Serial.print(F("MCP44XX ePot")); break;
        case 0x33: Serial.print(F("MAX11614,MAX11615")); break;
        case 0x34: Serial.print(F("MAX11612,MAX11613")); break;
        case 0x35: Serial.print(F("MAX11616,MAX11617")); break;
        case 0x38: Serial.print(F("RA8875,FT6206,MAX98390")); break;
        case 0x39: Serial.print(F("TSL2561, APDS9960")); break;
        case 0x3C: Serial.print(F("SSD1306,DigisparkOLED")); break;
        case 0x3D: Serial.print(F("SSD1306")); break;
        case 0x40: Serial.print(F("PCA9685,Si7021")); break;
        case 0x41: Serial.print(F("STMPE610,PCA9685")); break;
        case 0x42: Serial.print(F("PCA9685")); break;
        case 0x43: Serial.print(F("PCA9685")); break;
        case 0x44: Serial.print(F("PCA9685, SHT3X")); break;
        case 0x45: Serial.print(F("PCA9685, SHT3X")); break;
        case 0x46: Serial.print(F("PCA9685")); break;
        case 0x47: Serial.print(F("PCA9685")); break;
        case 0x48: Serial.print(F("ADS1115,PN532,TMP102,LM75,PCF8591")); break;
        case 0x49: Serial.print(F("ADS1115,TSL2561,PCF8591")); break;
        case 0x4A: Serial.print(F("ADS1115")); break;
        case 0x4B: Serial.print(F("ADS1115,TMP102,BNO080")); break;
        case 0x50: Serial.print(F("EEPROM,FRAM")); break;
        case 0x51: Serial.print(F("EEPROM")); break;
        case 0x52: Serial.print(F("Nunchuk,EEPROM")); break;
        case 0x53: Serial.print(F("ADXL345,EEPROM")); break;
        case 0x54: Serial.print(F("EEPROM")); break;
        case 0x55: Serial.print(F("EEPROM")); break;
        case 0x56: Serial.print(F("EEPROM")); break;
        case 0x57: Serial.print(F("EEPROM")); break;
        case 0x58: Serial.print(F("TPA2016,MAX21100")); break;
        case 0x5A: Serial.print(F("MPR121")); break;
        case 0x60: Serial.print(F("MPL3115,MCP4725,MCP4728,TEA5767,Si5351")); break;
        case 0x61: Serial.print(F("MCP4725,AtlasEzoDO")); break;
        case 0x62: Serial.print(F("LidarLite,MCP4725,AtlasEzoORP")); break;
        case 0x63: Serial.print(F("MCP4725,AtlasEzoPH")); break;
        case 0x64: Serial.print(F("AtlasEzoEC")); break;
        case 0x66: Serial.print(F("AtlasEzoRTD")); break;
        case 0x68: Serial.print(F("DS1307,DS3231,MPU6050,MPU9050,MPU9250,ITG3200,ITG3701,LSM9DS0,L3G4200D")); break;
        case 0x69: Serial.print(F("MPU6050,MPU9050,MPU9250,ITG3701,L3G4200D")); break;
        case 0x6A: Serial.print(F("LSM9DS1")); break;
        case 0x6B: Serial.print(F("LSM9DS0")); break;
        case 0x70: Serial.print(F("HT16K33")); break;
        case 0x71: Serial.print(F("SFE7SEG,HT16K33")); break;
        case 0x72: Serial.print(F("HT16K33")); break;
        case 0x73: Serial.print(F("HT16K33")); break;
        case 0x76: Serial.print(F("MS5607,MS5611,MS5637,BMP280")); break;
        case 0x77: Serial.print(F("BMP085,BMA180,BMP280,MS5611")); break;
        case 0x7C: Serial.print(F("FRAM_ID")); break;
        default: Serial.print(F("unknown chip"));
      }
    }
    I suggest running the I2c_Scanner to see if the board can de identified.
    There are a number of versions of the scanner, you could try the one in the code above.
    EDIT: ...also how are you wiring it?

  3. #3
    Junior Member
    Join Date
    Sep 2022
    Posts
    6
    Hmm, yep not found.

    Code:
    Scanning(Wire)...
    Unknown error at address 0x01MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x02MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x03MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x04MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x05MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x06MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x07MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x08MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x09MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x0AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x0BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x0CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x0DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x0EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x0FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x10MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x11MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x12MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x13MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x14MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x15MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x16MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x17MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x18MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x19MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x1AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x1BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x1CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x1DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x1EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x1FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x20MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x21MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x22MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x23MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x24MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x25MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x26MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x27MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x28MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x29MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x2AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x2BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x2CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x2DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x2EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x2FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x30MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x31MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x32MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x33MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x34MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x35MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x36MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x37MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x38MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x39MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x3AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x3BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x3CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x3DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x3EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x3FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x40MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x41MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x42MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x43MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x44MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x45MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x46MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x47MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x48MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x49MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x4AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x4BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x4CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x4DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x4EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x4FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x50MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x51MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x52MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x53MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x54MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x55MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x56MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x57MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x58MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x59MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x5AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x5BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x5CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x5DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x5EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x5FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x60MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x61MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x62MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x63MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x64MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x65MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x66MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x67MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x68MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x69MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x6AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x6BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x6CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x6DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x6EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x6FMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x70MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x71MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x72MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x73MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x74MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x75MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x76MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x77MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x78MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x79MCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x7AMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x7BMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x7CMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x7DMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    Unknown error at address 0x7EMCR:1 MSR:2000001, MIER:0 MDER:0 MCFGR0:0 MDMR:0 MCCR0:1928373b
    No I2C devices found
    
    Scanning(Wire1)...
    No I2C devices found
    
    Scanning(Wire2)...
    No I2C devices found
    On pins 18 & 19
    Click image for larger version. 

Name:	90c48385-7af3-4ea5-b3a7-588ed4d9f8d5.jpg 
Views:	14 
Size:	249.2 KB 
ID:	29386

  4. #4
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    868
    There is some parallax in the photo making it slightly difficult to see what connection goes to what pin.

    My guess is 5V to supply from Vin, 0V from GND and C from SCL and D from SDA.

    However, there might be a problem with this connection scheme.
    Although the info on the sensor indicates that it will operate at voltages from 3.3V to 5V the schematic shows that the pull up resistors on the DHT20 module are pulled up to supply voltage, 5V in your usage.

    This means that the 5V pull up is being applied to the SDA and SCL pins of the T4.1.
    Unfortunately, the pins of the T4.1 are NOT 5V compatible and it may be that you have "FRIED" these I/O pins.

    The first thing you should so is change the supply voltage to the Module to be 3.3V.
    Try the module with this supply voltage.

    If the SCL/SDA input have been fried it will not MEND them, but it is a step in the right direction.

    Have you any more I2C devices that you can connect to pins 18/19 that may indicate that the device is OK or not?

    If the SDA/SCL pins have been "fried" then it should be possible to use SDA1/SCL2 or SDA2/SCL2.

  5. #5
    Junior Member
    Join Date
    Sep 2022
    Posts
    6
    I switched it to 3.3V and tried the other SDA/SCL sets and they give the same results, "Unknown error".

    I tried an LCD screen I have in the first set and that is detected, so hopefully it isn't fried.

    Code:
    I2C Scanner
    Scanning(Wire)...
    Device found at address 0x27  (MCP23017,MCP23008,PCF8574,LCD16x2,DigoleDisplay)
    done
    
    Scanning(Wire1)...
    No I2C devices found
    
    Scanning(Wire2)...
    No I2C devices found
    Last edited by Pook; 09-16-2022 at 01:00 PM.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,967
    as @BriComp mentioned, the picture is hard to tell if you are on the right pins. It almost looks like they are all off by one pin? But that may simply be because of the angle of the picture.

    But you might want to double check.

    Edit: Also you might want to check to see if there are any Pull up resistors on the board and/or to your breadboard.

    My quick look to their schematic, looked like their PU resistors are not installed (NC)
    So you might try adding some to your breadboard and see if that helps

  7. #7
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    868
    I tried an lcd screen I have in the first set and that is detected, so hopefully it isn't fried.
    That sounds promising.
    Perhaps the pull up resistors are not strong enough or not present.
    Try 4k7 Pull Up Resistors,

    @Kurt I think the alignment is OK, otherwise the display would not have shown up on an I2C_Scan.

  8. #8
    Junior Member
    Join Date
    Sep 2022
    Posts
    6
    I'll have to aim for more profile in my images next time
    But yes, I was in 3.6-5.5 and GND, now I'm in GND and 3.3

    Image from https://wiki.dfrobot.com/Gravity_I2C...20_SKU_SEN0497

    Click image for larger version. 

Name:	ujajhdfjhg983.png 
Views:	7 
Size:	22.5 KB 
ID:	29387

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,967
    The image above shows that the PU resistors are not populated. So you will probably need to install external ones to work

  10. #10
    Junior Member
    Join Date
    Sep 2022
    Posts
    6
    I've been going through a box of dusty electronics crap that I've inherited from somewhere looking for a 4k7. I think I'll just go buy some stuff tomorrow.
    Thanks for the help. It's late for me though, so off to bed.
    Attachment 29388

  11. #11
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    868
    Click image for larger version. 

Name:	DPT10.jpg 
Views:	6 
Size:	48.8 KB 
ID:	29389Difficult to see if they are empty pads or pull up resistors.
    That other solder joint does not look very good. Worth checking the other side of the board,

  12. #12
    Junior Member
    Join Date
    Sep 2022
    Posts
    6
    You're right, thats not the best solder job :/
    Click image for larger version. 

Name:	frntPNG.jpg 
Views:	6 
Size:	41.7 KB 
ID:	29390
    Click image for larger version. 

Name:	bakPNG.PNG 
Views:	3 
Size:	773.9 KB 
ID:	29391

  13. #13
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,967
    Zoomed in, I don't see anything between those two solder blobs...

    If I did not find any reasonable resistors to try, could even be like 10K...
    I might try hooking up the display as well, as it probably has ones on it. They may not be strong enough, but maybe will work at, least to see if anything is working

    Edit: And if you have some form of multi-meter you might simply check the resistance on the board between the VCC and the SCL and SDA...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •