Monitoring Tire Pressure..yes

So moving along with getting a NYMEA raspberry in my RV.

After driving over 100 miles with a trailer tire missing (It blew and disinegraded and i didnt know it) i realized i need a TPMS for the trailer i tow behind the RV. Since it has 4 tires, and the RV is so heavy, you dont even realize when you have blown a tire till its too late.

All the aftermarket TPMS systems are expen$ive and kind suck. Their battery life is less than a year. I want factory style TPMS that lasts for 5-7 years. So, using a software defined radio and rtl_433, i found that its possible to decode the data broadcast from some TPMS sensors and get them into the raspberry. Unfortunatly i wasnt able to do this on my truck, but on my friends jeep it worked! So, i ordered the same sensors on his jeep ($100) and the programing tool ($200) and should be able to read the tire pressure data without issue.

How do i get this data from the external program into NYMEA. I remember somewhere int he docs it said something about bringing in external program data, but i cant recall how.

And FYI, if you want to have some fun, get a software defined radio for $20 and run that rtl_433 at home. You will be amazed how many devices you will be reading from neighbors, passing cars, etc!

–John

Hey @dunarri,

so, how to get data from this sort of thing into nymea is something we need to find out. What’s the external program? Is that something you wrote or an existing piece of code somewhere?

Eventually I’d like to see pictures of your nymea featured RV :smiley:

Definatly!

Didnt write any code yet, but if you would like…check it out, its just simple data from rtl_433.

When run on the command line i can get:

time : 2021-01-24 16:45:47
model : Schrader type : TPMS flags : 04 ID : 12FAAA8
Pressure : 177.5 kPa Temperature: 6 C Integrity : CRC

ok, Checked out the rtl_433 tool. Seems that supports writing sensor values to MQTT. I think you should be able to get this running in nymea with this method:

Instead of using mosquitto_pub as written in that howto, you should be able to just start the rtl_433 tool with rtl_433 -F mqtt and it should send the values to nymea (if running on the same host as nymead, otherwise also specify the ip, check --help)

Let me know if that works so I can add it to the docs.

Its working, beautifully =). Just cant seem to get the math right to make it display properly. Im assuming its using the raw data and doesnt know PSI from mbar. Set the formula to: tpms1.value = params[“data”] / 150 and the range in the thing to 0-150 but getting really low numbers. I can see in console data is 6.65, so i would think if i have the formula to divide by 150 and the thing at 0-150 it should come out to the correct PSI number (Even though it says mbar).

Is there a way to change the mbar to PSI for US style pressure?

–John

As far as I can tell, the formula would be psi / 68,948 to get mbar. Anyhow, you shouldn’t need to do that. For one, use -C si with the rtl_433 tool so it would report them in the metric/SI system which is what nymea expects internally. And then there is a setting in App settings -> look and feel -> unit system which would switch the entire app to display imperial units.

I believe it doesn’t actually include pressure units yet which can be considered a bug in the app, but shouldn’t take us too long to get that fixed. Thanks for pointing that out. Will report back when the app is fixed.

Good call, just added the -C si option (Slap in the head didnt see that one).

Changed formula to: tpms1.value = (params[“data”] * 10) / 10342 and set the things range to 0 - 10342

But still getting low numbers.

Humm.

–John

The input value of the generic pressure sensor is in percent. Could it be you’re just missing a factor 10? In other worlds:

tpms1.value: params["data"] * 100 / 10342

Assuming you’d get millibar from MQTT… (don’t have any hardware that would work with rtl_433 so I can’t actually test). Not sure where you got the * 10 from, probably I’m still missing something… In any case, you’d need to translate the input value into “percentage between min and max setting” of the generic pressure sensor thing.

Hope that helps.

Exactly, it was off by a factor of. Had to multiply by 1000 to get it right, but it works!

Well, here, console
10: MQTT event reveived: {“27ec8baf-0c13-4d0a-aaee-313582592695”:“rtl_433/nymea/devices/TPMS/Schrader-SMD3MA4/B716C7/pressure_kPa”,“8af98566-79d9-4e65-b1dc-9067e4f93af1”:“32.7501”,“data”:“32.7501”,“topic”:“rtl_433/nymea/devices/TPMS/Schrader-SMD3MA4/B716C7/pressure_kPa”}

Had to multiply by 1000 but it works correct:
tpms1.value = (params[“data”] *1000) / 10342

And for anyone interested here is the TPMS sensor i used:
An aftermarket version of ford PN: 4L2T-1A150-BB,4L2Z-1A150-BB

Nice. I have the code ready to display that in psi. Next app update should have that (after setting units to imperial in app settings).

(The sensor is not mounted, is it? 327mbar seems somewhat low to me)

lol yea its low because its not in a tire. Its in a garden sprayer im using to make pressure sitting next to my desk. Glad i got it, my arm was getting worn out from pumping it over and over to get pressure changes =)

Wheres the “buy us coffee” link to paypal to send you guys a few $?

–John

heh, here: Donate via PayPal

Seems it got lost on the last update…

Donation done. =)

Im going to try the Schrader 33500 universal sensor as soon as it arrives. The ford ones work fine, but are the screw on type, and in my experience, tend to have leaking issues much easier than the rubber kind. The downside is they require a $200 programing tool…but who knows, maybe for our use they will work without programing.

Ill let you guys know how that one works out.

–John

2 Likes

The Schrader 33500 sensor works perfectly, although you do need a programer to set it up. I recomend the BARTEC tech 200. Got one for $170. The programmer sets the frequency and data corresponding to a vehicle. Many settings would work, but I choose a 2005 Ford Explorer, since i know that one works.

One thing im confused of here is how the numbers and math here workout. I can get data in Kpa or PSI, but either way im confused on the conversion.

Does NYMEA know the measurement is in PSI for example? I would think if i sent it the pressure in PSI, then did a simple formula in magic tpms2.value = (params[“data”]) / 150, then set the generic thing from 0-150, then i should see the correct PSI value in NYMEA (Even though it would say mbar). That doesnt seem to work. Same situation if i have it send kpa, then convert to mbar in the formula.

I get varying numbers, so i know its working…but not sure why they are never close to correct.

For instance, right now i have it sending the PSI value. I can see in Magic its sending "14.95, which is the correct PSI. Then i do tpms2.value = (params[“data”]) / 150. Then on the generic pressure thing i have it set the range of 0-150. All seems correct, but NYMEA is showing 149.5. I dont get why?

–John

–John

The generic thing expects a percentage from min to max as input.
So, if you have min = 0 and max = 150, you’d need to set it 100 to get 150 in the display.

Anyhow, the generic thing expects mbar (as everything in nymea does). The app will then transform it to PSI again in the last instance before displaying if you have selected imperial units in the app settings.

So, my suggestion would be to use -C si to make it print kPa and then multiply it by 10 to get mbar (1kPa = 10mBar). Then transform it to the percentage of your generic sensor thing. I would probably choose 0 - 10000 mbar as min/max, so the maths would be:

onValueChanged: {
    console.log("Input value:", params["data"])

    var kPa = params["data"];

    // Transform from kPa to mBar
    var mbar = kPa * 10;

    var max = 10000; // The max as configured in the generic pressure thing

    // Transform to percentage with "input * 100% / max"
    var percentage = mbar * 100 / max;

    tpms.value = percentage;
}

The short edition for a max of 10000 mbar would then be: tpms.value = params["data"] / 10

I understand that the percentage thing might be a bit confusing for this use case. Nymea currently does not support dynamic input ranges, meaning the min/max can’t be applied to the input state at runtime, but only to the output. Using “percentage of the output value” as input seemed to be the most flexible/sensible then.

Awesome! I get it now! For some reason i thought i had read it expects a value between 0 and 1…thats what was messing me up. Now that i know its 0-100 %, it all makes sence.

rtl_433 is telling me the PSI is about 10 psi less than what it really is for some reason, but thats nothing to do with nymea, thats on the TPMS or rtl_433. nymea is now reporting exactly what rtl is sending. Awesome!

Thanks!

Any chance we will have the PSI setting work when your set to imperial units soon?

–John

Sorry, forgot to kick the build pipeline… Should be available now. (Note: on iOS you’ll have to wait for the 0.26 stable release, on Android you’ll have to join the beta program until the 0.26. The raspberry pi will get the update right away.)

This is a really nice project. Thanks for sharing the details.

PSI working great, as to not confuse people, i deleted my other post with the old magic. Here is the total working magic, using PSI:

import QtQuick 2.0
import nymea 1.0

Item {
    
    ThingEvent {
      thingId: "03bb2d67-954b-4168-96dd-bf43aad3b39d" // mqtt-tpms2-psi
      eventName: "triggered"
      onTriggered: {
        console.log("MQTT event reveived:", JSON.stringify(params["data"] ))
        
         // Get the psi from the sensor
         var psi = params["data"];

         // Readings seem off by an inverse relationship, so we calculate a multiplier
         // This is the sensor or rtl_433's fault - Not nymeas
         var multipler = 1.3937234688 - ((psi - 14.841) / 345.8261313727);
    
         // multiply psi by multipler
         var psi = psi * multipler;

         // set max of sensor (150 psi)
         var max = 150;
    
         var percentage = psi * 100 / max;
        
         tpms2.value =    percentage;
    
         // Alarm if tire under 45psi
         if (psi < 45 ) {
           console.log("Warning: UTV Trailer Right Tire under 45psi!");
         }
         
    }  // close onTriggered

}  // close thing



ThingState {
    id: tpms2
    thingId: "10267f49-febe-4762-993e-7732cb216fcd" // TPMS2
    stateName: "input"
}


    
    
    
}  // close item