Accurately measuring oil temp in car

Hello!

I’m working on a project to get an oil temp display in my car (1999 BMW e46). My plan is to install a temperature sensor (thermistor) in the oil pan and then wire it up to an analog in pin using a voltage divider. I’ll use the analog signal to calculate resistance, and then calculate temperature from that using a best fit curve (see pic), so it’s really important that I can accurately calculate the resistance of the thermistor.

I’ll then display the temperature using an led matrix display. Overall this setup will probably pull about 2 amps. In case it’s useful, engine operating temperature is around 100C.

The issue I foresee here is the level of noise in the car’s ground. I don’t see a way around grounding everything to the body (the regulator’s ground passes straight through to the car), so I imagine my analog signal will be very noisy and almost useless. Before anyone suggests it, I’ve already tried to read oil temp from OBD2 and CAN-bus - it’s not broadcast over either of those :frowning:

How can I mitigate this problem? I don’t want to have to run this off a 9v battery :roll_eyes:

EDIT: Would this (admittedly expensive) isolated DC converter work? Assuming I’d then ground everything to it.

Schematic
Temperature sensor specs & best fit curve

Why are you imagining problems before you can even know if they exist or not. If you don't use a car body ground, except for ONE point, perhaps you won't be bothered by noise. Use shielded wire for all runs longer than about 1 foot.

Paul

Paul_KD7HB:
Why are you imagining problems before you can even know if they exist or not. If you don't use a car body ground, except for ONE point, perhaps you won't be bothered by noise. Use shielded wire for all runs longer than about 1 foot.

Paul

Paul,

Thanks for the response. I should have mentioned that I've worked with analog signals in this car before and encountered this issue. Admittedly I'm no electronics expert though. Can you explain how grounding to a single point on the car will help with noise, ground loops, etc.?

Thanks

Power Arduino through a buck converter which costs 1% of the mouser unit. Ground the Arduino on the buck converter.

Use a temp sensor that has 2 wires (not grounded through mounting point), twist the wires coming back to Arduino to help with any interference. Don’t run the wires near or parallel with any power wires or by the alternator or anything noisy. Ground the sensor on the Arduino board, and use a simple low pass RC filter for the lead going into the analog pin. I use 100k resistor and 0.1uF for filter almost same situation worked great.

If you ground somewhere else there may be resistance or a differential. for a 2wire resistance based sensor it’s best to ensure the ground is same as Arduino. Both for accuracy and conducted noise.

Choose a resistor for your voltage divider as close to the resistance of temp sensor at the expected operating range. ADC reads 1024 steps through the range of o-5v and resolution is best from a thermistor when sensor resistance is same as reference. Should get close to 0.1c resolution depending on beta coefficient of sensor.

Your trendline formula is close but not accurate. Calculate your temp using Steinhart formula. Your LCD is from Adafruit, she has a good write up on how to calculate temperature from a thermistor on Arduino. You just need 3 data points from resistance curve to get your beta coefficient. This looks like you have plenty data points from the sensor vendor. Once you have beta coefficient you can calibrate your sensor by measuring yourself a single data point in steady state and use that for your nominals (reference lady adas write up for 25c 10k thermistor). You can further calibrate your calculation by measuring the exact resistance of your reference resistor for the voltage divider rather than just calculating based off the resistor rating.

Looking at your resistance curve I’m not sure you have the best thermistor chosen. For your operating range of 100°C, maybe something that is around 5k ohms at that temperature, which is where most coolant sensors are.

I don't see any point in measuring oil temperature.
It will change with varying outside temp and workload.
All well and good to have the meter reading to the "n-th" degree BUT.....
..............how will you know what is right or wrong..??
Temp could vary 20 or 30 degrees but really tells you nothing.
Far better to monitor oil pressure as these values are well known AND use alarm rather than a gauge as it is more readily noticeable.

Holy crap. TheMonkey thank you so much for the information! I have a couple questions if you don't mind.

TheMonkey:
Power Arduino through a buck converter which costs 1% of the mouser unit. Ground the Arduino on the buck converter.

Fantastic! I love not spending money. Is there a reputable brand of buck converters? There's a lot of them on ebay but I'm doubtful of the quality.

TheMonkey:
Looking at your resistance curve I’m not sure you have the best thermistor chosen. For your operating range of 100°C, maybe something that is around 5k ohms at that temperature, which is where most coolant sensors are.

I'm having some trouble here. It seems my temp sensor selection is is pretty limited for 3 reasons. 1) Most sensors are 1 pin and thus are grounded by their threads. 2) Most sensors are OEM replacements so they don't have associated datasheets to create a temp curve. 3) My oil pan drain plug is M12X1.5 threaded, which means the temp sensor either has to have those threads or smaller (for which I can use a thread adapter). Many temp sensors have 3/4" npt threads which are simply too big to fit.

All the temp sensors I can find that fit those 3 criteria have nearly identical resistance values at 100°C (~200Ω). Do you know of one specifically that has the specs you mentioned? What's the benefit of having higher resistance at operating temp?

Thanks again for the help. I really appreciate it!

I question why you are wanting to put a sensor in the oil pan drain plug hole. That is probably the first place that will be damaged by road debris. I am not at all familiar with BMW engines, but is there not a port available somewhere near the oil filter?

Paul

Paul_KD7HB:
I question why you are wanting to put a sensor in the oil pan drain plug hole. That is probably the first place that will be damaged by road debris. I am not at all familiar with BMW engines, but is there not a port available somewhere near the oil filter?

Paul,

I agree. The oil filter housing would be a preferable location for sensor. However, the port you describe does not exist. Here's an exploded-view diagram of the OFH on my car. The only ports that exist are taken up by the OEM oil temp and pressure sensors (#13 & #12). I do not want to tap into the OEM temp sensor because I don't want at all to mess with the signal the ECU gets. I've also heard oil distribution blocks don't work well for temperature sensors (as opposed to pressure sensors) as fresh oil doesn't cycle through often enough.

If you have an idea of how to get my own temp sensor in the oil filter housing, please let me know!

iron_swan:
Paul,

I agree. The oil filter housing would be a preferable location for sensor. However, the port you describe does not exist. Here’s an exploded-view diagram of the OFH on my car. The only ports that exist are taken up by the OEM oil temp and pressure sensors (#13 & #12). I do not want to tap into the OEM temp sensor because I don’t want at all to mess with the signal the ECU gets. I’ve also heard oil distribution blocks don’t work well for temperature sensors (as opposed to pressure sensors) as fresh oil doesn’t cycle through often enough.

If you have an idea of how to get my own temp sensor in the oil filter housing, please let me know!

I see! All parts there are under pressure. The only path would be to drill and tap the M14 bolt, #11, and screw in a small sensor. But that would be kind of iffy under the oil pressure.

Are you opposed to pulling the oil pan and silver brazing a nut to the side so a threaded sensor can be screwed in there where it will be covered by the oil?

Paul

I needed oil temp for a 5 inch roller bearing, holding a 5 inch shaft for a shredder driven by a 600 hp electric motor. Needed to know when the bearing started to fail to shut things down so we would not have the bearing blow up and hurl shrapnel and maybe kill or injure someone.

Drilled a hole part way through a 3/4 inch pipe plug from the outside - left about a 1/8 inch wall and epoxied a sensor into the plug - worked great

Paul_KD7HB:
Are you opposed to pulling the oil pan and silver brazing a nut to the side so a threaded sensor can be screwed in there where it will be covered by the oil?

Yeah I have to say I am opposed to that. I don't think I have the skills or tools to drill into my oil pan. Makes me generally uncomfortable haha.

However, based on your suggestion, I believe your concern about a drain plug sensor is misplaced. My oil drain plug is actually not vertical, but horizontal on the side of the pan(#3). So I think putting a sensor there would accomplish what your drilling idea would.

Go for it!

Paul

Take a look at the resistance curve that you shared and you’ll see how steep it is at 100°C. That means that very small changes in resistance are big changes in temperature. Tolerance stack on temp accuracy will be happier with a flatter curve at operating temp.

I used a couple of these sensors recently and shared the specs in the comments on Amazon. 1/8 npt. See link at bottom. Can’t figure url embed from phone.

You don’t need manufacturer data to figure the curve. Get 3 good data points yourself with an accurate thermometer and you can calculate the beta coefficient. That one coefficient tells you the curve shape. Then you only need nominal temp and nominal resistance. This is basically the Y axis. Curve goes up and down. Even with manufacturer spec, this is where you can calibrate an individual sensor. Most thermistors have a spec of nominal resistance at 25*c. But that nominal spec can be any single point on the curve to determine where to shift it on the Y axis.

For the buck converter I’m not sure how to best select. I have just bought basic converter that pops up in front of me. The kind that is postage stamp size and you solder jumper in for desired voltage. I have not had trouble, they work good for me.

When I put an oil temp sensor on my 61 Pontiac like 10 years ago, I think I used an o2 sensor bung and welded it to side of pan at bottom. Those are easy to find. 3/8 npt thermistor is a bit more common.

I would absolutely never recommend it, I just found this amazing... many years ago at Baja1000 a guy punctured his oil pan. He JB welded a peso coin over the hole and it worked and did not even seep lol. Who would of thunk?

50k ohm at 25c, beta 3892, use 5k resistor:

Universal Oil or Water Temperature Temp Auto Gauge Sensor Sender Probe 1/8 NPT Amazon.com: Oil Water Temp Temperature Auto Gauge Sensor Sender Probe 1/8 NPT Universal: Industrial & Scientific

Attatch sensor to dipstick
Heat shrink entire lenlength

Buy external oil filter adapter.
Install sensor on pipe
Lots of variations of adapters.

I’m not sure why so many comments about where to put your sensor. The sump is absolutely conventional. You. Can put it somewhere hotter and might be useful or better but that is different information and different set of rules than conventional oil temp info. Biggest concern is if the sensor hangs down and will get buggered, then a bung welded on side is best.

If plug is to the side like you mentioned, you are on your way. Plenty of adapters to fit 1/8 npt sender.

https://www.speedhut.com/ecommerce/product/1399/Metric-Adapter,-1-8-inch-NPT-Female-to-M12X1-5-Male,-for-Pressure-Senders

Is your e46 for racing or a project car?

About 10 years ago I pulled an e24 out of a yard that deserved some love. That’s the 635csi also known as the ‘shark’. Euro car with the M90 motor. Very cool. but the injection system had a flapper door with spring in the intake to measure airflow which sucked (or didn’t suck enough lol). So I put in MAP based fueling. I was trying to help the megasquirt designers develop a product called ‘sequencer’ which didn’t come to life because the MS3X prevailed for sequential fuel and ignition. But 10 years later still runs great on the beta unit sequencer. I put in GM D585 coils on each cylinder and I will tell you that the ignition upgrade woke up that motor more than getting the flap door out of intake. I was able to open the plug gap quite a bit. Couldn’t believe how much that improved. Fun project, really enjoyed working on BMW.

TheMonkey:
Is your e46 for racing or a project car?

Neither! It's my daily driver but I love to tinker. It's a fantastic car and runs great, but it only sends coolant temp to the gauge cluster. Oil temp is much more useful for knowing when the engine is at optimal temp - I want to know when I'm in "spirited driving" mode :wink:

TheMonkey:
About 10 years ago I pulled an e24 out of a yard that deserved some love. That’s the 635csi also known as the ‘shark’. Euro car with the M90 motor. Very cool. but the injection system had a flapper door with spring in the intake to measure airflow which sucked (or didn’t suck enough lol). So I put in MAP based fueling. I was trying to help the megasquirt designers develop a product called ‘sequencer’ which didn’t come to life because the MS3X prevailed for sequential fuel and ignition. But 10 years later still runs great on the beta unit sequencer. I put in GM D585 coils on each cylinder and I will tell you that the ignition upgrade woke up that motor more than getting the flap door out of intake. I was able to open the plug gap quite a bit. Couldn’t believe how much that improved. Fun project, really enjoyed working on BMW.

I love the look of those old BMWs. That's so cool that you have your 6er up and running!

TheMonkey:
I’m not sure why so many comments about where to put your sensor.

simple,
you can connect to some places in a few minutes without modifying any part of the car and get the readings you want.
the dipstick is a no-brainer.
get readings fast.
totally isolated wiring
sensor is in the center of the mass
easy to install, easy to remove
easy to test, alter, swap, etc
A remote filter plate should be under $25 and offers a place to install without too much modification.
it offers testing, isolated wiring, replacement, removal, access, all from above the motor.
Removing the pan plug requires draining the oil for any modification and also requires one to use the car ground.
Welding a new bung on the pan means drilling the pan for the hole. a great permanent solution.

The other reasons to use the dip stick or oil hose is that you can use a sensor that is much more resistant to the spurious engines noises and use a much higher sensitivity sensor.

the oil hose also opens the possibily of a oil quality sensor. not sure what quality.... but just saying.

dave-in-nj:
sensor is in the center of the mass

This part is interesting. Although I don't suspect that the plug sensor will read any different.

But for simplicity, if it were me, the 2 wire sensor and adapter I linked would be installed in minutes with no modifications. The dipstick would require fabrication and a lot of consideration how to fasten it so the wired probe does not come loose and get caught up in the crank. Be nice if someone made a thermistor built into the dipstick but the wires out the top would challenge my OCD lol. Also, having a length of the wires submerged in the hot bath may or may not affect resistance?

Y should be able ot get a used dipstick and heat shshrink to the dipstick.
Tale wires that make you concerned
But vet readings and tests.
Personally if i was young enough to do motors i would drop the pan and weld in a new fitting.

The edges of the pan will chill the oil in rain or snow... well we will never have snow again after 2020 according to the global warming crowd.......

The engine drains to the top of the fluid the sump pulls from the bottom.