Comments (9)
Hi Jens,
the BresserWeatherSensorReceiver basically tries to receive both kind of packets to collect the data.
I'm re-using the decoder functions from the rtl_433 project. There is currently a discussion on how to distinguish both kinds of packets. The current version gets the rain gauge values wrong if the temperature falls below zero. There is a fix which I added yesterday (please see matthias-bs/BresserWeatherSensorReceiver#21) , but it seems it is more of a workaround than a final solution. It seems to work and improve the decoding, but a definite reverse-engineering of the packet encoding would be better.
It seems @MacH-21 has done this: merbanan/rtl_433#1214 (comment).
Let's see if others can confirm that.
Currently I do not have as much time to spend on this as I would like.
Best Regards
Matthias
from bresserweathersensorttn.
BTW: Which rain counter value is wrong? rain_mm
or the other ones?
rain_mm
is the current sensor value, the other values are calculated. The rain statistics still have a problem when a rain value of '0' occurs by accident. Normally this should be marked by an invalid flag, but obviously it isn't. The '0' is considered as a roll-over of the counter value, this leading to high daily/weekly/monthly values.
from bresserweathersensorttn.
BTW: Which rain counter value is wrong?
rain_mm
or the other ones?rain_mm
is the current sensor value, the other values are calculated. The rain statistics still have a problem when a rain value of '0' occurs by accident. Normally this should be marked by an invalid flag, but obviously it isn't. The '0' is considered as a roll-over of the counter value, this leading to high daily/weekly/monthly values.
Hi Matthias, it is rain_mm. I will make some tests and come back with the results.
Jens
from bresserweathersensorttn.
Hi Matthias,
after some debugging, I would say, this part of code is doing the decoding for me:
temp_ok = (msg[12] != 0xff);
if (temp_ok) {
int temp_raw = (msg[12] >> 4) * 100 + (msg[12] & 0x0f) * 10 + (msg[13] >> 4);
float temp = temp_raw * 0.1f;
if (temp_raw > 600)
temp = (temp_raw - 1000) * 0.1f;
sensor[slot].temp_c = temp;
sensor[slot].battery_ok = (msg[13] >> 1) & 1; // b[13] & 0x02 is battery_good, s.a. #1993
sensor[slot].humidity = (msg[14] >> 4) * 10 + (msg[14] & 0x0f);
} else {
rain_ok = true;
msg[13] ^= 0xff;
msg[14] ^= 0xff;
int rain_raw = (msg[13] >> 4) * 1000 + (msg[13] & 0x0f) * 100
+ (msg[14] >> 4) * 10 + (msg[14] & 0x0f);
sensor[slot].rain_mm = rain_raw * 0.1f;
}
But often there is only one part (temp/hum or rain) set in the data. I've found two possible reasons:
- in setup() the call mySensor.setup(); ends with a timeout - but the next function myLoRaWAN.setup(); is called even in this case.
- bool decode_ok = weatherSensor.getData(WEATHERSENSOR_TIMEOUT * 1000, DATA_ALL_SLOTS);
I think, DATA_COMPLETE should be added.
Jens
from bresserweathersensorttn.
Hi Matthias,
the massive problems to decode enough messages before timeout were homemade by debug code. The reasons mentioned above are still there, but with the better reception after fixing my debug code they are not so relevant.
Jens
from bresserweathersensorttn.
Aeh, using your library example BresserWeatherSensorBasic I saw that the first row of the code should look like this:
humidity_ok = temp_ok = (msg[12] != 0xff);
Jens
from bresserweathersensorttn.
Hi,
Currently, msg[12] is also considered part of the rain gauge value (inverted BCD), so we cannot rely on this byte to distinguish between message types. Please see https://github.com/merbanan/rtl_433/blob/master/src/devices/bresser_6in1.c
It seems, msg[16] contains the desired information. Let's see how this works out...
Regarding the option to weatherSensor.getData() - DATA_ALL_SLOTS/DATA_COMPLETE: There is always a compromise between run time (regarding energy consumption while battery powered) and completeness of data.
I made my choice, because I wanted to receive data from both a weather sensor and a soil moisture sensor (therefore DATA_ALL_SLOTS) and receiving incomplete data from time to time was acceptable.
And my choice was to send a LoRaWAN message even if some/all data was corrupt/incomplete to see that the node is still up and running. But I also considered to have a compile time option for that, which is not implemented yet.
In my main application, I receive data from a weather sensor with 5-in-1 protocol (which is very reliable) and the soil moisture sensor (6-in-1 protocol). I am currently receiving the weather sensor with 6-in-1 protocol (my neighbours') in my test environment.
Best regards
Matthias
from bresserweathersensorttn.
Hi,
Currently, msg[12] is also considered part of the rain gauge value (inverted BCD), so we cannot rely on this byte to distinguish between message types. Please see https://github.com/merbanan/rtl_433/blob/master/src/devices/bresser_6in1.c
It seems, msg[16] contains the desired information. Let's see how this works out...
I see what you mean: 0xff inverted is 0 - may be the upper numbers of rain. My counter is on 278,4 now, we have to wait 2 more years...
Our LoRaWAN-Group has some of the bresser 6in1 (with 5 sensors) . I'll try to test it with a servo moving the rain sensor.
Regarding the option to weatherSensor.getData() - DATA_ALL_SLOTS/DATA_COMPLETE: There is always a compromise between run time (regarding energy consumption while battery powered) and completeness of data. I made my choice, because I wanted to receive data from both a weather sensor and a soil moisture sensor (therefore DATA_ALL_SLOTS) and receiving incomplete data from time to time was acceptable. And my choice was to send a LoRaWAN message even if some/all data was corrupt/incomplete to see that the node is still up and running. But I also considered to have a compile time option for that, which is not implemented yet.
Ok, I understand. A comment would help, perhaps. But on the other hand: Now I know something more about your software ;-)
In my main application, I receive data from a weather sensor with 5-in-1 protocol (which is very reliable) and the soil moisture sensor (6-in-1 protocol). I am currently receiving the weather sensor with 6-in-1 protocol (my neighbours') in my test environment.
Best regards Matthias
Regards and thank you for this project,
Jens
from bresserweathersensorttn.
Hi Jens,
this should be fixed now - in a clean way, I think.
Regards
Matthias
from bresserweathersensorttn.
Related Issues (20)
- Wrong author in references HOT 2
- Request for testing Heltec Wireless Stick configuration HOT 5
- Request for testing Adafruit Feather ESP32-S2 with Adafruit LoRa Radio FeatherWing configuration HOT 1
- Request for testing Adafruit Feather ESP32 with Adafruit LoRa Radio FeatherWing configuration HOT 2
- Request for testing DFRobot FireBeetle ESP32 IoT Microcontroller with FireBeetle Cover LoRa Radio 868MHz HOT 1
- Add define for ePulse Feather VBAT Monitoring Voltage Divider HOT 2
- Thingpulse ePulse Feather & Adafruit LoRa Radio FeatherWing Battery Power Stability HOT 2
- Add support for Bresser Lightning Sensor HOT 1
- Integrate lightning sensor data post-processing
- Issues after updating libraries HOT 18
- Add support for arduino-pico / RP2040 - full features
- Firebeetle LoRa Cover HOT 8
- Add support for arduino-pico / RP2040 - initial
- request for adding heltec-wifi-lora-32-v3 as supported board HOT 1
- Inadvertent change of sleep duration HOT 1
- Potential mix of weather sensor data using 6-in-1 decoder HOT 1
- Add support for ESP32-S3 PowerFeather with Adafruit LoRa Radio FeatherWing
- Fix compiling errors with arduino-esp32 v3.0.X (ESP32AnalogRead)
- Update board configurations to changes in arduino-esp32 v3.0.0
- Update ADC related code HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bresserweathersensorttn.