Funksensor mit Bosch sensortec BME680 / Luftgüte

Begonnen von juergs, 28 Oktober 2017, 18:05:43

Vorheriges Thema - Nächstes Thema

juergs

#300
Zitat von: hdgucken am 14 Januar 2018, 20:45:51
Hi,

hab eben nochmal schnell ins Datenblatt und die RFMxx Lib geschaut, steht alles auf "max. Power".
Auszug aus dem Datenblatt: "Pout = -18 + OutputPower [dBm] , with PA0"
PA0 Output Power mit allen Bits auf 1 (5 Bits), ergibt max. Power.
Alles ok eigentlich.

Gruß Thomas

Ja ich hab's auch in der Referenzimplementierung gesehen, aber:

Quer durch die Wohnung, auf dem Balkon (3 Stahlbeton-Wände. Habe es (_10110, mach noch eine Meßreihe!) nur mal zufällig versucht einen anderen Wert zu nehmen...:


Man sieht auch: es gibt noch wesentlich Stärkere ...

hdgucken

Eigenartig, vielleicht ist max. Power nicht immer gut !?

juergs

#302
Ja, ein RSSI-Wert wäre nicht schlecht ...

EDIT: Oh! hier. Das bestätigt mich ( kurios: PA0?!, verhält sich so wie Pa1+PA2?): https://www.andrehessling.de/wp-content/uploads/2015/02/RFM69HW_RSSIVsPowerLevel.png

Aber: ab 30 kann ich so gerade nicht bestätigen (die 15 passt, mal schauen wie weit ich da wieder heruntergehen kann) ...  ???

ZitatSet reg 0x58 to 0x2D
It increases the sensitivity by 2-3db by enabling the low noise pre-amp.
Good for more distance!

hdgucken

Sehr interessant !!!
Zitat von: juergs
EDIT: Oh! hier. Das bestätigt mich ( kurios: PA0?!, verhält sich so wie Pa1+PA2?): https://www.andrehessling.de/wp-content/uploads/2015/02/RFM69HW_RSSIVsPowerLevel.png
Aber: ab 30 kann ich so gerade nicht bestätigen (die 15 passt, mal schauen wie weit ich da wieder heruntergehen kann) ...  ???
Die RFM69HW, HCW sind leider nicht pinkompatibel, aber sonst ne echte alternative !

Gruß Thomas

PeMue

Hallo zusammen,

hat jemand von Euch schon das BSEC Beispiel für AVRmega (ich meine, da müsste der Atmega644 passen?) compiliert? Für ESP8366 bekomme ich es hin, für Atmel motzt der Linker, dass die Bibliotheken inkompatibel seien  :o :o :o.

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

juergs

#305
Hallo Peter,
hast Du die Dot-a-linkage probiert?
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format
Zitatdot_a_linkage - (available from IDE 1.6.0 / arduino-builder 1.0.0-beta13) when set to true, the library will be compiled using a .a (archive) file.
First, all source files are compiled into .o files as normal. Then instead of including all .o files in the linker command directly, all .o files are saved into a .a file,
which is then included in the linker command. 1.5 format library folder structure is required.
precompiled - (feature not yet released, will be available in arduino-builder >1.3.25) set to true to allow the use of .a (archive) and .so (shared object) files.
The .a/.so file must be located at src/{build.mcu} where {build.mcu} is the architecture name of the target the file was compiled for. Ex: cortex-m3 for the Arduino DUE. The static library should be linked as an ldflag.
ldflags - (feature not yet released, will be available in arduino-builder >1.3.25) - the linker flags to be added. Ex: ldflags=-lm

Zusammen mit makefile? oder Arduino-Makefile

Auch hier:
ZitatWe have precompiled functions implementing all instructions sepa
rately (thus, got object file for  every  each  instruction)  and 
packed  it  to  a  single  *.a  file  (standard  library  of  gcc  is 
precompiled  in  this  way).  This  library  does  not  include  hardware  access  layer  and  thus  is 
completely device independent – it works on different microcontrollers from AVR8 family.
On  the  other  hand,  library  functions  expect  the  hardware  access  layer  implemented  outside 
and  specific  to  used  microcontroller  –  the  code  in  the  library  is  not  linked.  There  are 
"unconnected"     calls     for     functions     spiMasterINIT(),     spiMasterTRANSMIT()     and     spiMasterChipSelect(). The linker will try to link
calls from library to those functions – user has to implement them.

http://www.matejk.cz/zdroje/mcp2515-avr-can-spi.pdf

ZitatOk, I think I've got it working. What I did was simply add the path to the .a file to the ##Link step by changing this line:

"{build.path}/{archive_file}" "-L{build.path}"

to this:

"{build.path}/{archive_file}" "C:\Users\Nick\Documents\Arduino\libraries\mpl\libl ibmplmpu.a" "-L{build.path}"

Bei mir ist dieser Eintrag in:
"C:\Program Files (x86)\Arduino\hardware\arduino\avr\platform.txt"
und
C:\Program Files (x86)\Arduino\hardware\platform.keys.rewrite.txt
zu finden...


Probiert habe ich es selbst (noch) nicht, da der ESP und der STM32 mehr als ausreichend sind ..  ;)

juergs

String CalculateIAQ(float score){
  String IAQ_text = "Air quality is ";
//  score = (100-score)*5;   // beeing calculated from gas resitance without bsec
  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;
}

PeMue

Hallo Jürgen,

mit Deinem letzten Zitat habe ich die Bibliothek ebenfalls eingebunden bekommen. Allerdings motzt der Linker, dass das Format nicht passt ...
Der ESP ist nicht für batteriebetriebene Sensoren, den STM kenne ich zu wenig ...


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

juergs

den STM kenne ich zu wenig
Das lässt sich ändern...  ;)

juergs

#309
Anbei meine Maple-STM32-Code-Variante als Beta.
OLED und BME680 funktionieren, beim SPI zum RFM69 bin ich noch in Klärung ... 
Evtl. tausche ich die SPI-LIB gegen die "RFM69-STM32-master"-Lib aus Github aus...
SPI-Bus ist aktiv. sendet aber über den RFM (noch) nicht, könnte aber auch nur die Einstellung des PA_Levels sein ...
Schaue mir das am WoE noch genauer an ...  :)

Die ARM M3 precompiled BSEC-Lib ist, wie hier beschrieben, auch für den Maple einzubinden:
https://wolfgangklenk.wordpress.com/2017/11/05/indoor-air-quality-iaq-measurement-with-bosch-bme680-and-stm32f103c8t6/

Die STM32 Plattform-Installation für die Arduino-IDE gibts im Internet zu hauf.
https://www.bosch-sensortec.com/bst/products/all_products/bsec

Mein Wroom2-Board (ESP8266) läuft jetzt schon den 2ten Tag ohne Nachladen mit einem 18650 mit OLED durch!
Da wäre ich am Überlegen, das OLED einfach per Taster Software-technisch ab- und einzuschalten.
Auf dem Wroom-Board liegen die Taster leider physikalisch auf der SPI-Schnittstelle:

Center = D5 (SCLK)
Up = D6 (MISO)
Down = D7 (MOSI)
Left = RES
Right = D3 (Flash, verfügbar)

Habe also nur D3 frei und evtl. D0 (2te grüne LED) zur Verfügung.

In meiner ESP-Version habe ich ja WiFi abgeschalten, das spart schon erheblich. 

Für den AVR könnte man aber auch damit, also ohne BSEC leben:
https://github.com/G6EJD/BME680-Example
Siehe unten blaue zu gelber Kurve.

hdgucken

Hallo Leute,

Zitat von: PeMue
hat jemand von Euch schon das BSEC Beispiel für AVRmega (ich meine, da müsste der Atmega644 passen?) compiliert? Für ESP8266 bekomme ich es hin, für Atmel motzt der Linker, dass die Bibliotheken inkompatibel seien  :o :o :o.
Gleiches Problem bei mir.
Daraufhin habe ich mir gleich mal zwei Blue Pills bei a...n bestellt (STM32F103C8). Hoffentlich reicht der Flash Speicher bei den Boards ???
Hab wie PeMue keine großartigen Erfahrungen damit, aber:
Zitat von: juergs
den STM kenne ich zu wenig
Das lässt sich ändern...  ;)

Gruß Thomas

juergs


PeMue

#312
Hallo zusammen,

wenn ich die BSEC Library in das Verzeichnis libraries kopiere (bzw. beim Kompilieren) kommt folgende Meldung:
e:/software/arduino185/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: avr:6 architecture of input file `E:\software\arduino185\portable\sketchbook\libraries\libalgobsec.a(bsec_interface.o)' is incompatible with avr:5 output
bzw.
Ungültige Bibliothek G:\software\arduino185\portable\sketchbook\libraries\BSEC in G:\software\arduino185\portable\sketchbook\libraries\BSEC gefunden

Ich vermute, da passt etwas mit der Bibliotheksstruktur nicht (oder es fehlt ein Linker Schalter).
Mir wäre persönlich ein Atmega lieber, weil
- ich dann eine Universalsensorplatine aka Dirk's Sensor machen könnte
- ggf. da auch verschiedene Protokolle (Homematic, Thomas' Universalsensor, etc.) laufen könnte und
- der ESP8266 für Batteriebetrieb nicht wirklich geeignet ist.

Damit man mir aber nicht mangelnde Lernfähigkeit vorwerfen kann  ;D ;D ;D, habe ich mal meine Arduino IDE für STM32F1x befähigt. Dieser Chip ist ja auch auf meinem mapleCUx drauf  :P

Gruß Peter

Edit: Der Blink Sketch lässt sich zumindest mal für den STM32F1x kompilieren  ;)
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

juergs

#313
ZitatDamit man mir aber nicht mangelnde Lernfähigkeit vorwerfen kann    ,
Nee, so schlimm ist es jetzt auch wieder nicht.  ;D
Aber da Du eigentlich mit dem STM auch schon Layout-Erfahrung gewonnen hast und dieser doch noch wesentlich mehr Möglichkeiten bietet
als ein AVR?

Aber man muss das Rad auch nicht neu erfinden ... Hatte den STM halt noch "übrig" ...

Apropos:
Ich hatte mir das Projekt von @roedert mit dem Wasserzähler angeschaut https://forum.fhem.de/index.php?action=dlattach;topic=71341.0;attach=93201 
Er benutzt da googlecharts_line_basic.
Wäre für dieses Projekt ebenfalls sehr interessant...

@Peter, kann mir erst am WoE das Thema Compiler noch mal anschauen  :'(
http://www.avrfreaks.net/forum/error-compiling-debug-project-only
ZitatFar better to post the build output - maybe just the areas where the errors actually occur if there is a lot of it.

juergs

#314
@PeMue
ich vermute stark, dass die AVR 8 Bit Lib nicht für die Arduino, sondern für die Atmel Studio Toolchain kompiliert worden ist.
http://www.microchip.com/avr-support/avr-and-arm-toolchains-(c-compilers)

https://github.com/BoschSensortec/BME680_driver
ZitatDo you mean in the Arduino IDE? This is quite complicated as the Arduino IDE currently doesn't support precompiled libs.
This will probably be supported in on of their next releases. Once they do, we will also release a BSEC library for use in the Arduino IDE with examples.
Na ja stimmt ja so nicht ganz ....