• Protip: Profile posts are public! Use Conversations to message other members privately. Everyone can see the content of a profile post.

Reprogram clock to display oil temp?

Joined
27 July 2007
Messages
7,587
Location
Denver, CO
Last edited:
As far as I can tell, what comtec did is not a reprogram. It is a hack as in hack out the guts and fit in the AFR display that comes with the wide band controller. That is a mechanical hack which just requires some dexterity to do well. Hacking the clock controller to display oil temp on the existing display would be a whole lot of work, if at all possible.

If what you want to do is 'hack' apart the clock and fit in a suitable display with a stand a lone controller to display temperature, that would be quite doable. I would suggest that rather than the Arduino, you might want to use something like a Teensy which is physically much smaller than the Arduino Uno (as in the link you provided) and more powerful to boot. All you need to do is find out the resistance specification for the oil sensor RTD you want to use and you should be able to use the code in that link you provided. You would need to pick a display to fit in the space and decide on color and all sorts of other aesthetic details. I suggest you check out Adafruit or Sparkfun to get a handle on the available displays and pick one that should be easy to fit. Adafruit and Sparkfun are good because they provide the libraries to drive the displays and typically provide coding examples to show how to do stuff.

I made this thing (I used an Arduino UNO because space and processor speed was not a constraint) which I used to measure 4 EGTs when I was balancing fuel trims between cylinders - obviously not on an NSX.

EGT measurement.jpg

You might want to think a little bit about what else you might want to do if you are hacking things apart because even the most basic $15 one board controller has the horsepower to do a lot more than just display a single temperature. As in my case you can easily display 4 temperatures or any 4 analog quantities if the display physically fits in the clock housing (voltage, more than one temperature, AFR, ....). If you can't get a multi line display to fit, you could have lots of inputs; but, set the controller to scroll through the values sequentially. You could also repurpose the buttons on the clock to allow you to manually scroll through the various inputs. With some more skill and coding effort, you could program alarm limits for the inputs and have the display jump to whatever input was exceeding the alarm limit and if you are using a multicolor display have the display go red to induce panic.

Or you could just hack open the clock and use an Arduino Uno and display the oil temperature.
 
[MENTION=26435]Old Guy[/MENTION] thanks so much for your response! Yes, I now realize [MENTION=16180]comtec[/MENTION] just gutted the clock and put a LED display behind the visor for his AFR. I initially thought he had figured out a way to reprogram the OEM clock display. I like your idea with the Teensy and mounting a small LCD display behind the clock visor.

This display looks perfect:

https://www.adafruit.com/product/399

It seems like the Teensy 2.0 would be the best option, as I'm really just doing a lookup table. The AEM temp sensor has a published voltage table:

yogQAgw26QgfQKX_Zb5EgfO1KHucbOWKY-UnJyhZkFROs5S-eS3ln6vS6CqeWymntKJCXNSduGfihw84GwCjj8inQbKduW4FWLX5IweAF1XZdFwttRiwe2uAnFu6OyN3C-dW0kKxkav5h5bxp2k4xvEw00ldq8EnAj1jcJZ0Kzsv-oscANwyZn_lAcuWC1ySfCA7e_UtM6BVDsKBllVBp8yVD1xNXciXDFD0V8_gkzxEpaMCdHfABnQCgEBgi3OInbbcJ_8_Ye-khO1d9i1vpZz8PVHtykMmdJvpjiQMpc_hV5k9TOiCzaEvOS4NNfH8kLJzI1iqKgdRngj0tW-BDHRcEva1YUBgV_m4yYoI-Gqk9kmw1RIFtzYd8VZTVxRIgRdcqIsf9elW4dlZlJU9miJ5tXotCU3TcXE8dleEhqTJlSrKxHOChQVoir3Vjfp5KH3yiX_7DK3RQDO-PatnycCS0cdacnmis73bY3LywPMPAK8Qp3qjBXHgCtuZEbat4GHNjhCxggWyWbnyvWMtMEuw6sULI8bAHbYaQCBFIDr3un-wQgAVAxzYdG_PK3Q71XndYT1Wh2dzcoDTtCPdL21qLhqTSBkucSFE2279wAeGX1iN06jWQcrjHvWVaaQ7kQybAmiYJ7ijPbCluS-Z9KTt9jTNMc97RoBpS9CT15_lroMQpjlfkGFs_z1xD0CXSStJZZOx0LenIiuSFY-pwaeo=w734-h500-no


Thus, it seems the AEM is really just a thermistor that varies its resistance as the temperature changes. But it also appears to convert that resistance change to a voltage output using a 2.2K "pullup" resistor, presumably in the 5V line? Couple things I still need to figure out lol. Assuming I can get the Teensy microcontroller to "see" the changing voltage from the sensor, I can program the above table into the Teensy as a lookup table, with a display of "OIL TEMP = XXX.X F" to the Adafruit LCD. The tougher part is programming a linear interpolation between table values so I can see the "exact" temp values. Considering the last computer programming I did was on my Commodore 64 in the 1980's, I've got a lot to learn! But I think this is doable. Some initial questions:

Where does the pullup 2.2K resistor go? I think in the 5V line to the sensor? Pointing toward the sensor or the controller?
The AEM sensor has two wires in the harness- a ground and a 5V. It must be then that the 5V current must come from the controller, pass through the thermistor and then go to ground through the black wire. The controller must be reading the voltage draw from the thermistor somehow even though the sensor is "pulling" current away from the controller.
Where to find a 5V source for the controller on the car? The OEM clock is presumably 12V.
 
That Adafruit display would be nice - if it fit. The Adafruit display window is 1.1" high and there is a bezel around the window and there is a backing circuit board which is yet a bit larger. I had a look at my clock and I am thinking no-go if you want to fit it behind the existing clock opening. You will need to pull the clock apart and measure the window dimensions and space behind the window to assist in selecting a display.

I thought the Teensy 2.0 was out of production; but, I see that it is still available from PJRC. The 2.0 would have the processor speed and memory to do the job just fine. Its only limitation might be the number of I/O pins if you decided that you wanted to go big and display more than oil temperature (you are sure you don't want to do AFR?). The one 'ick' factor is that the Teensy lives on 5 volts which means that you will need a small power supply to provide it with 5 volts. Not a significant problem; but, it does mean a separate little piece to deal with. Some of the Arduino boards are tolerant of much higher supply voltages. I know that people have supplied Arduino boards directly off of the car 12 v system and the on board power supply on the Arduino has an external 5 volt bus which would work nicely to supply the reference voltage for the RTD. However, car 12 v systems can run 14 v or higher which is probably pushing your luck on the Arduino's 12v upper limit. Anyway, not a material impediment. Something like this would probably do the trick for power

https://www.amazon.com/Regulator-DROK-Converter-Step-Down-Transformer/dp/B0758ZTS61

and the power supply can supply the regulated pull-up voltage for the RTD.

Yes, the AEM sensor is just an RTD (resistive temperature device) whose resistance varies with the device temperature. You convert the variable resistance by connecting the RTD in series with a fixed resistance (the pull-up resistor) and then connecting the two resistor to a fixed voltage supply creating a simple voltage divider circuit when you measure the voltage across the RTD. The equation for Vout versus Rrtd is

Vout = (Vref)(Rrtd)/(Rfixed+ Rrtd)

At 0 C with the 2200 ohm pull up resistor and a 5 volt reference voltage the 37500 ohm resistance of the sensor will give you an output voltage of (5v)(37500)/(2200 + 37500) = 4.723 volts (just like AEM says). The RTD is non linear in its response so you can fiddle with the Rfixed a bit to give you better resolution in the temperature range that you are most concerned about.

You could do a look up table; but, that would be computationally more intense. Every time you do read you have to start at one end of the table with a line by line less than / greater than search to find the line with your voltage measurement and you voltage will never match the line values so you will inevitably have to interpolate between lines to get a temperature measurement. The much easier way to do this is to use the Steinhart - Hart equation that is referenced in that
Arduino link. The Steinhardt - Hart equation is looking for resistance in and gives you temperature out. If you massage the Vout equation above a bit you get:

Rrtd = (Vout)(Rfixed)/(Vref - Vout)

At 0C you measure a voltage of 4.723 volts directly across the RTD, plug that into the above equation and you get Rrtd = (4.723)(2200)/(5-4.723) = 37,499 ohms after a little rounding. You plug the calculated resistance into the Steinhart - Hart equation which gives you the temperature for that resistance value. Computationally it just requires two lines of code - easy peasy! You will have to populate the coefficients for the Steinhart - Hart equation which requires a tiny bit of number crunching (details below); but, you only need to do that once unless you change the sensor to an RTD with different characteristics.

https://en.wikipedia.org/wiki/Steinhart–Hart_equation

For the curves that describes the characteristic of an RTD, picking 3 data points from the AEM table will work. Picking one data point at each end and one in the middle of the range will work. If you want more accuracy in the 50C to 100C range you might pick 50C, 75C and 100C; but, then temperatures outside of that will likely have more errors as you get further below 5 C and further above 100C.

If you are visual, I can scratch down a crude single line diagram showing the connections. Most of the code to do a single temperature measurement already exists in that example you linked in your first post. The coding that remains will depend on the final display that you want to use.

If I were doing this on an ECU that also happened to be driving the display, I would put some filtering and protection on the input measuring the RTD voltage just to avoid electrical nasty stuff getting onto the controller board and possibly causing resets of the controller. Since this is not a mission critical device, I don't think those additional bits are really critical.
 
Last edited:
Think about how bright the display is. For something that changes slowly like oil temp I’d probably think about one of Adafruit’s eInk displays. They have one just over 2”. It’s possible to make a reasonable looking replacement for the clock, like I did at the end of this thread: http://www.nsxprime.com/forum/showthread.php/183741-my-Zeitronix-ZT-2-display

The Teensy is perfect for this. Use a current version (3.2). I had plenty of space for that with a circuit board. You should use an op-amp to interface with the thermistor.

But the perfect display is pretty elusive. Character displays are not my favorite. There are some bright LCDs and even better would be a transflective LCD but those are hard to find in small sizes and easy-to-use forms.
 
But the perfect display is pretty elusive. Character displays are not my favorite. There are some bright LCDs and even better would be a transflective LCD but those are hard to find in small sizes and easy-to-use forms.

Yes, I think that figuring out the display is the biggest part of this exercise. The electronics and software is relatively minor. If you are prepared to alter the form factor as you did with your replacement housing you open up a lot of options for display. If Honcho wants to retain the external look of the clock for his Type S project that constrains the options.

This might be a possibility to fit within the existing clock module.

https://www.sparkfun.com/products/14606

The size looks to be a possibility (about 1.5 cm tall). Unfortunately it does not appear to be a stock item so you would have to contact Sparkfun to check availability. I haven't investigated in detail; but, display coding looks to be a more involved than what I did with my relatively simple 4 line EGT display.

This one is probably too small and its greyscale so visibility may not be so good
https://www.sparkfun.com/products/14048

Another maybe too small option which again is mono chrome (and out of stock).
https://www.adafruit.com/product/931
 
I think that LCD may prove better in sunlight. I’ve been planning to change a resistor in my OLEDs to increase brightness. Just hasn’t been a high priority.

I agree about this being a bit difficult to stay within the original housing for the display.
 
Back
Top