Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By rudy
#79888 I don't see any reason to use anything close to 12mA.

I would use a higher thermistor value if possible with an appropriate series resistor. The company I work for primarily uses a 3K @ 25°C thermistor but on some of our products we use a 10K thermistor. And for a pull up resistance of the same value.

Assuming a worst case situation (a shorted thermistor) that would mean 3 volts / 3K = 1mA, or 3.3v / 10K = 0.33mA.
User avatar
By leenowell
#79892 Thanks Rudy. I have given it a try and it seems to work ok. Curiously, I was trying to switch the onboard LED on (I have a ESP 12F so thought it was GPIO 2) but this seemed to have a big impact on the ADC reading for some reason. Without switching it high I get a steady reading of 13 adding a line of code to switch GPIO 2 high gives a steady reading of 2!. Using GPIO 4 for the thermistor and switching that high seems to have no impact to the ADC value.
User avatar
By rudy
#79897 In my first reply I said that there are real problems with the ESP8266's A/D. That if I were to use a thermistor I would use an external A/D converter.

The A/D produces poor results because it is affected by what the chip is doing at the time. Take a look at this issue. https://github.com/esp8266/Arduino/issues/2070

From what I remember, it is best to have the WiFi turned off when doing a sample. In my projects. where I am running off a battery, I do my battery voltage reading first, and only at the start, then I complete the rest of the code.

With many processors applications Vcc is used as the positive reference for the A/D converter. This is fine when what you are measuring has it's output proportional to that same Vcc supply. (as with a thermistor with a resistor to Vcc) But if you needed to measure a voltage of something that was not related to Vcc then the result will be affected by what the reference voltage is (Vcc) and what changes it is seeing.

If you had to measure a specific voltage, lets say 0.722 volts, and the A/D reference voltage was 3.30 volts, you would get reading of 224 from a 10 bit converter. But if the voltage reference was 3.15 volts the reading when measuring 0.722 volts would be 234. This is an issue I have with products that must measure a voltage that is not proportional to Vcc.

Almost always, when I use thermistors in an application, the A/D converter is connected to Vcc and the resistor in series with the thermistor is also connected to Vcc. If Vcc is high, or if it is low, that will change the value of each step in the reading. But since the thermistor's voltage is also dependent on Vcc the output will track the A/D' reference changes.

Now in the case of the ESP8266 the reference of the A/D is not directly proportional to Vcc. It has a poor reference. It is not a consistent voltage from chip to chip, and it also is affected by changes in current consumption of the chip. If you use Vcc to provide the voltage for the resistor/thermistor divider the changes in Vcc will not be the same as what the A/D is using for the reference. And this will produce variable readings.

I was very disappointed with the issues with the ESP8266's A/D converter. I only use it if I can tolerate low accurate readings. If I need something more accurate I use either an external A/D or a coprocessor with it's own A/D.
User avatar
By MamaMia
#79898 New member - beginner.
Quite a cool way of doing it via the GPIO port.
You are only drawing 3mA at worst case - and as the previous respondent (leenowell) said - 12mA is avalable.
I think after wake up, you should write in a delay to stabilize the voltage on the IO port - capacitance in the wiring, etc. and then take the reading from the thermistor coupling. Take a few readings and average them out - not sure how to do this....
I'm not sure how noisy the ADC is, but it obviously call for a bit of experimentation and add (or subtract) the 'mean fault' value to your final temperature reading.