NodeMcu 1 analog pin, multiple thermistors reading problem

I tried using this on my nodeMCU which only has 1 analog pin. i did all the connections etc....
Both thermistors sensors are 10k and they also have a 10k resistor between ground and probe, the 3.3v will be the digital pin assigned on/off with the MUX code for the reading, everything is prepared it just this code cant figure it out at all and seperate the readings.

i got it to read the probes, actually both sensors behind like one if i touch one temp raises up and it will display on the lcd the change and if i touch the other sensor it will do the same both sensors work but it will show in the same spot on the lcd.

Point is, i want to read MUX ABC independently but i dont know what im doing wrong

this is what i want as my define pins
#define W 14 // Water
#define P 12 // peltier
#define E 13 // E=Extra not used

this is the original code

#define MUX_A D4
#define MUX_B D3
#define MUX_C D2

#define ANALOG_INPUT A0

void setup() {
//Deifne output pins for Mux
pinMode(MUX_A, OUTPUT);
pinMode(MUX_B, OUTPUT); 
pinMode(MUX_C, OUTPUT); 
}

void changeMux(int c, int b, int a) {
digitalWrite(MUX_A, a);
digitalWrite(MUX_B, b);
digitalWrite(MUX_C, c);
}

void loop() {
float value;

changeMux(LOW, LOW, LOW);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 0 pin of Mux

changeMux(LOW, LOW, HIGH);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 1 pin of Mux

changeMux(LOW, HIGH, LOW);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 2 pin of Mux

changeMux(LOW, HIGH, HIGH);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 3 pin of Mux

changeMux(HIGH, LOW, LOW);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 4 pin of Mux

changeMux(HIGH, LOW, HIGH);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 5 pin of Mux

changeMux(HIGH, HIGH, LOW);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 6 pin of Mux

changeMux(HIGH, HIGH, HIGH);
value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 7 pin of Mux

}

i wanted this code to work with this formula

int ThermistorPin = 0; // i know this would be the first sensor the pin 14
int Vo;
float R1 = 10000;
float logR2, R2, T0, Tc, Tf;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

void loop() {
Vo = analogRead(ThermistorPin);
R2 = R1 * (1024.0 / (float)Vo - 1.00);
logR2 = log(R2);
T0 = (1.0 / (c1 + c2logR2 + c3logR2logR2logR2));
Tc = T0 - 273.15;
Tf = (Tc * 9.0)/ 5.0 + 32.0;

what would i need to change, so i can have lets said T0/T1/T2 etc.. sensor reading

The absolute/voltage A/D of the ESP8266 is not suitable to read ratiometric sensors, like thermistors.
Ratiometric sensors need a ratiometric A/D.

Use a digital temp sensor, like the DS18B20.
That only uses one (digital) pin for a whole bunch of sensors.
Leo..

Hi, thanks for the reply.

It has to be a 10k thermistor the one im using is a g1/4 in line thermistor that goes in water as a plug.

The above code works to some extent i tried and it will display temperature on both sensors on the same T0.
The problem I'm having is i want to split the readings. Both sensors are behavings as one sensor in my code and they display on lcd 16x2.

For example i have 2 thermistors with only that code. If i put thermistor 1 on a cup of water with ice it will show 0c/32f ok? If i take it out it will raise up. This displaying on (T0).

Same with Thermistor 2, if thermistor 1 is out of the water with ice and i put thermistor 2 on it, it will also shows on (T0) because of both connect to a0.

The digital pins are used to shoot voltage on intervals to turn on and off the thermistor theres no voltage cable, the voltage will be the digital pin both sensors are connected to analog a0.

My issue is trying to get the reading from the code above and split them in 2-3 readings depending on how many i add to the code. For now just 2 and 1 extra not used.

I know fore sure the code is working . I just cant figure out how to make display individual readings by sensors.

Do post a circuit diagram of what you're attempting to do. I have the feeling it's possible but not sure what you've really got.

Hi, well i have 2 thermistors 10k they are already wired with a 10k ohm resistor as well in the ground portion which goes in a L shape from ground to A0 and thermistor which reads the sensor. In A0 i have a y cable for ground sensor which reads both thermistors.

Digital pin would be the voltage which the script above would turn on and off and get the values of the thermistor.

So,

As im at work this is the cabling for ine thermistor.

--------A0
Ground /10K resistance -----------. To thermistor
Voltage would ve the assigned D pin

A hand drawn & photographed sketch of a circuit works better.

i tried my best i hope it makes sense

Diagrama_ntc-thermistor-probe.jpg

You're very close. The resistors are mixed up - and you need only one (now they're in parallel, i.e. 5k effective). This will do:

schematic.png

To read one of these NTCs, set the respective NodeMCU pin to OUTPUT, HIGH.

Set the pins for all other NTCs to INPUT (not INPUT_PULLUP or OUTPUT, LOW!)

There's still the problem that you have to keep your Vcc very stable, as pointed out before the ESP8266 uses a fixed 1.0-1.1V fixed reference so it's not ratiometric (the exact value I don't know, it probably varies a bit per device, but it's a constant value). The NodeMCU has a 100k+220k (hope I remember those correctly) voltage divider on the A0 pin so it can take ~3.3V maximum.

schematic.png

Awesome, didnt catch that up till you mentioned so once i fixed that thanks to you i end with less resistor and cables.

my problem still on how i mix my ((initial code)) and get the reading from my initial code with the one im using to add more thermistors in 1 analog pin when it switch them on and off the code

im reading right now the digital pin with a volt meter from both sensor with the semi working code and they are reading at HIGH/LOW like 3.1x something then 0.00 on off it swaps between switch of course.

now my goal is to grab individual readings from the switching and implement them in the code.

When D5 (HIGH/LOW) grab reading from Sensor
When D6 (LOW/HIGH) grab reading from Sensor
they act as they are the same sensor on the code itself
up to here im very aware, i have to code so when HIGH/LOW or LOW/HIGH grab the read and specify for the read itself to specify which sensor was readed when it was on and assign a sensor value...

create a reading from D5
create a reading from D6

convert that reading into this piece of code

T0 = (1.0 / (c1 + c2logR2 + c3logR2logR2logR2));

thats where im lost

Something like this:

const uint8_t sensorPin[D4, D5, D6]; // D4 = sensor 0, D5 - sensor 1, ...
const uint8_t nSensors = 3;

uint16_t readSensor(uint8_t sensor) {
  for (uint8_t i = 0; i < nSensors; i++) {
    if (i == sensor) {
      pinMode(sensorPin[i], OUTPUT); // The sensor we want to read: power on.
      digitalWrite(sensorPin[i], HIGH);
    }
    else {
      pinMode(sensorPin[i], INPUT); // All other sensors: power off.
    }
  }
  return analogRead(A0); // Take reading of this sensor.
}

It is indeed very well possible, maybe even quite likely, that the output pins produce a bit less voltage than Vcc. I expect this output voltage to be quite stable, as long as you keep your supply voltage stable. After that it's a matter of calibration.

i havent done it yet i will let you know how it worked out promise..
have to clean my code etc before attempting this one.