 # Oil temperature sensor

This is an updated post.

I’m working on an oil temperature thermistor sensor (Part Number 965-531) for rotax 912uls.
I cannot find a data sheet for the part, I only have a graph with resistor to temperature values in the attachments.
I want to interface it with the Arduino, so I can process the data. I followed a tutorial for thermistors from adafruit.
The only difference I can find between the thermistor they are using and mine is the series resistor and the thermistor values(1000ohms).
I used this website to calculate the beta value (NTC Thermistors - Calculate Beta Values | Ametherm)

The values I used

Resistance 1 = 1000
Resistance 2 = 20
Temperature 1 =20
Temperature 2 =160
B = 3548.15

I’m using a program called proteus to simulate its operation with arduino, I have attached a picture at max temp and the results seem to be correct.
Here is the code I’m using

``````// which analog pin to connect
#define THERMISTORPIN A0
// resistance at 25 degrees C
#define THERMISTORNOMINAL 1000
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT  3548
// the value of the 'other' resistor
#define SERIESRESISTOR 1000

uint16_t samples[NUMSAMPLES];

void setup(void) {
Serial.begin(9600);
analogReference(EXTERNAL);
}

void loop(void) {
uint8_t i;
float average;

// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++) {
delay(10);
}

// average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;

Serial.println(average);

// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);

float steinhart;
steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
steinhart = log(steinhart);                  // ln(R/Ro)
steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart;                 // Invert
steinhart -= 273.15;                         // convert to C

Serial.print("Temperature ");
Serial.print(steinhart);
Serial.println(" *C");

delay(1000);
}
``````

I am new to arduino and would like any input.
Thanks
Jason

Can you post a link to datasheet for the sensor? Edit your post to use code tags for the code please, as
explained in the how to post sticky threads…

What is the purpose of RV1 in the circuit? It carries no current.

A good place for a "741" opamp is in a display cabinet of a museum.
Totally unsuitable here.

Why an opamp. Sensor looks like a standard 1k@25C thermistor.
Use a pull up resistor with the thermistor with a value of the thermistor in the temp range of interrest.
So you have max resolution at ~80C. A 100ohm resistor will do.
Use the example thermistor code you can find in the learning area of this site.
Enter 1000ohm as thermistor value, and 100ohm as fixed resistor value.
Leo..

Connection for the OpAmp is anyway wrong.

The reading should be done in between R5 and the thermistor, and indeed can go directly to the analog in.

Then you need to use the B-coefficient formula to calculate the temperature, not a simple analog mapping as the response is anything but linear (as you can see in the graph you posted). Adafruit has a good write-up on thermistors.