analogRead always returning 1023

I've been trying to get a thermistor reading but despite all my best attempts, I am always getting 1023. I have tried 3 different thermistors, 2 different Unos (and different analog pins) as well as different breadboards, wires, and 10k resistors. No matter what, I've tried, the results are the same.

This is the wiring I am using (taken from Adafruit) :

I've also tried putting the 10k resistor between the thermistor and ground.

Here is the code sample I'm using:

#define SERIESRESISTOR 10000    
#define THERMISTORPIN A0 
 
void setup(void) {
  Serial.begin(9600);
  pinMode(THERMISTORPIN, INPUT);
}
 
void loop(void) {
  float reading;
 
  reading = analogRead(THERMISTORPIN);
 
  Serial.print("Analog reading "); 
  Serial.println(reading);
 
  reading = (1023 / reading)  - 1;
  reading = SERIESRESISTOR / reading;
  Serial.print("Thermistor resistance "); 
  Serial.println(reading);
 
  delay(1000);
}

I'm sure it's something horribly obvious that I am missing, thanks.

Hello

Try removing this statement:

pinMode(THERMISTORPIN, INPUT);

Analog pins are analog inputs by default. Using pinMode on them configures them to work as digital inputs.

Regards

Ray

Take you meter and measure just the sensor's resistance at ambient temp and tell us the value.

Hackscribble:
Hello

Try removing this statement:

pinMode(THERMISTORPIN, INPUT);

Analog pins are analog inputs by default. Using pinMode on them configures them to work as digital inputs.

Regards

Ray

I had originally tried without that line and only added it in when I was troubleshooting. Removing it makes no difference.

retrolefty:
Take you meter and measure just the sensor's resistance at ambient temp and tell us the value.

~9.29

ohm or kilo ohm or mega ohm ?

k?

Use your multimeter to measure the voltage between the analog input pin and ground. What do you get?

shouldnt your statement: #define THERMISTORPIN A0 be:
#define THERMISTORPIN 0

jremington:
Use your multimeter to measure the voltage between the analog input pin and ground. What do you get?

If I'm doing this right (been 15+ years since I've done any electronics work) 4.95V is what I'm getting from the multimeter between analog and ground.

Ed1960:
shouldnt your statement: #define THERMISTORPIN A0 be:
#define THERMISTORPIN 0

Wouldn't 0 be the digital 0? The examples and documentation I've read all seem to imply that you would want to use A0 for analog 0.

smcgettrick:

jremington:
Use your multimeter to measure the voltage between the analog input pin and ground. What do you get?

If I'm doing this right (been 15+ years since I've done any electronics work) 4.95V is what I'm getting from the multimeter between analog and ground.

Then there has to be something not making proper contact on your breadboard or wired different then the picture. The analogRead is telling you the same thing that your meter is measuring between A0 and ground.

It turned out to be a bad wire. Getting an actual reading now:

Analog reading 925.00
Thermistor resistance 94387.76

Thanks for the help!