Building a smarter oil temp/pressure gauge

Joined
Jul 29, 2005
Messages
3,414
Location
Diesel Central, Indiana
I’ve been wanting to add oil temperature and pressure gauges to my car for awhile, as Honda doesn’t monitor these at all beyond a simple pressure switch.

But shopping for traditional round 52mm guages was an exercise in massive frustration. First, most of them are poor quality. They use cheap sending units and cheap gauge internals, but charge you a small fortune in expense. But even the better ones are still very limited and don’t provide lots of useful function.

So, enter the high tech multigauge with OLED or whatever. But these are OBD based almost entirely. You can’t add external sensors that didn’t come with the engine and integrate them into the same data. The racing dash will work, but how can you package that in a street driven car? Not to mention those aftermarket setups are hugely expensive.


Could I build my own setup? One that was more accurate, had better functionality but kept the simplicity and utility that’s important to me? Indeed, I believe I can. Here’s the basic approach:

1) Source a professional grade pressure sensor that uses the 4-20ma output format and integrates easily in a vehicle environment while being robust to it.

2) Use an RTD temperature probe instead of the thermocouple. This will give 0.3º C accuracy in an easily integrated format.

3) Use a little Raspberry Pi Pico to process the signals from the transducers and power a compact display that has basic touch screen function.


In theory, there’s not much to it. You take 12V from the car via OBD pin 16, route it through a buck converter to get you down to 5V where the rest of the system lives. The 5v powers a small RTD amp board that talks to the Temperature sensor. The 4-20ma pressure sensor signal comes in and drops voltage across a precision 250 ohm shunt resistor which the Raspberry uses for pressure values based on a linear current/voltage relationship. 4ma is 1V, 20ma is 5v, and the pressure is therefore 0-150psig on that linear equation.

The pressure sensor is 0.5% accurate and has a 1ms response time, which means it’s going to need some signal conditioning to produce a readable value on the screen. In testing, a good refresh rate seems to be about 2hz, so we’ll have the Raspberry sample the pressure values every thousandth of a second for 500 samples, calculated an exponential moving average on that sample period, then display that value, updating every half second. This should provide a great balance of response and legibility. Since the sampling methodology and refresh rate are coded in the firmware, we can tune these as needed if a different balance of response and stability is desired. In simulation, an alpha value of 0.2 on an EMA seems about perfect.

The RTD just uses straight up resistance to measure temperature. This one has a resistance of 1000 ohms at 0C and follows a slope of 3.85ohms per degree it’s good to a max of 260C, which is quite sufficient for oil temp. On the bottom end it can monitor temps much colder than I will ever see and with excellent precision of under one half degree Celsius.

Then the Raspberry in its little brain box stashed under the dash talks to a separate display module via corded USB-C.

The display box houses a small 2.8” TFT that displays your data while providing touch screen functions for things like adjusting brightness, changing color schemes from day to night, resetting the min or max memory values, etc.


Here’s what I came up with for my display layout. It shows the day and night modes. I hate bluish light glare at night, so red at night as all I can approve. And green during the day seems useful in my experience. Because this is a touch screen, you can tap the brightness slider across the top and manually override if you don’t like what the ambient light sensor came up with. Tapping the “reset” button will reset the max and min values for temperature or pressure in its respective window. Tapping the unit button will switch units between ºF or ºC for temp, or kPa and PSI for pressure.

IMG_0624.webp



The display should be installable in a very compact 3d printed housing with only a single USB-C cable connected to it. The button arrangement should allow the display to be housed in a partially hooded housing to reduce glare from the side and top while still allowing your fingers to touch freely as needed.


So there it is— my plan for a more sophisticated oil temperature and pressure gauge that actually should cost less than some of the better off the shelf options while outperforming them.
 
Last edited:
The wiring/soldering and such of the various little boards and modules is the easy part. The hard parts are going to be 1) packaging the brain box and displays into their separate housings, and 2) integrating all this into the vehicle.

The brain box is going to be fairly easy as Hammond makes several little project boxes that will work. But the display housing is where it’s going to be be a bit tricky, because this is the part you will see and interact with.

I haven’t exactly figured out how I want to house the display and mount to the vehicle. I want it to be compact and look integral. The easy option would be 3d printing a modeled housing and mount to a RAM suction cup arm or such with ball and socket. That’s a safe fallback and it provides the nice option to remove without doing anything permanent at all.

A-pillar mounting in this era of airbags everywhere isn’t the cake walk it used to be. But perhaps I can rig up something that clips to the a-pillar without penetrating it or having to remove any trim or covers.

I’m tempted to go the really hard way and just make a foam buck of that part of the dash/windshield interface and build a custom fiberglass housing that way.

Anyway, the display integration is not locked down yet and I have some work to do on that.



Unlike the display integration, the integration to the rest of the vehicle is pretty much locked down. A mishimoto oil filter spacer has two 1/8”NPT ports in it and they’re at a useful 90 clocking so they won’t be shrouded by the oil pan. If necessary, I can always drill and tap another pipe port if I want. My initial measurements suggest it should work quite well.

The RTD temp sensor can mount directly to the oil filter spacer and they’re probe will impinge on the oil flow. The leads are 10ft long, but because of the 1000ohm base resistance, the error from lead resistance is less than 0.3 degrees C. That’s acceptable to me and allows a useful two-wire run.

The pressure sensor I’m going to remote mount with an Umpco-style silicone P-clip in a location near the oil filter, then I will plumb the pressure sensor to the oil filter spacer with a short length of appropriate hose (Parker 836).

This keeps the pressure sensor and it’s long cantilever off the filter spacer, reducing clearance problems and potential cracking. It should also help the pressure sensor live a happier life of reduce vibration and lower temperature, since the sensor itself has a max temp of 130ºC, we want to move it off the engine a bit and leverage the fact that pressure sensor readings can be remote and still quite accurate on a deadhead oil line.

The pressure sensor will be wired with just basic two wire shielded wire. In truth, the 4-20ma format is already pretty robust to any noise (that’s why it’s used instead of straight voltage output, plus it has a “live zero.”) so wiring the pressure sensor back to the brain box through the firewall is also pretty easy— basically just zip tie it to existing harnessing.
 
As an industrial automation electrician i approve!

And here I am using electro-machanical VDO gauges for everything in my personal vehicles. I feel so simple minded.
I’m learning as I go. I’ve never done any arduino kinds of builds but I’m willing to break new personal ground given the payoff here. I know a little basic electronics, but I’ve never been a EE or a controls guy. And certainly I’ll need some agency assistance for the coding.

VDO was an option I considered along with STACK, and some other classic names in gauges.

All if them work. But they seem to me a bit too limiting and space-inefficient. And at the prices they command, they should have better transducers, especially the pressure gauges, which are too slow to capture any transients.

With the fast 1ms response of this Omega transducer, my “min/max” will capturing events as short as 0.001 seconds. I don’t think any standard oil pressure gauge will do that. Certainly not a mechanical gauge as the bulk modulus of the oil tube is will low pass filter almost all short transients.
 
Theres huge application for this in the failing GM ODO clusters from the late 90s and early 2000s.

I’m definitely a fan of rasbpi implementations. Also some sniffing you could do off the obd2 for things you don’t care to instrument yourself.

FWIW I’ve had good success with autometer gauges, notably their oem-match line.

Make sure you incorporate a manner to dim the panel at night.
 
This is a super cool project! And very resourceful! I work in this field and have toyed around with some similar projects. I have a couple of notes/suggestions:

1. Don't forget to ground the shield wire at only one end.

2. You probably already saw this, but you can buy your Dwyer pressure transmitter with a 1-5v output if you want to save yourself the step of converting it from 4-20mA.

3. The Raspberry Pi is a very cool way of integrating your instrumentation into a display. But it kind of sounds like you are making two projects here -- the first is monitoring your oil pressure and temperature with quality industrial instruments, and the second is making a cool Raspberry Pi gauge display. Which one of them is your primary project?

3.a. The logical next step here is to datalog through the raspberry pi so that you can actually capture those transients (i.e. some spikes are still to fast to display on your gauge).

One other suggestion, I have found that there is a lot of name-brand industrial instrumentation on ebay that's been used but is in perfect shape. Much of this stuff gets yarded out at plants which are being decommissioned and will never find a home because it's difficult to reuse anything electrical unless it's for spare parts in a plant that already uses that exact thing. There's also a lot of NOS stuff. I have bought a lot of used/like-new control panel components and instruments for other projects. If you have an idea of what you're looking for, you can get a lot of nice stuff for dirt cheap.

https://www.ebay.com/itm/127746024782
https://www.ebay.com/itm/358042711913
https://www.ebay.com/itm/293042679780

If you know what you're looking for you can find some really expensive process instrumentation on Ebay for amazingly low prices -- and I think OP must work in this field already, right @Hohn? Instrument technician or I&C engineer or something? Nobody knows anything 4-20mA unless you work in the field.
 
This is a super cool project! And very resourceful! I work in this field and have toyed around with some similar projects. I have a couple of notes/suggestions:

1. Don't forget to ground the shield wire at only one end.

2. You probably already saw this, but you can buy your Dwyer pressure transmitter with a 1-5v output if you want to save yourself the step of converting it from 4-20mA.

3. The Raspberry Pi is a very cool way of integrating your instrumentation into a display. But it kind of sounds like you are making two projects here -- the first is monitoring your oil pressure and temperature with quality industrial instruments, and the second is making a cool Raspberry Pi gauge display. Which one of them is your primary project?

3.a. The logical next step here is to datalog through the raspberry pi so that you can actually capture those transients (i.e. some spikes are still to fast to display on your gauge).

One other suggestion, I have found that there is a lot of name-brand industrial instrumentation on ebay that's been used but is in perfect shape. Much of this stuff gets yarded out at plants which are being decommissioned and will never find a home because it's difficult to reuse anything electrical unless it's for spare parts in a plant that already uses that exact thing. There's also a lot of NOS stuff. I have bought a lot of used/like-new control panel components and instruments for other projects. If you have an idea of what you're looking for, you can get a lot of nice stuff for dirt cheap.

https://www.ebay.com/itm/127746024782
https://www.ebay.com/itm/358042711913
https://www.ebay.com/itm/293042679780

If you know what you're looking for you can find some really expensive process instrumentation on Ebay for amazingly low prices -- and I think OP must work in this field already, right @Hohn? Instrument technician or I&C engineer or something? Nobody knows anything 4-20mA unless you work in the field.
1) I probably won’t use shielded wire for the pressure sensor because the 4-20ma layout is relatively immune to noise. I’ll probably just do a twisted pair of higher temp-grade insulated wire.

2) I chose the 4-20 on purpose, even though it complicates the implementation mildly via requiring relatively precise shunting and a voltage divider to accommodate the 3.3V max on the ADC input on the RasPi (I’m typing all that out every time, oy!)

3) I could datalog if I wanted, but I don’t want to look through reams of useless data when what I really care about it just a min/max memory. The way the code is setup, the min and max will be taken before any signal processing for a displayed value. So as the RasPi is polling the pressure data at 1khz, it’s performing a simple logic on each value as to whether it’s a new max or min. This is before the EMA average and the calculation of which value to display as the rendered value.

4) the main project is getting industrial quality instrumentation in place. The rest is just the necessity to make it accessible and useful.

5) Yes to Ebay, a I saved about $60 on the Omega PX119a by going that route.
 
Theres huge application for this in the failing GM ODO clusters from the late 90s and early 2000s.

I’m definitely a fan of rasbpi implementations. Also some sniffing you could do off the obd2 for things you don’t care to instrument yourself.

FWIW I’ve had good success with autometer gauges, notably their oem-match line.

Make sure you incorporate a manner to dim the panel at night.
I already have an OBD dongle that wirelessly pairs to my phone and I read the data via OBD-Fusion on my phone or iPad.
 
The last bit of parts needed for Phase 1 should be arriving tonight. Within the next few days I should have a "proof of concept" up and running on the test bench where we can verify basic functionality.

One detail I am particularly proud of is the precision resistance network I achieved.

The pressure sensor has a 4-20mA output. This requires a shunt resistor to translate that current into a voltage < 3.3V that the analog-to-digital converter (ADC) on the Raspberry can handle.

Rather than try to source a super-precise resistor of incredibly tight tolerance and paying massive shipping costs for a single resistor, I decided to take a smarter approach. I ordered a bulk pack of 1% 1k resistors (1/4w) for $4 from Amazon. Then I measured all of them and found the high and low values and notes exactly what they were with my DMM.

I then broke the shunting into two stages-- first, ~ 249ohm shunt (four of the lower-range 1K resistors in parallel) to get the current to roughly a 1V-5V range (common practice). Then I used more of the resistors to make a ~2:1 voltage divider that splits the 5V drop into ~3.33v and ~1.66v parts.

But because of the sorting and identification of the resistors, I'm slightly below 249 ohms shunt and my voltage divider has a 3.299V maximum voltage output to the ADC. Through my shunt and voltage divider, I was able to drop precisely 3.299V at 20ma. That's effectively a 164.95 Ohm resistor. You simply cannot source that resistor, never mind getting that precise value for $4 delivered!

In hindsight though, I still have the DMM uncertainty of 0.3% so the 3.3V Zener on the ADC to clamp excess voltage is probably the only certain choice. But since that corresponds to 150psi of oil pressure and there's only a 0.3% "overage" risk, I think overall the risk of blowing the ADC because my pressure signal is too hot is vanishingly small. I'm not going to spend the $9 to add a Zener to protect against such a low risk.
 
IMG_1838.webp



Initial prototyping is going. I got the Pico loaded with the software and it’s talking to my laptop. It successfully ran the “flash LED every half second” test script.

Testing the RTD revealed I simply don’t have a good connection to the RTD board (shown at top) so I’ll need to solder some wires to that tomorrow so I can get some good electrical contacts there. There are screw terminals for the RTD wires but I don’t have a small enough blade driver handy so I’ll mess with it tomorrow.

This is coming together better than I’d expected. More to come.
 
Well, we have liftoff! At least for the temperature indication. It took a LOT of debugging (did you know many USB cords don’t have data connectivity and are only charging cords? I do now.) I also ended up having to plug ahead with soldering some hooking wires to both PCB and castellated edge of the Pico because frankly the connections with header were much too unreliable and it wasn’t working.

In the clip below, I actually ran the software at a 1hz refresh rate but later testing showed a 5hz refresh is quite useful still because the sensor is slow enough it doesn’t jump around. Also, your brain can process 5hz pretty well actually. It turns out that 0.2 seconds is quite sufficient to read a number and react.

Of course, with the min/max functionality we’ll have in the end, you can actually go even faster and still catch a min or max. I personally thing there’s no value in going faster than 5hz. I might drop it down a bit. That’s the beauty of having a little Pico— it’s all programmable!

The RTD is much more precise and pro-grade than many cheap thermocouples. This particular model is also rated to 260C ambient temp (to withstand underhood temps) and can withstand high vibration. It is also quite accurate.

 
Soldering the Raspberry requires a technique that was new to me. I'm pretty good at the soldering I've done, but was nervous a bit about my lack of familiarity with this joint style.

The Raspberry has a "castellated edge" board-- basically the edge is scalloped, as if perfectly sawn along a line passing through the center of the row of holes. You then have to solder this edge to the board, effectively creating microcontroller "pins" from solder.

1775047977178.webp


You an see the far left pin has a small void from insufficient solder, I'll need to touch that up as I build out the board.
 
Sorry to say I have no updates on the pressure sensor testing. Since I can't trust my cheap breadboard I'm having to build out the actual PCB and it's taking longer than expected as I learn or relearn the intricacies of working with pin headers, JST vs Molex vs Dupont connectors and such.

But I managed to get the shunt resistor network placed, the buck converter (power supply), the RTD amp and some other critical PCB items locked down.

The bad news it's going to look like the cobbled project PCB and bird nest that it is. The good news, it will be inside a box and perfectly functional and nobody will care.


I decided to do the analysis to see just how good my temperature and pressure setup will be in its final form, calibrated as well as I can do at home.


Unit error (~±3σ)
°F0.05 °F
°C0.026°C
kPa2.6 kPa
PSI0.375


The pressure accuracy is certainly sufficient, but not particularly impressive. I would venture to say, however, that's still almost certainly better than about an off the shelf gauge you can buy in the Summit catalog.

The goal in engineering is always to have a "Spare" order of magnitude in your measurement system. So if I really care about a single PSI being accurate, I want 0.1psi in my measurement system. I'm not quite at 0.1psi accuracy for pressure, but honestly I don't feel like that's even close to necessary, especially when my display itself will not resolve below single digit PSI.

So at least as far as pressure measurement goes, I've achieved the goal of essentially bettering any off the shelf gauge you can get from the speed shop catalog. Not only in outright accuracy, but especially in response.

The temperature measurement with the RTD is where my setup completely crushes any off the shelf setup you're going to find.


Alas, for formatting purposes I've made the decisions to stick with integer values only. While it's very cool that my temp gauge would be accurate at 0.1C or less, in reality the extra resolution is not necessary or particularly useful, and it sort of undermines the ergonomics of having an quickly readable and intelligible display to use a decimal temperature value.

So I'll be sticking with 3 fixed digits for both temp and pressure, and using leading zeroes for values with less than 3 digits. Which means you sadly won't get to see my transducers strut their stuff at sub-degree accuracy, but I suppose it's nice to have the option.

This is where it's nice to have the ability to swap units, because degrees F is nearly twice the resolution of degrees C. Likewise, kPa is a pretty fine gradation of pressure (atmosphere is 101kPa), so even at idle I should have all three digits in use with kPa.


Bottom line: my oil monitor is almost certainly crushing off the shelf gauge setups in precision, accuracy, and resolution, but you might not really fully appreciate that from just viewing the display with a simple whole-integer value for what you're viewing. That's OK. Just know that you can trust what you see. That'll have to be good enough.
 
Back
Top Bottom