As the title suggests, I am working with a NodeMCU 12E ESP8266 microcontroller along with an Adafruit BME688 breakout board using the BME68X API Library. Everything appears to work just fine at first with this setup except over time I have some serious data dropouts (missing heater profile steps) that I cannot seem to find a solution for. It appears to me that over the span of a few hours with the setup running the timing between heater profile steps appears to become out of sync and measurements are lost as a result. I'm using the parallel_mode.ino sketch from the BME68X API Library untouched and I've tried using three different ESP8266 boards, two of which were brand new. I also tried changing the communication protocol from SPI to I2C in the example code, which the sensor could be read, but immediately I saw the same dropouts as with the SPI implementation. I've also tried using BSEC2 on another board just to see if the same thing could be observed, but it appears not to be the case. With the BSEC2 implementation everything works perfectly, however, this is not the implementation I'd like to use for my project. I simply want to use the API and get gas resistance along with TPH. I don't need any of the other overhead associated with BSEC2. Now at the time of writing this post I have setup two boards side-by-side. One with BSEC2 and one without BSEC in order to test and compare their outputs. Still I see these dropouts on the non-BSEC board using the default code, so I've modified the heater profile to use HP 413 just to see what would happen. Still it's missing data! I also modified the example sketch again after seeing these dropouts so that I could write the data to an SD card over SPI, I will add the code for that below. Even with writing to the SD Card instead of the Serial monitor I saw these dropouts. Here is how I modified the heater profile: /* Heater temperature in degree Celsius */ /*Default Profile 354: 320, 100, 100, 100, 200, 200, 200, 320, 320, 320*/ uint16_t tempProf[10] = { 70, 350, 163, 350, 256, 256, 256, 350, 350, 350 }; /* Multiplier for the heater profile duration steps */ /* * Default shared heater profile multiplier for 354: 5, 2, 10, 30, 5, 5, 5, 5, 5, 5 * ex: * (MEAS_DUR / 1000) x mulProf[0] = .7s * (MEAS_DUR / 1000) x mulProf[1] = .98s * (MEAS_DUR / 1000) x mulProf[2] = 2.38s * * HP 413: * uint16_t mulProf[10] = { 43, 2, 43, 2, 2, 20, 21, 2, 20, 21 }; */ uint16_t mulProf[10] = { 43, 2, 43, 2, 2, 20, 21, 2, 20, 21 }; ^^ This was all I changed in the API code originally after noticing dropouts with HP354 (default profile) ^^ Here are the modifications I made to the main loop so that data is written to an SD Card. I've also modified the logic a bit to use millis() for the delay between measurments instead of the delay(MEAS_DUR). I made this millis() change on the default code prior to the SD Card being implemented and still saw data dropouts, and again after implementing the SD card, so it appears this problem persists no matter what I do. void loop(void) { bme68xData data; uint8_t nFieldsLeft = 0; BmeTestDataFile2Write = SD.open(bmeFilename, FILE_WRITE); if (BMEheader) { // Create a CSV header for BME688 test data BmeTestDataFile2Write.println("HP413_BME68x_API"); BmeTestDataFile2Write.println("Time,Temp,P,RH,R0,R1,R2,R3,R4,R5,R6,R7,R8,R9,status"); BMEheader = false; } if ((millis() - lastLogged) >= MEAS_DUR) { lastLogged = millis(); if (bme.fetchData()) { do { nFieldsLeft = bme.getData(data); if (data.status == NEW_GAS_MEAS) { /* Serial.print("HP_Step = "); Serial.println(data.gas_index); */ // Print time, temp, pressure,- and humidity to file on heater profile step index 0 if (data.gas_index == 0) { BmeTestDataFile2Write.print(String(rtc.now().unixtime()) + "," + String(data.temperature) + "," + String(data.pressure) + "," + String(data.humidity) + ","); } // Print gas resistance to file BmeTestDataFile2Write.print(String(data.gas_resistance) + ","); //Serial.print(String(data.gas_index) + ","); // on step index 9, print sensor status to file if (data.gas_index == 9) { BmeTestDataFile2Write.println(String(data.status, HEX)); //Serial.println(); } } } while (nFieldsLeft); BmeTestDataFile2Write.close(); } } } Here are a few snippets of my data so you can see what I'm talking about. This is what the beginning of my data looks like: All looks good to begin with.... But then after a few hours of running I start to see this: It appears I either lose Heater profile step 0, or I lose multiple steps, but never a whole scan cycle. I'm really not sure why this is happening unless this MCU is not recommended for use with this library (but it compiled just fine) and there are plenty of guides which suggest this MCU works with both the BME680 and 688. So just to recap: The default parallel_mode.ino code on an ESP8266 with a BME688 configured in SPI experiences dropouts in heater profile steps during scan measurments overtime. Changing the code/sensor to use i2c, experiences the same issue, but worse, and the same behavior is observed in every other change made to the code/hardware. Has anyone else seen anything like this before? Any help would be greatly appreciated! Note: I can share the setup() code that adds the SD Card if need-be, but as I had mentioned I see these dropouts regardless if there are other peripherals attached to the ESP8266 or not.
... View more