Why would multiple SHT31 keep breaking down after a while

Hello, I have built a temperature-humidity-VOC Gas monitoring system with the extra sensors laying around. My problem is that two different SHT31 stopped working after couple of tests. The Adafruit test code stops without giving errors.

The system worked perfectly at first, except the Battery voltage reading part, Arduino couldn't measure battery voltage from the voltage divider, it gave 0.7V for actual 2.5V and gave 1.2V for 3.75V. I was doing some tests like printing the reading value on the screen and trying to figure out what was wrong but then screen was gone completely, it is because code stops working at sht31.begin(0x44) part, when I remove the SHT31 connection, the test code works for sgp30 and OLED display. Am I doing something wrong or is my dealer sending me low quality sensors.

Schematic:

Note: Single BC548 wasn't enough to switch the sensor, I removed it and shorted the collector and emitter. I'll ask about it later in another thread.

Code:

#include <Wire.h>
#include "Adafruit_SGP30.h"
#include "U8glib.h"
#include "Adafruit_SHT31.h"
#include <EEPROM.h>

Adafruit_SGP30 sgp;
Adafruit_SHT31 sht31 = Adafruit_SHT31();
bool HeaterState = false;
int8_t counter = 0;
float t;
float h;
float Vread;
bool SGPenabled = EEPROM.read(0);
/* return absolute humidity [mg/m^3] with approximation formula
* @param temperature [°C]
* @param humidity [%RH]
*/
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);

uint32_t getAbsoluteHumidity(float temperature, float humidity) {
    // approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
    const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
    const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
    return absoluteHumidityScaled;
}

void setup() {
 // Serial.begin(9600);
  preparesecreen();  
  sht31.begin(0x44);
  if (SGPenabled){
    sgp.begin();
    sgp.setIAQBaseline(0x99AF, 0x99AF); // (CO2_base , TVOC_base)
    }      
    attachInterrupt(0, Clap, FALLING);
    sht31.heater(false);   
}

unsigned long t1 = 0; // holds info of rapid claps
unsigned long t2 = 0; // prevents wrong trigger of single clap
unsigned long currenttime;
void Clap(){
  currenttime = millis(); 
  if (currenttime - t2 < 100) {t2 = currenttime; return;}
          
          if (!HeaterState){
           HeaterState = true;
           counter = 80;  
         } else if (HeaterState){
             counter = 0;  
           }
           
      if (currenttime - t1 <= 1000) {
        EEPROM.write(0,!SGPenabled);
       void(* resetFunc) (void) = 0;       
       resetFunc(); 
      } else t1 = currenttime;
    t2 = currenttime;
}

void loop() {
   t = sht31.readTemperature();
   h = sht31.readHumidity();

  if (SGPenabled){ 
  sgp.setHumidity(getAbsoluteHumidity(t, h));
  sgp.IAQmeasure();
  }
  displayMEAS(); delay(500);
  
  while (HeaterState){
    if (sht31.isHeaterEnabled() == 0) sht31.heater(true);
    displayHEAT();
    counter--;
    if (counter<=0) HeaterState = false;
    if (counter<=40) {if (sht31.isHeaterEnabled()) sht31.heater(false);}
    delay(1000);
    } 
}
//bool chargedisplayed = false;
void displayMEAS(){
 // chargedisplayed = false;
  u8g.firstPage();
 do { 
  if (SGPenabled){
  u8g.setFont(u8g_font_6x10);
  u8g.drawStr( 0, 10, "Temp:"); u8g.drawStr( 70, 10, "Hum:");
  u8g.drawStr( 0, 45, "TVOC(ppb):"); u8g.drawStr( 70, 45, "eCO2(ppm):");

  u8g.setFont(u8g_font_7x14B);
  u8g.drawStr( 122, 30, "%"); // Hum 
  
  u8g.setFont(u8g_font_fub14); //u8g_font_tpssb u8g_font_9x18B u8g_font_courB12 u8g_font_fub17
  u8g.setPrintPos(0, 30);
  u8g.print(t); 
  u8g.setPrintPos(70, 30); 
  u8g.print(h);
  
  u8g.setPrintPos(0, 64);
  u8g.print(sgp.TVOC);
  u8g.setPrintPos(70, 64);
  u8g.print(sgp.eCO2);

   u8g.setFont(u8g_font_fub11);
  u8g.drawStr( 52, 30, "C"); // Temp
  
  } else{
    u8g.setFont(u8g_font_fub11);
    u8g.drawStr( 0, 30, "Temp:           *C"); u8g.drawStr( 10, 57, "Hum:            %");
    u8g.setFont(u8g_font_fub14);
    u8g.setPrintPos(52, 30);
    u8g.print(t); 
    u8g.setPrintPos(52, 57); 
    u8g.print(h);
    } 
   // if (!chargedisplayed) {displayCHARGE(); chargedisplayed = true;}
    
  } while( u8g.nextPage() );
  }


void displayHEAT(){
   u8g.firstPage();
 do {
  u8g.setFont(u8g_font_fub11);   
  u8g.drawStr( 15, 15, "Evaporating");  u8g.drawStr( 10, 35, "Condensation");
  u8g.setPrintPos(60, 60);
  if (counter != 0) u8g.print(counter);
  else u8g.drawStr( 15, 60, "CANCELLED!");
  } while( u8g.nextPage() );
  }


void preparesecreen(){
     if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
  }

 // void displayCHARGE(){
  //   Vread = analogRead(A0);
   //  Serial.println(Vread);
   //  if (Vread > 900) return;
   //   u8g.setFont(u8g_font_u8glib_4);
   //    u8g.setPrintPos(103, 4);
   //    u8g.print(Vread);
       
      //if (Vread > 799) u8g.drawStr( 103, 4, "B: ||||");
      //else if (Vread > 758) u8g.drawStr( 103, 4, "B: |||-");
      //else if (Vread > 716) u8g.drawStr( 103, 4, "B: ||--");
     // else if (Vread > 675) u8g.drawStr( 103, 4, "B: |---");  
     // else u8g.drawStr( 103, 4, "B: ----");
            
// }
Note: I removed the "displayCHARGE()" function, because I just want my sensor back, I can live without battery indictor.

I need help on three topics I will ask for two here with the priority order:
1. Why is SHT31 malfunctioning after a while?
2. Why doesn't Arduino read Analog values correctly from A0 pin?

Both, 2.5V and 3.75V are to low to drive the Mini Pro by the RAW pin. You must provide at least 4V there to get the Mini Pro running at 3.3V.

Unfortunately you failed to provide links to the breakout boards you're using, so we have no clue what power requirements they have or what pull-ups the put on the I2C bus. That might be the next problem.

The voltage regulator of the Mini Pro has a maximum current output of 150mA, my guess is your setup is above that.

The breakout board: https://ae01.alicdn.com/kf/HTB1KMkEKh1YBuNjy1zcq6zNcXXaN.jpg

There are two batteries operating between 8.4-5 V

I measured total current consumption of the system before SHT31 died. It was around 80mA (including Arduino itself).

You half that voltage before measuring it, so you give up to 4.2V to the ADC? That might have fried it (given the Pro Mini is running on 3.3V).

I don't see the back side of the board, what's there?

Is your Pro Mini a 3.3V or 5V version?

Where did you measure that? J7?

My pro mini is 5V version. The voltage measurement somehow didn't work btw but I gave up on that I just want my sensor.

I didn't measure from the batteries, I disconnected the battery first then connected Arduino with USB-TTL cable, removed the 5V cable, put an ammeter inbetween.

I'll give you the exact link I bought it from, it's not English but if you only want to see the picture, there you go: SHT31 Sıcaklık ve Nem Sensörü Modülü Sıcaklık, Nem Sensörleri Motorobit - Motorobit.com

In that case your batteries have to provide always at least 7V, otherwise the Arduino won't work correctly if you use the on-board voltage regulator.

That means your setup needs around 80mA after the voltage regulator. You're quite lucky because that value is almost ideal as that's less than the used components draw according to the datasheets.

There is no schematics available but looking at the pictures I would say the circuit is wrong. It connects VDD only to RESET (which should only connected to VDD by a resistor > 2kΩ). I guess that the VDD on RESET leaks just enough current to drive the chip for some time but suddenly fails.

So you tell me to open the SHT31 datasheet, recognise VDD and RESET, break the connection between RESET and VDD, connect them via 2.2k resistor?

I'm working on ADC readings from ATtiny, it's bugging me, I can do this after I am done with the current work. Thanks.

No, I tell you that you bought a faulty board which won't ever work reliably, given the traces on your board are the same as on the linked photos.

You would have to reroute the trace going to RESET to the VDD pin. As the sensor chip is that tiny this is an almost impossible thing to do. So buy a board from a serious supplier that knows how to build correct circuits.

Try the SHT31 library by RobTillaart

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.