user32359: So I am trying to use this thermistor to measure temperature and with this code below it always puts the same value (2147483647).  I used this tutorial to do the wiring and coding.  I don't think the wiring is the problem but think the problem is somewhere in my code or perhaps I am using a wrong type of thermistor?  Am I missing something?  Any help is greatly appreciated.
I am only using a 1k resistor in series with the thermistor but don't think that would be a problem, right?
Edit: I should have mentioned I'm using the adafruit huzzah esp8266 so there are a few pins.
#include <DHT.h>
#include <ESP8266WiFi.h>
#include <Phant.h>
#include <ESP.h>


#define DHTPIN 2
#define DHTTYPE DHT22
#define THERMISTORPIN 4


DHT dht(DHTPIN, DHTTYPE);

const char* ssid = "xxxx";
const char* password = "yyyyyy";
const char* host = "data.sparkfun.com";
const String publickey = "uuuuuu";
const String privatekey = "ttttttt";
const byte NUM_FIELDS = 5;
const String fieldNames[NUM_FIELDS] = {"ghumidity", "gtemp", "light", "otemp", "wtemp"};
String fieldData[NUM_FIELDS];

//thermistor variables
const int thermresistor = 987; //value of resistor in series with thermistor
int thermtemp = 0;
uint8_t i;
uint8_t numsamples = 5;
uint8_t To = 25;
const int B = 3950;



void setup(){
    Serial.begin(115200);
    delay(10);
    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
  delay(500);
}

    fieldData[0] = 1; //humidity
    fieldData[1] = 2; //garden temp
    fieldData[2] = 3; //light
    fieldData[3] = 4; //outside temp
    fieldData[4] = 8; //water temp


//turnpumpon();
posttophant();
//turnpumpoff();
ESP.deepSleep(1200000000, WAKE_RF_DEFAULT);

}


void posttophant()
{
    fieldData[0] = dht.readHumidity();
    fieldData[1] = dht.readTemperature(true);


    //read outside temp (otemp) data and convert to a temp
    for (i=0; i<numsamples; i++){
      thermtemp = analogRead(THERMISTORPIN);
      thermtemp += thermtemp;
      delay(10);
    }

    //take the sum of all the readings and divide by # of samples to get avg.
    thermtemp = thermtemp / numsamples;

    #voltage divider equation
    thermtemp = thermresistor / (1023 / thermtemp - 1);


    //Steinhart eqn.
    thermtemp = 1 / (log(thermtemp / thermresistor) / B + (1 / (To + 273))) - 273;
    fieldData[3] = String(thermtemp);

    WiFiClient client;

    const int httpPort = 80;
if (!client.connect (host, httpPort)){
  return;
}

    client.print("POST /input/");
    client.print(publickey);
    client.print("?private_key=");
    client.print(privatekey);
    for (int i=0; i<NUM_FIELDS; i++)
    {
      client.print("&");
      client.print(fieldNames[i]);
      client.print("=");
      client.print(fieldData[i]);
    }
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println(host);
    client.println("Connection: close");
    client.println();
}


user3917: Re “the problem is somewhere in my code”, lots of places in the code have problems.
• The following loop does not add up readings; it takes a bunch of readings and throws them away, then doubles the last one.  For example, if the five readings in a row are 300, 400, 500, 600, and 100, thermtemp is 200 after the loop.  To see this, try it out – mentally simulate what the code does, writing down the value of thermtemp after each step.
for (i=0; i<numsamples; i++) {
   thermtemp = analogRead(THERMISTORPIN);
   thermtemp += thermtemp;
   delay(10);
}

• Your “voltage divider equation” (below) has a form like that shown in the Adafruit tutorial, but because your thermtemp is declared as an int (vs Adafruit's float), integer division with truncation will be used, producing inaccuracy.
thermtemp = thermresistor / (1023 / thermtemp - 1);

• Your Steinhart-Hart equation is miscoded.  At that step, the fixed resistor's value, thermresistor, is no longer relevant.  The relevant value is the ADC reading as converted to thermistor resistance.
• In your Steinhart-Hart misimplementation, log(thermtemp / thermresistor) takes log of zero because in integer arithmetic, thermtemp / thermresistor is zero.
• The expression 1 / (To + 273) is zero in integer arithmetic.

user32361: There are a few possible issues you're having:
First off, from what I understand, the ESP8266 ADC only reads up to 1V. If wired per the Arduino example you cited, and using 1K, you'll have VCC->1K->THERMISTOR->GND. At room temp the thermistor is 10K, so the voltage at the ADC will be 3.3*(10K/(1K+10K)), so pretty close to 3.3V. I don't know the behavior of the ADC when overrange, but I'd assume you'd just get 0xFFFF. You'll probably want >30K in series with the thermistor to get it into a usable range.
I also see a subtle error(I think) in your code:
//read outside temp (otemp) data and convert to a temp
for (i=0; i<numsamples; i++){
  thermtemp = analogRead(THERMISTORPIN);
  thermtemp += thermtemp;
  delay(10);
}

Should be:
//read outside temp (otemp) data and convert to a temp
thermtemp = 0
for (i=0; i<numsamples; i++){
  thermtemp += analogRead(THERMISTORPIN);
  delay(10);
}

Otherwise thermtemp is just the last reading added to itself.
Lastly, I would probably make the part of the code that posts the result to a function and call it throughout your calculations of the temp, to see if anything weird happening.
Hope this helps.

user466: Considerations about the ESP8266 analog pin
The ESP8266 has only one pin that allows analog read. This pin is call A0 on the NodeMCU module or A on the ESP8266 Huzzah (some other ESP module don't expose that pad - for example ESP8266-01) or might label it differently - check the documentation of your ESP module.
Following your edit: make sure that you connect your thermistor to the A pin of the Huzzah ESP8266 module.
You should keep in mind that this analog pin is a 10bit ADC with in principle limited input voltage range.
To read an external voltage applied to the ADC pin, use analogRead(A0). Unless you are using a board specially design to increase its range, the input voltage range is 0 — 1.0V. As @dandavis pointed out some boards (Node MCU e.g.) include a voltage divider on board to give you a full 0 - 3.3V input range.
Thermistor equations
The datasheet of your thermistor states that the TCR coefficient is 3000ppm/%C and has a 10K value [note that the manufacturer doesn't provide you with the temperature at which R = 10K]. The equation of the resistance variation ∆R with temperature variation ∆T is given by:
∆R = ∆T*10k*3000ppm = 30*∆T
So if T_0 is the temperature where R = 10k, the equation of the resistance value is given by:
R = 10k + (T-T_0)*30
I am assuming that you are using the 3.3V supply of your ESP and creating a voltage divider using the 1K resistor and the thermistor.
There are two ways to do this divider:
1. Voltage divider option 1

simulate this circuit – Schematic created using CircuitLab
[Note that the thermistor needs to be connected to the A pin of your ESP8266.]
2. Voltage divider option 2

simulate this circuit
Equation of voltage at node A
For both case here is the voltage V_A seen at node A:
1. Voltage divider option 1
V_A = R_series *3.3 / (R_th + R_series)
2. Voltage divider option 2
V_A = R_th *3.3 / (R_th + R_series)
Analysis of the variations of V_A with temperature
Lets look at the difference between the 2 formulas above:
1. Voltage divider option 1
The numerator is a constant with temperature while the denominator changes with T. You will get a strong variation.
2. Voltage divider option 2
Both the numerator and denominator increase with temperature. You won't get a lot of variation on V_A with temperature. You should avoid this configuration.
Analysis of the maximum allowed value of R_series
The important consideration is that for your ESP module V_A cannot be higher than 1V.
1. Voltage divider option 1
Increasing R_series will increase V_A so we compute a maximum value:
1V = 3.3V*R_series_max/(R_series_max+10K)
That gives you: R_series_max = 4300Ohms
2. Voltage divider option 2
Increasing R_series will decrease V_A so we compute a minimum value:
1V = 3.3V*10k/(R_series_min+10K)
That gives you: R_series_min = 23kOhms
This is the reason why it was suggested to you using a 30k resistor in that case.
Considerations about temperature measurement precision
The voltage variation ∆V on the node A of the ESP between temperature T1 and T2 can be computed as follow:
∆V = 3.3 *1K/(1k + 10k + 30*T1) - 3.3 *1K/(1k +10k+ 30*T2)
If we assume that the thermistor is 10K for ambient temperatures the baseline voltage measured on the A pin is:
3.3V*1K/11k = 0.3V
For a 0 to 1V 10bit DAC of the ESP8266 that is around: 2^10*0.3 = 307
A change of 10C would lead to a variation of voltage of:
∆V = 0.3 - 3.3 *1K/(11k + 300) = 8mV ~8ADC code
The equation of ∆T vs ∆V is not linear but for small variation of temperature with your current setup you get ~1ADC code per degree.
Depending of your application this might not be enough for you. As suggested in several comment you could:

Add more thermistors in parallel
Increase the 1K series resistor (but not too much or you will saturate the ADC).
Change the architecture of the measuring circuit (RC oscillator using the thermistor and interrupt counter in the ESP, 555 timer circuit loaded with the thermistor and interrupt counter, ...) 
Or since you want to do humidity and temperature measurement why don't you get the BME280 module. It can be read over I2C and libraries are readily available to read it with the ESP8266.


32359: <p>So I am trying to use <a href="http://www.mouser.com/Search/m_ProductDetail.aspx?TE-Connectivity-Holsworthy%2FLT300014T2610KJ%2F&amp;qs=HLeXuo0aL2oWuH78WH79GQ%3D%3D" rel="nofollow noreferrer">this</a> thermistor to measure temperature and with this code below it always puts the same value (2147483647).  I used <a href="https://learn.adafruit.com/thermistor/using-a-thermistor" rel="nofollow noreferrer">this</a> tutorial to do the wiring and coding.  I don't think the wiring is the problem but think the problem is somewhere in my code or perhaps I am using a wrong type of thermistor?  Am I missing something?  Any help is greatly appreciated.</p>

<p>I am only using a 1k resistor in series with the thermistor but don't think that would be a problem, right?</p>

<p>Edit: I should have mentioned I'm using the adafruit huzzah esp8266 so there are a few pins.</p>

<pre><code>#include &lt;DHT.h&gt;
#include &lt;ESP8266WiFi.h&gt;
#include &lt;Phant.h&gt;
#include &lt;ESP.h&gt;


#define DHTPIN 2
#define DHTTYPE DHT22
#define THERMISTORPIN 4


DHT dht(DHTPIN, DHTTYPE);

const char* ssid = "xxxx";
const char* password = "yyyyyy";
const char* host = "data.sparkfun.com";
const String publickey = "uuuuuu";
const String privatekey = "ttttttt";
const byte NUM_FIELDS = 5;
const String fieldNames[NUM_FIELDS] = {"ghumidity", "gtemp", "light", "otemp", "wtemp"};
String fieldData[NUM_FIELDS];

//thermistor variables
const int thermresistor = 987; //value of resistor in series with thermistor
int thermtemp = 0;
uint8_t i;
uint8_t numsamples = 5;
uint8_t To = 25;
const int B = 3950;



void setup(){
    Serial.begin(115200);
    delay(10);
    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
  delay(500);
}

    fieldData[0] = 1; //humidity
    fieldData[1] = 2; //garden temp
    fieldData[2] = 3; //light
    fieldData[3] = 4; //outside temp
    fieldData[4] = 8; //water temp


//turnpumpon();
posttophant();
//turnpumpoff();
ESP.deepSleep(1200000000, WAKE_RF_DEFAULT);

}


void posttophant()
{
    fieldData[0] = dht.readHumidity();
    fieldData[1] = dht.readTemperature(true);


    //read outside temp (otemp) data and convert to a temp
    for (i=0; i&lt;numsamples; i++){
      thermtemp = analogRead(THERMISTORPIN);
      thermtemp += thermtemp;
      delay(10);
    }

    //take the sum of all the readings and divide by # of samples to get avg.
    thermtemp = thermtemp / numsamples;

    #voltage divider equation
    thermtemp = thermresistor / (1023 / thermtemp - 1);


    //Steinhart eqn.
    thermtemp = 1 / (log(thermtemp / thermresistor) / B + (1 / (To + 273))) - 273;
    fieldData[3] = String(thermtemp);

    WiFiClient client;

    const int httpPort = 80;
if (!client.connect (host, httpPort)){
  return;
}

    client.print("POST /input/");
    client.print(publickey);
    client.print("?private_key=");
    client.print(privatekey);
    for (int i=0; i&lt;NUM_FIELDS; i++)
    {
      client.print("&amp;");
      client.print(fieldNames[i]);
      client.print("=");
      client.print(fieldData[i]);
    }
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println(host);
    client.println("Connection: close");
    client.println();
}
</code></pre>
 3917: <p>Re “the problem is somewhere in my code”, lots of places in the code have problems.</p>

<p>• The following loop does not add up readings; it takes a bunch of readings and throws them away, then doubles the last one.  For example, if the five readings in a row are 300, 400, 500, 600, and 100, <code>thermtemp</code> is 200 after the loop.  To see this, try it out – mentally simulate what the code does, writing down the value of <code>thermtemp</code> after each step.</p>

<pre><code>for (i=0; i&lt;numsamples; i++) {
   thermtemp = analogRead(THERMISTORPIN);
   thermtemp += thermtemp;
   delay(10);
}
</code></pre>

<p>• Your “voltage divider equation” (below) has a form like that shown in <a href="https://learn.adafruit.com/thermistor/using-a-thermistor" rel="nofollow noreferrer">the Adafruit tutorial</a>, but because <em>your</em> <code>thermtemp</code> is declared as an <code>int</code> (vs Adafruit's <code>float</code>), integer division with truncation will be used, producing inaccuracy.</p>

<pre><code>thermtemp = thermresistor / (1023 / thermtemp - 1);
</code></pre>

<p>• Your Steinhart-Hart equation is miscoded.  At that step, the fixed resistor's value, <code>thermresistor</code>, is no longer relevant.  The relevant value is the ADC reading as converted to thermistor resistance.</p>

<p>• In your Steinhart-Hart misimplementation, <code>log(thermtemp / thermresistor)</code> takes log of zero because in integer arithmetic, <code>thermtemp / thermresistor</code> is zero.</p>

<p>• The expression <code>1 / (To + 273)</code> is zero in integer arithmetic.</p>
 32361: <p>There are a few possible issues you're having:</p>

<p>First off, from what I understand, the ESP8266 ADC only reads up to 1V. If wired per the Arduino example you cited, and using 1K, you'll have VCC->1K->THERMISTOR->GND. At room temp the thermistor is 10K, so the voltage at the ADC will be 3.3*(10K/(1K+10K)), so pretty close to 3.3V. I don't know the behavior of the ADC when overrange, but I'd assume you'd just get 0xFFFF. You'll probably want >30K in series with the thermistor to get it into a usable range.</p>

<p>I also see a subtle error(I think) in your code:</p>

<pre><code>//read outside temp (otemp) data and convert to a temp
for (i=0; i&lt;numsamples; i++){
  thermtemp = analogRead(THERMISTORPIN);
  thermtemp += thermtemp;
  delay(10);
}
</code></pre>

<p>Should be:</p>

<pre><code>//read outside temp (otemp) data and convert to a temp
thermtemp = 0
for (i=0; i&lt;numsamples; i++){
  thermtemp += analogRead(THERMISTORPIN);
  delay(10);
}
</code></pre>

<p>Otherwise thermtemp is just the last reading added to itself.</p>

<p>Lastly, I would probably make the part of the code that posts the result to a function and call it throughout your calculations of the temp, to see if anything weird happening.</p>

<p>Hope this helps.</p>
 466: <p><strong>Considerations about the ESP8266 analog pin</strong></p>

<p>The ESP8266 has only one pin that allows analog read. This pin is call A0 on the NodeMCU module or A on the ESP8266 Huzzah (some other ESP module don't expose that pad - for example ESP8266-01) or might label it differently - check the documentation of your ESP module.
Following your edit: make sure that you connect your thermistor to the A pin of the Huzzah ESP8266 module.</p>

<p>You should keep in mind that this analog pin is a 10bit ADC with in principle limited input voltage range.</p>

<p>To read an external voltage applied to the ADC pin, use <code>analogRead(A0)</code>. Unless you are using a board specially design to increase its range, the input voltage range is 0 — 1.0V. As @dandavis pointed out some boards (Node MCU e.g.) include a voltage divider on board to give you a full 0 - 3.3V input range.</p>

<p><strong>Thermistor equations</strong></p>

<p>The datasheet of your thermistor states that the TCR coefficient is 3000ppm/%C and has a 10K value [note that the manufacturer doesn't provide you with the temperature at which R = 10K]. The equation of the resistance variation ∆R with temperature variation ∆T is given by:</p>

<p><code>∆R = ∆T*10k*3000ppm = 30*∆T</code></p>

<p>So if T_0 is the temperature where R = 10k, the equation of the resistance value is given by:</p>

<p><code>R = 10k + (T-T_0)*30</code></p>

<p>I am assuming that you are using the 3.3V supply of your ESP and creating a voltage divider using the 1K resistor and the thermistor.
There are two ways to do this divider:</p>

<p><em>1. Voltage divider option 1</em></p>



<p><img src="https://i.stack.imgur.com/svVYG.png" alt="schematic"></p>



<p><sup><a href="/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fsvVYG.png">simulate this circuit</a> &ndash; Schematic created using <a href="https://www.circuitlab.com/" rel="nofollow">CircuitLab</a></sup></p>

<p>[Note that the thermistor needs to be connected to the A pin of your ESP8266.]</p>

<p><em>2. Voltage divider option 2</em></p>



<p><img src="https://i.stack.imgur.com/a9gbQ.png" alt="schematic"></p>



<p><sup><a href="/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fa9gbQ.png">simulate this circuit</a></sup></p>

<p><strong>Equation of voltage at node A</strong></p>

<p>For both case here is the voltage V_A seen at node A:</p>

<p><em>1. Voltage divider option 1</em></p>

<p><code>V_A = R_series *3.3 / (R_th + R_series)</code></p>

<p><em>2. Voltage divider option 2</em></p>

<p><code>V_A = R_th *3.3 / (R_th + R_series)</code></p>

<p><strong>Analysis of the variations of V_A with temperature</strong></p>

<p>Lets look at the difference between the 2 formulas above:</p>

<p><em>1. Voltage divider option 1</em></p>

<p>The numerator is a constant with temperature while the denominator changes with T. You will get a strong variation.</p>

<p><em>2. Voltage divider option 2</em></p>

<p>Both the numerator and denominator increase with temperature. You won't get a lot of variation on V_A with temperature. <em>You should avoid this configuration.</em></p>

<p><strong>Analysis of the maximum allowed value of R_series</strong></p>

<p>The important consideration is that for your ESP module V_A cannot be higher than 1V.</p>

<p><em>1. Voltage divider option 1</em></p>

<p>Increasing R_series will increase V_A so we compute a <strong>maximum</strong> value:
<code>1V = 3.3V*R_series_max/(R_series_max+10K)</code></p>

<p>That gives you: <code>R_series_max = 4300Ohms</code></p>

<p><em>2. Voltage divider option 2</em></p>

<p>Increasing R_series will decrease V_A so we compute a <strong>minimum</strong> value:
<code>1V = 3.3V*10k/(R_series_min+10K)</code></p>

<p>That gives you: <code>R_series_min = 23kOhms</code></p>

<p>This is the reason why it was suggested to you using a 30k resistor in that case.</p>

<p><strong>Considerations about temperature measurement precision</strong></p>

<p>The voltage variation <code>∆V</code> on the node <code>A</code> of the ESP between temperature T1 and T2 can be computed as follow:
<code>∆V = 3.3 *1K/(1k + 10k + 30*T1) - 3.3 *1K/(1k +10k+ 30*T2)</code></p>

<p>If we assume that the thermistor is 10K for ambient temperatures the baseline voltage measured on the <code>A</code> pin is:
<code>3.3V*1K/11k = 0.3V</code></p>

<p>For a 0 to 1V 10bit DAC of the ESP8266 that is around: 2^10*0.3 = 307</p>

<p>A change of 10C would lead to a variation of voltage of:
<code>∆V = 0.3 - 3.3 *1K/(11k + 300) = 8mV ~8ADC code</code></p>

<p>The equation of ∆T vs ∆V is not linear but for small variation of temperature with your current setup you get ~1ADC code per degree.</p>

<p>Depending of your application this might not be enough for you. As suggested in several comment you could:</p>

<ul>
<li>Add more thermistors in parallel</li>
<li>Increase the 1K series resistor (but not too much or you will saturate the ADC).</li>
<li>Change the architecture of the measuring circuit (RC oscillator using the thermistor and interrupt counter in the ESP, 555 timer circuit loaded with the thermistor and interrupt counter, ...) </li>
<li>Or since you want to do humidity and temperature measurement why don't you get the BME280 module. It can be read over I2C and libraries are readily available to read it with the ESP8266.</li>
</ul>
