Reading a poti value in a voltage divider, the hard way

Hello folks,

Currently I´m working on a small project to control a fan depending on coolant temperature in a car/bike.
To do this I´m reading a thermistor in a voltage divider configuration. For calibration (or setting the range in which the measurements need to be the most accurate) second resistor in the voltage divider is a potentiometer.
To this point this is nothing new or fancy.

Now comes the tricky part I need a solution for:
Currently I need to tell the arduino about the value of the calibration pot via the software to calculate the measured temperature.
So if I change the thermistor to another one I need to set the calibration poti AND change the program.
If I would be able to measure the value of the calibration poti with my arduino I wouldn´t need to flash a new program.

Is there a way to measure the resistance of the calibration poti without interfering with the voltage divider?
I thought about using a dual gang pot, but there is no SMD version and my space on the pcb is very limited.

Thanks in advance, guys! :grinning:

I do not think that there is a way; the only way I can think of is to use a switch to select either a known resistor or your thermistor. After calibration, you switch to the known resistor, let the Arduino calculate the value of R2 and store it in EEPROM. Next switch back.

If you store the value of R2 in EEPROM as described, you do not need to flash again. Alternatively, you can update the value using a terminal program and store that in EEPROM..

No, you just need to adjust the potentiometer. Compare the measured values with the real expected values and adjust the pot until they match again. That's all.

Unless the change in the thermistor is so big that it's out of the potentiometer range. But I suppose that it will be just a small adjustment.

At the end you are multiplying the read voltage by a fix factor in your code, right? You don't need to change that factor, readjusting a bit the pot will also correct the deviation.
Assuming the change in the thermistor will be relative small.

No problem if you keep the temperature (thermistor resistance) in a known state for calibration.

If that's not possible you can use a second calibrated temperature sensor to get the temperature of the thermistor, or use a DMM to get the pot value.

Hey all,
Switching between the thermistor and a known resistor for measuring the potentiometer seems like a good idea. Is there a way to do this with the arduino, so I don´t need to use a physical switch? I have plenty of free pins, but not much space on the pcb.

While reading the other replies I discovered a new problem.
My goal was, that I can use different thermistors without changing the program.
But the formula to calculate the temperature will be different, too.
The idea was that you can put the fan controller in any car (which will all have different NTCs as temperature sensors) without changing the program.
I don´t think this will be possible when I think about it.

My calculation for temperature currently looks something like this:

  float value_raw = analogRead(tempPin);
  //printValue("Analogwert: ", value_raw);

  float value_u = value_raw * 5/MAX_ANALOG_VALUE;
  //printValue("Spannungswert: ", value_u);
  
  float value_r = ntc_nom *(5/value_u - 1);
  //printValue("Widerstandswert: ", value_r);
  
  float value_temp = -29.38 * log(value_r) + 275.54;
  //printValue("Temperatur: ", value_temp);

And what about jumpers? you could set the type of thermistor and eventually a calibration mode.
With 2 jumpers you would have 4 combinations, with 3 jumpers, 8, etc.

That´s a possibility, I think. At least I could program some known thermistors and chose which one to use via the jumper.

I think I got a little ahead of myself and all the things that would be "nice to have" :grin:
I was looking for the holy grail, where you just have to set one potentiometer and no matter what thermistor it would work. And thats not possible....

Here´s a picture of the PCB, as you can see it´s a little packed and there a still some features missing.

You could also think in a digital potentiometer. You would set the sweep position from the microcontroller, so you would always know it.

But I don't know if it would help. You would need anyway some method to calibrate or detect the thermistor range or behaviour programmatically, to adjust the pot position and store the new value in the EEPROM. I don't know if that would be possible.

Use an analog switch. SOT-363 package should fit
74LVC1G3157DW-7

Here's what I don't get.

How accurately do you think that you need to measure the temperature? If you swap the thermistor for another of another type, then the temperature coefficients will be different and you will have to change your software regardless of calibration value.

If you swap the thermistor for another of the same type (maybe the original broke), then you may be off a few tenths of a degree. However that should make absolutely no difference in an engine cooling application. In most such cases, calibration wouldn't even be needed since the default characteristics of the thermistor would be fine.

So I'm wondering exactly what the problem is?

I think the the accuracy wouldn´t be that bad if I just switch to a new one if the old one broke.
If the nominal value of a different thermistor is 10k instead of 5k (just an example), then it could make a difference. A small one at least.

But yes, as you said the coefficients will we different and I don´t see a way to solve this without programming new values when changing to a different thermistor.

Another way of reading my comment is, "what problem are you really trying to solve and is it worth solving?"

My initial problem was to just measure the pot within the voltage divider. That got solved with the switching solution.
But as I wrote a few posts ago, I didn't consider the problem with the different coefficients. I wrote that this can't be solved without programming.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.