I had a Eve Room device to monitor room environment data, unfortunately the device does not work anymore, probably the bluetooth unit is defective.
I use the newer Bosch BME680 sensor and a Adafruit Feather ESP32 board for replacement.
Wiring
The unit is battery powered, so the power consumption is important. I use rechargeable AAA. With the ESP32 we can use the deep sleep mode (hibernation state) to minimize the current consumption between measurement cycles. Additionally, I use a simple 2N7000 MOSFET to switch off/on the power for the sensor breakout board, if needed. I want to have measuring data each 10 minutes to prevent history holes, so the sleep/wakeup cycle is set to this.
Then the ESP32 comes up, setting the PIN (i use A1 as trigger PIN) high, the sensor will be powered, after measuring we can switch the power completely off by setting the PIN to low. The ESP32 itself, can be controlled by the ESP deep sleep mode - the hibernation state is the best to maximize the remaining battery capacity.
(Note: The sensor use I2C for communication. While scripting and testing, sometimes the I2C address seems to changing from 0x76 to 0x77. In the script is a function for sure to test and find the "actual" working address before init the sensor)
Configuration
Unfortunately, the information about the working principles of the BME680 sensor itself are very rare and not self explaining. I seems to me, the measured values (temperature, humidity, pressure, AirQuality etc) are based on average values of measurements and will be stored. With each measurement cycle the the values are refined. I read, the sensor must run over days to have reasonably correct values.
The driver library and deep sleep
Interesting fact, the measured values are differ in relation of which driver i use. I decided to use the original BSEC driver or API.
The provided BSEC API shows different examples. As far as I understand, there are two methods - LP mode: measurements every 3s, and ULP mode: measurements every 300s. The results are stored in the EEPROM or in the case of Deep Sleep in the RTC memory. Running over longer time, the measured and stored values used to calculation the Air Quality index. Deep Sleep and 300s would be fine for my application (although longer sleep times would be better). But i can't managed the code to work stable over longer time. Some mystical ESP core crashes or driver failure with 03. So I let the Air Quality calculation go, use only the raw values and calculate the Air Quality Index by my self.
Raw value measurement
I made a series of tests, with the result, that the temperature is too high by 2.37 degrees celsius. This might due to the heating of the CPU ( measured with 53,33 celsius) and the sensor heating plate. I found scripts to recalculating the temperature while measuring, but to save power, I manually determined the difference value and set 2.37 as default. This means, it does not have to be determined again for each measurement cycles. The humidity values seems to be ok. The determination of the ppm value and the resulting Air Quality Index was a bit more complicated.
Normally, Air Quality based on PPM or PPB. Ppm can be related to mass or volume, there are any graph of Ai rQuality with different interpretations, somebody tells that ppm, other ppb, microgram per cubic meters, microgram per mol, etc.
The sensor description itself has no disclosed information about the Air Quality calculation. Known is the "gasResistance" range, which can be between 5 and 50 kOhm according to the specification. The sensor needed a "burn in" cycle, i read it's a good idea to let the sensor running 2 days in minimum, to get stable values. doing this, the gasResistance values varies between 1 kOhm and 5 kOhm in my case.
A good description, of how to proceed the ppm calculation in principle, can be found here, even though this is a completely different sensor. I follow this basic idea. For calculation, I found a linear Y-Intercept value of 1,0240916 for the BME680 gas concentration. To reproduce the original behavior, i made long test cycles and find 5 kOhm with the slope of - 0.436 are the best values.
I read, that humidity also has an influence on the ppm value. However, a few tests showed me that the influence can be neglected in my case.
The values are sent in JSON format to the HAP Python gateway and from there to the app. To get the history data I used my Python transcoded script.
The result is as expected:
Testing and running
In the script i defined a variable "Test". Set to True, you will see all returning information along the terminal. Setting to False, Serial messages will be surpressed.
Comments