magellannh / rtl-wx

RTL-Wx logs data from 433Mhz wireless sensors using an RTL-SDR dongle. The Wiki has some screenshots of the results
GNU General Public License v2.0
21 stars 7 forks source link

Owl energy meter decoding #4

Closed renicok closed 9 years ago

renicok commented 9 years ago

Hello magellannh,

I wanted to be able to capture the signal sent by my Owl energy meter using RTL-SDR for processing on my PC. After doing some research it seems like the Owl energy meter uses the Oregon scientific protocol. After some more research I found your project and it did exactly what I wanted. After testing the software I found a problem and I hope that you would be able to tell me how to fix this.

I tested rtl-wx in server mode, but it did not pick up any data transmitted by my unit. I then ran rtl-wx in standalone mode and I saw error messages printed to the console (OWLCM119 Error). The calculated values seem to be out of range. I located the piece of code in rtl-433fm-decode.c where a check is performed to ensure that the current and total_current values are in range.

I also added some code at that point to dump the msg and bb buffers to the console in an attemt to see what is going on:

        unsigned int current = get_owl_current(msg);
        double total_current = get_owl_total_current(msg);
        if ((current > 0) && (total_current > 0) && (current < 1000) && (total_current < 10000)) {
            if (owl_msg_ok_callback != NULL) {
                owl_msg_ok_callback(msg, 13, (float) current, total_current);
                return 1;
            } else
                //fprintf(stderr, "Power: %d (watts) Total: %7.4f (KWH)\n", current, total_current);
                fprintf(stderr, " Energy Sensor OWLCM119 Channel %d Current: %d (watts) Total: %7.4f (KWH)\n", msg[0] >> 4, current, total_current);
        } else {
            fprintf(stderr, "Message: ");
            for (i = 0; i < BITBUF_COLS; i++) fprintf(stderr, "%02x, ", msg[i]);
            fprintf(stderr, "\n");
            fprintf(stderr, "    Raw: ");
            for (i = 0; i < BITBUF_COLS; i++) fprintf(stderr, "%02x,", bb[0][i]);
            fprintf(stderr, "\n\n");

            if (owl_msg_error_callback != NULL) owl_msg_error_callback(msg, 13, (float) current, total_current);
        }

This output was produced: Message: 19, 84, 01, a0, 50, c9, 00, 90, 04, 4e, b0, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, Raw: 00,00,00,58,91,20,85,0a,03,90,09,00,22,7d,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, At that time my meter displayed 0.483 KW.

Here is another example: Message: 19, 84, 01, a0, 60, c0, 00, 00, 03, 3c, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, Raw: 00,00,00,58,91,20,85,06,03,00,00,00,cc,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,

This time the meter displayed 0.515KW.

I'm having a hard time trying to figure out how to process the buffer to get the consumed kilowatts. I have researched this a bit, but I could not find any way yet to successfully produce a value close to 0.483KW or 0.515KW.

I have the following meter: http://theowl.co.za/catalogsearch/result/index/?mode=grid&q=SE16 (I think it uses the CM119 sensor).

Do you perhaps know how to make sense of the msg buffer or raw buffer (bb) data?

magellannh commented 9 years ago

I think I read somewhere that the OWL Micro + uses a slightly different protocol from the CM119, but maybe it's still Oregon Scientific v3.

Check out the last 2 comments about decoding OWL sensor data in this long rtl_433 thread: https://github.com/merbanan/rtl_433/issues/23

Maybe that helps?