LaCrosseGateway und BME680

Begonnen von HCS, 17 Oktober 2017, 21:48:38

Vorheriges Thema - Nächstes Thema

hdgucken

Zitat von: PeMue am 30 Oktober 2017, 10:27:12
Nein, es waren schon zwei. Und >10 BME280  ;D ;D ;D
Respekt !!! Wie machst Du das, ich hab mal ein paar SMD Platinen mit nem
Gaslötkolben (mit ca. 3mm Luftdüse) gelötet, ging ziemlich gut, könnte mir aber
vorstellen, das der BMEx80 dafür zu empfindlich ist.

PeMue

Zitat von: hdgucken am 31 Oktober 2017, 00:27:04
Respekt !!! Wie machst Du das ...
Ich dispense mit einer feinen Nadel unter dem Mikroskop (vorher Kaffeeentzug!) und dann geht es in den (geregelten) Pizzaofen  ;)

Gruß PeMue
RPi3Bv1.2 rpiaddon 1.66 6.0 1xHM-CC-RT-DN 1.4 1xHM-TC-IT-WM 1.1 2xHB-UW-Sen-THPL-O 0.15 1x-I 0.14OTAU  1xCUNO2 1.67 2xEM1000WZ 2xUniroll 1xASH2200 3xHMS100T(F) 1xRFXtrx 90 1xWT440H 3xTFA30.3150 5xFA21
RPi1Bv2 LCDCSM 1.63 5.8 2xMAX HKT 1xMAX RT V200KW1 Heizung Wasser

hdgucken

Nicht schlecht, stimmt, Lötpaste auftragen mit der Spritze war schon nicht ohne, Kaffee vorher geht gar nicht  ;)
Die Umbauanleitung von dem Pizzaofen hatte ich vor einiger Zeit auch mal intensiver studiert,
vielleicht sollte ich das auch mal in Angriff nehmen, SMD ist im Vormarsch  :)

Gruß Thomas

HCS

@PeMue: Kommt bei der "HCS-FW" für Dich eine IAQ raus, die dem entspricht, was Du erwarten würdest?
Falls ja, dann würde ich die BSEC-Routinen mitsamt der geheimen precompiled lib mal in das LGW einbauen, dass wir ohne shell scripte usw. vernünftige charts bekommen.

Einige Punkte sind noch offen, aber die kann ich dann später ergänzen z.B.
Man müsste die Baseline, die die BSEC ermittelt hat, regelmäßig speichern (persistent im EEPROM oder so) und beim nächsten Start wieder setzen, sonst beginnen die "vier Tage" nach einem Neustart wieder von vorne

SusisStrolch

@HCS - bist Du schon dazu gekommen dieses LGW + BME680 Testimage zu bauen?
Würde mich mit Daten vom Kaminzimmer beteiligen....
Synology DS1515+, 16GB RAM, 4x 6TB WD-Red
- Docker (FHEM), MariaDB, MariaDB10, Surveillance Station
Gateways: LCG miniCUL433, LCG miniCUL868, AVR-X4000, VU-Solo SE, Kodi
ESP8266: ESPEasy (S0-Counter, Temp/Hum), Sonoff TH, Sonoff 4ch

PeMue

Hallo HCS,

Zitat von: HCS am 14 November 2017, 12:24:40
@PeMue: Kommt bei der "HCS-FW" für Dich eine IAQ raus, die dem entspricht, was Du erwarten würdest?
Falls ja, dann würde ich die BSEC-Routinen mitsamt der geheimen precompiled lib mal in das LGW einbauen, dass wir ohne shell scripte usw. vernünftige charts bekommen.
nach Dienstreise komme ich endlich mal wieder dazu, an einem vernünftigen Rechner zu antworten.
Ich bin mir noch nicht sicher, was der IAQ Wert eigentlich so wirklich bedeutet. Ich habe auch den Eindruck, dass dieser sich in einem Raum mit keinerlei Luftaustausch verbessert, was ich physikalisch absolut nicht nachvollziehen kann. Aber ich meine, momentan kriegen wir einfach nicht mehr aus dem Sensor raus, ohne viel Entwicklungsaufwand reinzustecken. Ich hätte gedacht, das das Ganze deutlich transparenter ist  :o
Wenn es für Dich ein vertretbarer Aufwand ist, dann bitte gerne. Dann kann ich mein nanoLGW (BME680) im Wohnzimmer auch mit dem LGW (BME280) bezüglich Temperatur, Druck und relativer Luftfeuchte auch mal vergleichen. Was packst Du dann in die Übertragung zusätzlich mit rein?
Gas: 343435 IAQ: 70 HT: 320 HD: 197 AC: 3? Oder die letzten drei nur per Debug?

Danke + Gruß

PeMue
RPi3Bv1.2 rpiaddon 1.66 6.0 1xHM-CC-RT-DN 1.4 1xHM-TC-IT-WM 1.1 2xHB-UW-Sen-THPL-O 0.15 1x-I 0.14OTAU  1xCUNO2 1.67 2xEM1000WZ 2xUniroll 1xASH2200 3xHMS100T(F) 1xRFXtrx 90 1xWT440H 3xTFA30.3150 5xFA21
RPi1Bv2 LCDCSM 1.63 5.8 2xMAX HKT 1xMAX RT V200KW1 Heizung Wasser

HCS

Zitat von: SusisStrolch am 18 November 2017, 11:25:01
@HCS - bist Du schon dazu gekommen dieses LGW + BME680 Testimage zu bauen?
Ich arbeite noch dran. Wird wohl so Ende nächster Woche werden (alle Angaben wie immer ohne Gewähr  :) )

Zitat von: PeMue am 18 November 2017, 17:56:32
Ich bin mir noch nicht sicher, was der IAQ Wert eigentlich so wirklich bedeutet.
Ich mir auch nicht. Dass Bosch nicht verrät, was sie da eigentlich zusammenrechnen ist schon seltsam.

Zitat von: PeMue am 18 November 2017, 17:56:32
Wenn es für Dich ein vertretbarer Aufwand ist, dann bitte gerne.
Naja, ist mehr als ich dachte, drum ist es auch noch nicht fertig  :(
Aber ich ziehe es jetzt durch.

Ich werde die Daten so wie bei einem BME280 an FHEM schicken, es entsteht also ein LaCrosse-Device mit Temperatur, Feuchte und Luftdruck und beim BME680 dann zusätzlich einem gas-Reading. Ich habe es von IAQ zu einem allgemeineren "gas" zurückgerudert, falls wir irgendwann beschließen, nicht die Bosch IAQ zu nehmen und etwas selbst berechnen.
Das LaCrosseGateway-device hat die Readings (je nach Einstellung vom Attribut "ownSensors") auch und zusätzlich noch ein reading mit dem rohen Widerstand des Sensors. Damit kann man dann weiterhin Vergleiche anstellen und eventuell zu einer eigenen Berechnung kommen.

trebron106

Hi HCS,

ich habe im Internet folgendes Beispiel für die Berechnung des IAQ gefunden ,

Zitat

Using the BME680 to measure temperature, pressure, humidity and air quality.
The sensor is used to get so-called Gas Resistance and then an Air Quality Index (IAQ) is determined from a combination
of the readings of humidity and gas content of the air.
The index comprises up to 25% for the humidity contribution and 75% for the gas contribution.
Very low or high humidity is considered to result in an uncomfortable environment,
with 40% being optimal. Therefore the humidity contribution to the IAQ is derived from a value that is 0 when RH is 0 and
rises to 25% at 40% RH, above 40% RH the value falls to 0 at 100% RH, so in summary the RH quality scores peaks at 40% RH and
falls to 0 either side of that value, with the final value scaled between 0 and 25%.
For Gas it has been assumed that normal breathable air with no pollutants (adverse gases) corresponds to the sensors
highest output of 300,000 ohms. The sensor outputs a Gas resistance value ranging from a low of 50,000 to a high of 500,000 and beyond.
A linear relationship is assumed and the output scaled accordingly between 0 and 75%.
The result of humidity and gas indexes is a qualitative and a so-called IAQ - Indoor Air Quality index value scaled
from 0-100% (where 100% is good). This is then scaled to 0-500 where a 500 value is bad and
descriptive values applied in stages from good to hazardous air quality.
There is no definitive (ISO Standard method for calculating an IAQ.
(c) d.l.bird 2017 all rights reserved and as per the MIT licence agreements listed in all my software.




float hum_weighting = 0.25; // so hum effect is 25% of the total air quality score
float gas_weighting = 0.75;  // so gas effect is 75% of the total air quality score
float hum_score, gas_score;
float gas_reference = 250000; 
float hum_reference = 40;
int   getgasreference_count = 0;

// The MIT License (MIT) Copyright (c) 2017 by David Bird.
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
// (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, but not to use it commercially for profit making or to sub-license and/or to sell copies of the Software or to
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
//   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
//   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
//   LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
//   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// See more at http://dsbird.org.uk
 
  //Calculate humidity contribution to IAQ index
  float current_humidity = bme.readHumidity();
  if (current_humidity >= 38 && current_humidity <= 42)
    hum_score = 0.25*100; // Humidity +/-5% around optimum
  else
  { //sub-optimal
    if (current_humidity < 38)
      hum_score = 0.25/hum_reference*current_humidity*100;
    else
    {
      hum_score = ((-0.25/(100-hum_reference)*current_humidity)+0.416666)*100;
    }
  }
 
  //Calculate gas contribution to IAQ index
  int gas_lower_limit = 50000;   // Bad air quality limit
  int gas_upper_limit = 500000;  // Good air quality limit
  gas_score = (0.75/(gas_upper_limit-gas_lower_limit)*gas_reference -(gas_lower_limit*(0.75/(gas_upper_limit-gas_lower_limit))))*100;
 
  //Combine results for the final IAQ index value (0-100% where 100% is good quality air)
  float air_quality_score = hum_score + gas_score;

  Serial.println("Air Quality = "+String(air_quality_score,1)+"% derived from 25% of Humidity reading and 75% of Gas reading - 100% is good quality air");
  Serial.println("Humidity element was : "+String(hum_score/100)+" of 0.25");
  Serial.println("     Gas element was : "+String(gas_score/100)+" of 0.75");
  if (bme.readGas() < 120000) Serial.println("***** Poor air quality *****");
  Serial.println();
  if ((getgasreference_count++)%10==0) GetGasReference();
  Serial.println(CalculateIAQ(air_quality_score));
  Serial.println("-------------------------------------------------------");
  delay(15000);
}

void GetGasReference(){
  // Now run the sensor for a burn-in period, then use combination of relative humidity and gas resistance to estimate indoor air quality as a percentage.
//  Serial.println("\nGetting a new gas reference value");
  int readings = 10;
  for (int i = 0; i <= readings; i++){ // read gas for 10 x 0.150mS = 1.5secs
    gas_reference += bme.readGas();
  }
  gas_reference = gas_reference / readings;
Serial.println("\nGetting a new gas reference value -> "+String(gas_reference)+" <--");
}

String CalculateIAQ(float score){
  String IAQ_text = "Air quality is ";
  score = (100-score)*5;
  if      (score >= 301)                  IAQ_text += "Hazardous";
  else if (score >= 201 && score <= 300 ) IAQ_text += "Very Unhealthy";
  else if (score >= 176 && score <= 200 ) IAQ_text += "Unhealthy";
  else if (score >= 151 && score <= 175 ) IAQ_text += "Unhealthy for Sensitive Groups";
  else if (score >=  51 && score <= 150 ) IAQ_text += "Moderate";
  else if (score >=  00 && score <=  50 ) IAQ_text += "Good";
  return IAQ_text;
}



https://github.com/G6EJD/BME680-Example


Gruß
Klaus

HCS

Zitat von: trebron106 am 19 November 2017, 14:53:23For Gas it has been assumed that normal breathable air with no pollutants (adverse gases) corresponds to the sensors highest output of 300,000 ohms. The sensor outputs a Gas resistance value ranging from a low of 50,000 to a high of 500,000 and beyond.
Die Widerstandswerte kann ich nicht nachvollziehen.
Meine beiden BME680 (die nebeneinander stehen) liegen je nach Luftqualität zwischen:
BME680 #1: 3000 ... 5000 Ohm
BME680 #2: 4500 ... 8000 Ohm
mit einer von Bosch gerechneten IAQ von 250 ... 25.
Das zeigt schon mal, dass die Sensoren von ihrer Baseline sehr unterschiedlich sind.
Und es würde bedeuten, dass bei meinen Sensoren "normal breathable air with no pollutants" eher bei 10000 Ohm liegt.

Ich lasse das LGW jetzt erst mal die von Bosch gerechnete IAQ liefern, die ist das "offiziellste" was wir momentan haben.

SusisStrolch

Hallo @HCS, ich verwende dein Test-Binary vom 7.11.
Das liefert mir jedoch Gas-Werte im Bereich 10⁵ - 10⁶ zurück (läuft allerdings erst seit 2 Tagen).
Wie kommst Du denn auf die 3000-5000 Ohm?
Verwendest Du da einen Korrekturfaktor? (Ich konnte dazu in den Datenblättern nichts finden).

@trebron106: Bzgl VOC sagt das Datenblatt folgendes aus:
Zitat
As a raw signal, BME680 will output resistance values and its changes due to varying VOC concentrations (the higher the concentration of reducing VOCs, the lower the resistance and vice versa). Since this raw signal is influenced by parameters other than VOC concentration (e.g. humidity level), the raw values are transformed to an indoor air quality (IAQ) index by smart algorithms inside BSEC.
Und das steht doch (für den BME Sensor) im Widerspruch zu
Zitat
For Gas it has been assumed that normal breathable air with no pollutants (adverse gases) corresponds to the sensors highest output of 300,000 ohms. The sensor outputs a Gas resistance value ranging from a low of 50,000 to a high of 500,000 and beyond.
Oder übersehe ich da etwas?
Synology DS1515+, 16GB RAM, 4x 6TB WD-Red
- Docker (FHEM), MariaDB, MariaDB10, Surveillance Station
Gateways: LCG miniCUL433, LCG miniCUL868, AVR-X4000, VU-Solo SE, Kodi
ESP8266: ESPEasy (S0-Counter, Temp/Hum), Sonoff TH, Sonoff 4ch

HCS

Zitat von: SusisStrolch am 20 November 2017, 11:05:52
Hallo @HCS, ich verwende dein Test-Binary vom 7.11.
Das liefert mir jedoch Gas-Werte im Bereich 10⁵ - 10⁶ zurück (läuft allerdings erst seit 2 Tagen).
Wie kommst Du denn auf die 3000-5000 Ohm?
Verwendest Du da einen Korrekturfaktor? (Ich konnte dazu in den Datenblättern nichts finden).
Genau das Test-Binary verwendei ich auch und ich korrigiere keine Werte.
Ich liefere genau das, was die Bosch-Routinen berechnen.
Beispielzeile aus dem Log:
2017-11-08_16:29:19 TS: 151200 T: 19.9 H: 59.6 P: 1020.8 Gas: 5930 IAQ: 27 HT: 320 HD: 197 AC: 3

Der absulute Widerstandswert hat meiner Beobachtung nach nicht viel zu sagen.

2017-11-07_00:05:14 TS: 5760  T: 19.9 H: 56.5 P: 1025.7 Gas: 3852 IAQ: 30 HT: 320 HD: 197 AC: 3
2017-11-20_10:56:05 TS: 98340 T: 19.3 H: 53.4 P: 1024.1 Gas: 8083 IAQ: 30 HT: 320 HD: 197 AC: 3


Man sieht: am 07.11.2017 hat die Bosch-Routine bei 3852 Ohm eine IAQ von 30 berechnet und am 20.11.2017 hat sie die gleiche IAQ bei 8083 Ohm berechnet.
Und das bei kaum unterschiedlicher Temperatur und Luftfeuchtigkeit.

Ich glaube, dass es so funktioniert: der höchste Widerstandswert, der im Lauf der Zeit gesehen wurde, wird als "saubere Luft" mit ca. 400ppm eCO2 und 0 VOC betrachtet und alles drunter dann entsprechend dieser basline hingerechnet. Das ist wohl auch der Grund, warum Bosch meint, dass es mehrere Tage dauert, bis ein vernünftiges Ergebnis dargestellt wird und man die basline speichern und bei einem Sensor-Neustart wieder setzen soll, weil sonst das Spiel wieder von vorne beginnt.
Und je weniger der Sensor gelaufen ("eingebrannt") ist, um so mehr driftet er durch die Gegend.

Zitat von: SusisStrolch am 20 November 2017, 11:05:52
... im Widerspruch ...
Die Grundaussage stimmt schon, je geringer der Widerstand umso schlechter ist die Luft.

hdgucken

Zitat von: HCS am 19 November 2017, 08:33:46
Ich arbeite noch dran. Wird wohl so Ende nächster Woche werden (alle Angaben wie immer ohne Gewähr  :) ) ...

@HCS, PeMue, SusisStrolch: Hab eben erst wieder mal in diesem Thread vorbei geschaut. Hab da auch was fertig,
                                         schaut mal hier: https://forum.fhem.de/index.php/topic,78619.msg719003.html#msg719003  ;)

War wirklich ne Menge Arbeit, aber das Ergebnis ist doch nicht schlecht ...

Gruß Thomas

HCS

#27
So, hier eine Beta vom LaCrosseGateway V1.31, die den BME680 unterstützt.
Die IAQ wird von den Bosch-Routinen berechnet.
Der BME680 muss die Adresse 0x76 haben und wird wie ein BME280 angeschlossen.
Es geht nur BME680 oder BME280, nicht beide gleichzeitig
Im WebIF wird der BME680 mit seinen aktuellen Werten angezeigt
36_LaCrosse.pm und 36_LaCrosseGateway.pm müssen auf dem aktuellen Stand sein

LaCrosse-Device in FHEM:
- Reading "gas" ist die vom den Bosch-Routinen berechnete IAQ
- Reading "debug" ist der vom Senosor gelieferte Widerstand
- Temperatur, Feuchte und Druck ist ganz normal, wie bei einem BME280

Anhang entfernt, es gibt eine neuere Version hier: https://forum.fhem.de/index.php/topic,78128.msg725370.html#msg725370

PeMue

Zitat von: HCS am 28 November 2017, 20:58:36
So, hier eine Beta vom LaCrosseGateway V1.31, die den BME680 unterstützt.
Das bekomme ich heute nicht mehr installiert, werde es aber testen.

Danke + Gruß Peter
RPi3Bv1.2 rpiaddon 1.66 6.0 1xHM-CC-RT-DN 1.4 1xHM-TC-IT-WM 1.1 2xHB-UW-Sen-THPL-O 0.15 1x-I 0.14OTAU  1xCUNO2 1.67 2xEM1000WZ 2xUniroll 1xASH2200 3xHMS100T(F) 1xRFXtrx 90 1xWT440H 3xTFA30.3150 5xFA21
RPi1Bv2 LCDCSM 1.63 5.8 2xMAX HKT 1xMAX RT V200KW1 Heizung Wasser

SusisStrolch

Uiuiuiui...
Komme auch erst morgen zum flashen.
Hmm, ob es da vielleicht auch ein Setting für die Heatplate (temp& duration) geben könnte?
Synology DS1515+, 16GB RAM, 4x 6TB WD-Red
- Docker (FHEM), MariaDB, MariaDB10, Surveillance Station
Gateways: LCG miniCUL433, LCG miniCUL868, AVR-X4000, VU-Solo SE, Kodi
ESP8266: ESPEasy (S0-Counter, Temp/Hum), Sonoff TH, Sonoff 4ch