Coder Social home page Coder Social logo

Comments (9)

matthias-bs avatar matthias-bs commented on September 26, 2024

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.

matthias-bs avatar matthias-bs commented on September 26, 2024

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.

DL4AAS avatar DL4AAS commented on September 26, 2024

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.

DL4AAS avatar DL4AAS commented on September 26, 2024

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.

DL4AAS avatar DL4AAS commented on September 26, 2024

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.

DL4AAS avatar DL4AAS commented on September 26, 2024

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.

matthias-bs avatar matthias-bs commented on September 26, 2024

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.

DL4AAS avatar DL4AAS commented on September 26, 2024

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.

matthias-bs avatar matthias-bs commented on September 26, 2024

Hi Jens,

this should be fixed now - in a clean way, I think.

Regards
Matthias

from bresserweathersensorttn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.