Browse Source

configure sensors

ir
Hendrik Langer 5 years ago
parent
commit
c3476f7a49
  1. 15
      src/main.cpp

15
src/main.cpp

@ -259,21 +259,27 @@ void setup()
} }
if (bme680.begin()) { if (bme680.begin()) {
bme680_active = true; bme680_active = true;
} else {
ESP_LOGE(TAG, "Could not find a valid BME680 sensor, check wiring!");
}
if (bme680_active) {
// Set up oversampling and filter initialization // Set up oversampling and filter initialization
bme680.setTemperatureOversampling(BME680_OS_8X); bme680.setTemperatureOversampling(BME680_OS_8X);
bme680.setHumidityOversampling(BME680_OS_2X); bme680.setHumidityOversampling(BME680_OS_2X);
bme680.setPressureOversampling(BME680_OS_4X); bme680.setPressureOversampling(BME680_OS_4X);
bme680.setIIRFilterSize(BME680_FILTER_SIZE_3); bme680.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme680.setGasHeater(320, 150); // 320*C for 150 ms bme680.setGasHeater(320, 150); // 320*C for 150 ms
} else {
ESP_LOGE(TAG, "Could not find a valid BME680 sensor, check wiring!");
} }
if (uv.begin()) { if (uv.begin()) {
uv_active = true; uv_active = true;
uv.setIntegrationTime(VEML6075_100MS); // Set the integration constant
uv.setHighDynamic(true); // Set the high dynamic mode
uv.setForcedMode(false);
// Set the calibration coefficients
uv.setCoefficients(2.22, 1.33, // UVA_A and UVA_B coefficients
2.95, 1.74, // UVB_C and UVB_D coefficients
0.001461, 0.002591); // UVA and UVB responses
} else { } else {
Serial.println("Failed to communicate with VEML6075 sensor, check wiring?"); Serial.println("Failed to communicate with VEML6075 sensor, check wiring?");
} }
@ -283,6 +289,7 @@ void setup()
FirmwareVersionResult sds_fw = sds.queryFirmwareVersion(); FirmwareVersionResult sds_fw = sds.queryFirmwareVersion();
if (sds_fw.isOk()) { if (sds_fw.isOk()) {
sds_active = true; sds_active = true;
sds.setActiveReportingMode(); // ensures sensor is in 'active' reporting mode sds.setActiveReportingMode(); // ensures sensor is in 'active' reporting mode
sds.setCustomWorkingPeriod(5); // sensor sends data every 3 minutes sds.setCustomWorkingPeriod(5); // sensor sends data every 3 minutes
} else { } else {

Loading…
Cancel
Save