Extract Manchester Decoded Raw data from OOK_PCM data

173 views
Skip to first unread message

Nozomiboy

unread,
Dec 30, 2023, 10:28:21 PM12/30/23
to rtl_433
I am writing a dissector for my blinds protocol, but I don't fully understand how RF encoding works and how to process the raw radio data to get the raw blind protocol.

I want to read the raw radio signal and then ensure that the preamble matches  (0xAA....), then Manchester decode the data so I can confirm the checksum is valid and print the details of the raw blind protcol.

Using the CLI, I can exact what I call the raw radio data, using OOK_PCM and the raw blinds protocol data using OOK_MC_ZEROBIT

<raw radio signaL>
rtl_433 -R 0 -X 'n=name,m=OOK_PCM,s=800,l=800,g=2000,r=6000' -r  r04/g001_433.92M_250k.cu8

len       : 65
data      : aaaaaaaaaaaaaaaa0,    <- preamble

len       : 81
data      : aa5555556aaa996a56a60


<raw blinds protocol>
rtl_433 -R 0 -X 'n=name,m=OOK_MC_ZEROBIT,s=800,l=800,g=2000,r=6000' -r  r04/g001_433.92M_250k.cu8

Len       : 72
data      : 0000000000007fa71d

In code, when I use .modulation  = OOK_PULSE_PCM - I get the raw radio signal, and when I use .modulation  = OOK_PULSE_MANCHESTER_ZEROBIT, I get the raw blinds protocol.

If I read the raw radio protocol data (.modulation  = OOK_PULSE_PCM)  - how do I process the data from that to get the Manchester decoded raw blind data?

What is the correct way to process the raw radio data and then Manchester decode it to get the raw blind protocol?

Here is what I am trying, but I am not getting the expected results - the raw blind data.
    bitbuffer_t raw_radio = {0};
    bitbuffer_t raw_blind = {0};
   
    raw_radio.bb[0][0] = 0xAA;
    raw_radio.bb[0][1] = 0xAA;
    raw_radio.bb[0][2] = 0xAA;
    raw_radio.bb[0][3] = 0xAA;
    raw_radio.bb[0][4] = 0xAA;
    raw_radio.bb[0][5] = 0xAA;
    raw_radio.bb[0][6] = 0xAA;
    raw_radio.bb[0][7] = 0xAA;
    raw_radio.bits_per_row[raw_radio.num_rows] = 65;
    raw_radio.num_rows++;

    raw_radio.bb[1][0] = 0xAA;
    raw_radio.bb[1][1] = 0x55;
    raw_radio.bb[1][2] = 0x55;
    raw_radio.bb[1][3] = 0x55;
    raw_radio.bb[1][4] = 0x6A;
    raw_radio.bb[1][5] = 0xAA;
    raw_radio.bb[1][6] = 0x99;
    raw_radio.bb[1][7] = 0x6A;
    raw_radio.bb[1][8] = 0x56;
    raw_radio.bb[1][9] = 0xA6;
    raw_radio.bits_per_row[raw_radio.num_rows] = 81;
    raw_radio.num_rows++;

    bitbuffer_print(&raw_radio);
    int ret = bitbuffer_manchester_decode (&raw_radio, 1, 0, raw_blind, 81);
    bitbuffer_print(&raw_blind);

Output

bitbuffer:: Number of rows: 2 

[00] {65} aa aa aa aa aa aa aa aa 00 

[01] {81} aa 55 55 55 6a aa 99 6a 56 a6 00 

bitbuffer:: Number of rows: 1 

[00] {40} 0f ff 80 58 e2 :





Christian Z.

unread,
Dec 31, 2023, 6:36:50 AM12/31/23
to rtl_433
What is the distance between preamble and data? Is it the usual three half-bit lengths (~2400)?
You maybe want that to be a single row and then bitbuffer_search() that desync symbol.

If you want to test your code simply use a .cu8 file or e.g. this line
rtl_433 -y aaaaaaaaaaaaaaaa0/aa5555556aaa996a56a60

Then decoding from the found start of MC is done with bitbuffer_manchester_decode().

MC_ZEROBIT will ignore errors and thus results in an overly long code. The true code after the start is only 40 bits.

You outlined the preferred way: get the PCM, match the preamble, search the MC start, decode MC, …more check and unpacking.

Nozomiboy

unread,
Dec 31, 2023, 5:25:27 PM12/31/23
to rtl_433
Here are are two examples of the the blind protocol capture -S unknown.   What settings should I use to get the extracted data to be a single line?   You will see upto 12 repeats of the message.

From your experience what is the best approach to process messages of this format.   I would like to implement using that approach.
g001_433.92M_250k.cu8
g002_433.92M_250k.cu8

Karl Lohner

unread,
Jan 2, 2024, 1:44:47 AM1/2/24
to Christian Z., rtl_433
These signals seem to be the same format as seen in https://github.com/merbanan/rtl_433/issues/1766 "Device Support QMOTION blinds to report their locations"

I've created a decoder that seems to work for all these signals and left that in a comment on that issue.

--
You received this message because you are subscribed to the Google Groups "rtl_433" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtl_433+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rtl_433/2f2b6e4f-3732-419f-93c4-3dbd0f00980an%40googlegroups.com.

Nozomiboy

unread,
Jan 2, 2024, 4:47:17 AM1/2/24
to rtl_433
Hi Karl

Yes I am the author add device issue - https://github.com/merbanan/rtl_433/issues/1766, so it is same QMOTION AM Gen2 protocol.  I have more devices and I have learnt more about the protocol (adding / deleting blinds) and was going to develop a dissector.  I am still trying to get transmitting working.

I am looking at your example and trying to learn how you did it.  This is a fun big learning curve.  

I am noticing variations in timings from traces ranging from 800 to 830us - so investigating what I thought was preamble is more sync.

Removing gap timing give the one line I was after to join lines together.
Reply all
Reply to author
Forward
0 new messages