Multiple thermistors/voltage dividers interfering

After hours of searching this forum and with Google I'm giving up and asking the great minds directly!

I'm working on a project to control my pool solar water heater with the Arduino (Diecimila) by replacing the existing solar controls. This consists of two 10K thermistors, one in the air/sun, and the other in the water pipeline. It's part of a bigger project to see the world around me - ie, a bunch of DS18B20 sensors and a photocell to see how bright it is outside. Almost everything works fine hardware and software wise, except the analog inputs of the thermistors and photocell.

Maybe it's my lack of electronics experience, but I'm finding that the voltage divider circuit/hookup that works for a single analog input works fine, but adding one or two more and they interfere with each other. As in, if I cover up the photocell then it affects the temperature read from the thermistor.

Am I making an obvious mistake? Any help would be greatly appreciated! Even if it's to send me to a specific web page elsewhere.

The important part of my circuit:


Imgur

And a snippet of my code:

int photocellPin     = 0;
int airThermistorPin   = 1;
int waterThermistorPin = 2;

void setup(void) {
  // initialize inputs/outputs
  pinMode(photocellPin, INPUT);
  pinMode(airThermistorPin, INPUT);
  pinMode(waterThermistorPin, INPUT);
  
  // start serial port
  Serial.begin(9600);
}

void loop(void) {
  // Several Serial.print() commands are used between these reads
  // to let me know what the values are
  photocellValue = analogRead(photocellPin);
  airThermistorValue = float(Thermister(analogRead(airThermistorPin)));
  waterThermistorValue = float(Thermister(analogRead(waterThermistorValue)));
}

double Thermister(int RawADC) {
  double Temp;
  Temp = log(((10240000/RawADC) - 10000));
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;            // Convert Kelvin to Celcius
  Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
  return Temp;
}

Thanks in advance for any help!

Have you tried the code without using the pinMode definition in the setup? You don't need to do this as they are set up for using analogue from the start.

When I was looking at LEDs as a light sensor I noticed this effect as I was constantly swapping between input and output on the analogue lines.

Its not just the heat of your hand warming up the thermistor when you cover the LDR with it ? :smiley:

Thanks for the suggestions. I tried the code without pinMode definitions without any change, and no, the heat of my hand isn't affecting things. I've stripped things down to the bare minimum and beginning to suspect there's a discrepancy between my hookup diagram and reality :frowning: I'll post again once I've gotten some more troubleshooting done.

Boy do I feel silly. It turns out that I had everything wired up correctly, I was just a victim of speed: I copy and pasted too much. I had "waterThermistorValue" as the pin to read from when it should have been "waterThermistorPin"!

I did learn a thing or two along the way while troubleshooting that I thought I might share for other newbs:

All 6 analog inputs "float" to a seemingly random value unless they're grounded or fed actual input. If you give one pin an input then the remaining unused pins will have a value similar to that one used pin. If you have more than one pin used then unused pins seem to choose a value similar to one of your used pins.

A quick sketch I used to see what was going on:

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

void loop(void) {
  Serial.print(analogRead(0));
  Serial.print(", ");
  Serial.print(analogRead(1));
  Serial.print(", ");
  Serial.print(analogRead(2));
  Serial.print(", ");
  Serial.print(analogRead(3));
  Serial.print(", ");
  Serial.print(analogRead(4));
  Serial.print(", ");
  Serial.println(analogRead(5));
}

Thanks everyone :slight_smile: