merbanan / rtl_433

Program to decode radio transmissions from devices on the ISM bands (and other frequencies)
GNU General Public License v2.0
6.02k stars 1.31k forks source link

Analyzing Shenzhen EGQ TPMS Samples #2556

Closed js-3972 closed 3 months ago

js-3972 commented 1 year ago

I have this TPMS from Amazon that can be found at https://www.amazon.com/dp/B0BK8SHDRZ?psc=1&ref=ppx_yo2ov_dt_b_product_details

When I run rtl_433, it recognizes the sensor as the Abarth-124Spider, however, none of the values (pressure, temperature, etc.) appear to be matching what the sensor is displaying.

I have ran "rtl_433 -S all" to grab samples of some of the received frames. I have attached some of the cu8 files I captured below but I'm unsure if the data I have captured is even valid. For example, I'm confused at to why the modulation scheme varies between the files even though they were taken with the same device or why some packets are longer than others. It would be much appreciated if someone couId provide some guidance on what the next steps are with the data I have captured. ShenzenEGQ.zip

ProfBoc75 commented 1 year ago

Hi @js-3972 ,

The length of the capture is not an issue, it depends on the rf conditions, are you isolate, or living in big city, for the last, you may capture a lot of rf signals.

Can you try with rtl_433 -R 123 , since the 3 last from your cu8 files sounds to be properly decoded with this decoder disabled by default.

For all the 4 cu8 files : image

with -C customary : image

Check if it's ok with -R 123. Also , what are the values and the unit on the console ? If you capture again, for each cu8 file, put the information you have, with the unit (C / F , PSI / Bar / Kpa .. )

js-3972 commented 1 year ago

Hi @ProfBoc75 ,

The device that's being recognized is the Abarth-124Spider, not the Jansite TPMS, so I ran "-R 156" instead. I have attached a few cu8 files that were generated. As you can see, the rtl software displays a value of 31 c and 48 kpa, but the device's console displays 15 psi and 26 c. image

Attached are all of the cu8 files generated with the previous values. 15psi_26c.zip

ProfBoc75 commented 1 year ago

Hi @js-3972 ,

Thanks for the sample and the temp / pressure information.

The data message is not the same format as the Abarth-124Spider but it's similar until the checksum the reason why it's decoded as Abarth-124Spider, but the conversion of the temp & pressure sounds to be different.

First the Shenzhen message is longer, after the checksum we have a fix 0x40 then a CRC-16/CCITT-FALSE, in little-endian. The Temperature offset is -55 instead of -50 ( same, it's -55 for the Jansite Solar which have a very similar data format). The pressure is data 3 = kpa value, instead of 1.38.

Here the bitbench

So, to confirm that, capture again other values. For the temperature, it's easy to confirm, remove 5 C from Abarth result and you have the same as your console's display (from your last captures, 31C - 5C = 26C as expected). For the pressure, more complex, by default, rtl_433 will show the value in KPa for this Abarth device, ( 1 PSI = 6.89476 KPa), we need to divide the result by 6.89476 to get PSI but the pressure conversion is 3 instead of 1.38, so you need to divide by 3.17159 to get to good result from KPa value to PSI value. (from your last captures, 48KPa / 3.17159 = 15 PSI as expected) If you want just the KPa correction take the result and 2.1739. ( 48 KPa 2.1739 = 104 KPa = 15 PSI).

After few captures that will confirm my hypothesis, we can update the abarth device to take into account this model.

ProfBoc75 commented 1 year ago

Hi @zuckschwerdt , need your help please.

I'm ready to create a new PR to 'Add support for Shenzhen EGQ Q85 and improve Abarth 124 Spider'. But in my current fork I still have another active PR #2549 Add Support for TFA Stratos, ready for merge ...

How I can create a new PR with this current issue & without conflict with the other PR ?

Notice, that I don't yet git push my update, still on my laptop for the moment, waiting your git instruction / help.

Thanks

zuckschwerdt commented 1 year ago

You need to start a new branch from master for the PR. E.g. git checkout master ; git checkout -b feat-egqtpms then add the decoder, commit, push, PR.

ProfBoc75 commented 1 year ago

You need to start a new branch from master for the PR. E.g. git checkout master ; git checkout -b feat-egqtpms then add the decoder, commit, push, PR.

Done, Thx.

js-3972 commented 1 year ago

@ProfBoc75 Thanks for the timely response, I'm glad you were able to decode the signal.

I am particularly interested in how you were able to properly decode the bits. For example, in bitbench, you had the string "aaaa9aa9596a69569aa95665aa6a599a9a96559569aaa695a55a90" for the Shenzhen sensor. Where did this string come from? Maybe I missed it, but was this particular message included in one of the signals I provided? I am just as much interested in the process you took to decode the signal as I am in decoding the signal itself, so if you could provide some more insight that would be greatly appreciated. Thanks.

ProfBoc75 commented 1 year ago

@js-3972 , yes, the string come from the signal you provided in the .cu8 files.

90% of the job was already done by the abarth-124Spider device driver, since your signal was decoded but the temp and pressure were wrong.

So, look at the bottom of tpms_abarth124.c file and you have the modulation information:

Then into the same file, we have the preamble = 0xaaaaa9 , inverted data, Manchester encoded data and data layout

So it's enough to start a flex decoder and replay the cu8 files , keep only the abarth 124Spider enabled by -R 156 and :v for verbose the code , like this :

rtl_433 -X "n=shenzen,m=FSK_PCM,s=52,l=52,r=150,invert" *.cu8 -R 156:v

image image

Notice that the flex decoder is useless, since we have the same result with the verbose option...

Then enough for me to build the bitbench information from all sources :

Thanks to the builtin Manchester decoder in bitbench, then you have the hexa bytes (in bitbench on Manchester line, click on Show to see them).

07 62 79 07 ac 23 51 1b de 40 9c f1
07 62 79 07 aa 1b 51 1b e0 40 24 54
07 62 79 07 ac 23 50 1b df 40 19 b4
07 62 79 07 aa 1b 51 1b e0 40 24 54
0f 54 76 e8 b7 53 44 01 64 0a
0f 54 76 ea b7 95 40 01 a4 4a

With the help of this nice online crc calculator web site , I was able to find that the 2 last bytes are CRC16 CCITT-FALSE but little-endian formatted , it means that the first byte is the lower value and the last byte is the higher value, which is the reverse of classic format.

Then, I added the data layout information :

ID:32h FLAGS:4h4h P:8d T:8d S:4h4h CHECKSUM:8h UNKNOWN:8h CRC_Little-ENDIAN:16h
ID:07627907 FLAGS:ac P:035 T:081 S:1b CHECKSUM:de UNKNOWN:40 CRC_Little-ENDIAN:9cf1

From there, we have the decimal value for Pressure and Temp, and you can find easily the conversion. Looking into all other device drivers to get the most likely conversion values:

After, it's coding this into the existing device driver for Abarth 124 Spider. Looking into your amazon link , I found details about your sensor, the ref is Q85 , the brand is Shenzhen EGQ Cloud ... so I decided to call it "Shenzhen-EGQ-Q85".

The both sensors don't send the same message, one is around 195 bits (72 bits after Manchester decoded), and yours is around 353 bits (96 bits after Manchester decoded). "Around", because it's RF, some times it's longer or shorter (radio interference). But it's useful to define a type and have the good conversion.

Thanks to rtl_433_test, we have older cu8 capture files from the Abarth 124 Spider to be able to replay and compare the both signals. This help me to control that the new version of the device driver from my PR is working for both sensors.

Hope this help to understand how to decode a signal.

js-3972 commented 1 year ago

@ProfBoc75 Thank you for the analysis. It seems like having the Abarth-124Spider as a baseline helped a lot with the decoding process. Let's say we had a device signal that was not already decoded. Is the process more of a "brute force" method when decoding the signal, or is there also an intuitive method to do so? I know you have to build a flex decoder and replicate some of the steps you did above, but what happens if you don't already have a decoder to base it off of?

ProfBoc75 commented 1 year ago

@js-3972 : Well, in the Wiki part of rtl_433 you have plenty information. Another starting point is from https://triq.org/ , from Christian @zuckschwerdt , who is the major contributor of rtl_433.

From scratch:

To sum up, it takes a lot of steps to get there, and sometimes you just can't get there. Some requests have been open for months or even years. Experience, knowledge and luck are key : Try, Fail, Try again, Fail better .... , Try again, Success !

gdt commented 10 months ago

I see there is a PR #2558. Is there anything in this issue that is not captured in the source code improvements in the PR? If not, I would prefer to close the issue, on the general concept of progress being issue->PR->code-present-in-master.

gdt commented 3 months ago

PR still open, and no response to feedback