Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
M16 SHT31 sensor disconnected
#1
Bug 
I've identified an issue with my M16 board whereby the SH31 sensor becomes disconnected after the setup() function and can no longer be read.  I've tried a number of variations on the bus settings, but there seems to be no effect.  The relevant setup() code is this:

PHP Code:
    Wire.begin(45);
//    Wire.setClock(100000);
    
Wire.setClock(10000);
    
Wire.setTimeOut(1000);
    
sht.begin();
    
sht.read();
    
temperature sht.getFahrenheit();
    
humidity sht.getHumidity();
    
int error sht.getError();
    if (
error != 0) {
        
uint16_t stat sht.readStatus();
        
ESP_LOGW("kincony""Temperature sensor Error status: 0x%04x, read status: 0x%04x",
                
errorstat);
        
logSHT31BitStatus(stat);
    } 

This works, however, once inside the loop(), attempts to read the SHT31 fail as disconnected and cannot be reset, even using the HARD option.

PHP Code:
        if (sht.isConnected()) {
            
sht.read();
            
temperature sht.getFahrenheit();
            
humidity sht.getHumidity();

            
int error sht.getError();
            if (
error != 0) {
                
uint16_t stat sht.readStatus();
                
ESP_LOGW("kincony""Temperature sensor Error status: 0x%04x, read status: 0x%04x",
                        
errorstat);
                
logSHT31BitStatus(stat);
            }
        } else {
            
int error sht.getError();
            
ESP_LOGE("kincony""Temperature sensor connection failure, HARD resetting...");
            
ESP_LOGW("kincony""Temperature sensor Error status: 0x%04x"error);
            
sht.reset(true);
        } 

Could this be a conflict with the U8G2?

Full code is available via Github: https://github.com/LouPaloma/KinconyM16-...ter/Source
Reply


Messages In This Thread
M16 SHT31 sensor disconnected - by bsarra - 12-12-2024, 09:16 PM
RE: M16 SHT31 sensor disconnected - by admin - 12-13-2024, 01:18 AM
RE: M16 SHT31 sensor disconnected - by bsarra - 12-13-2024, 03:53 PM
RE: M16 SHT31 sensor disconnected - by admin - 12-14-2024, 01:21 AM
RE: M16 SHT31 sensor disconnected - by bsarra - 12-16-2024, 08:36 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)