Thermistor connecting to esp32 and coding through Arduino IDE
Posted: Tue Dec 01, 2020 11:23 am
I am connecting thermistor as the following picture is showing, except that wire which is connected to 5V,I connect on esp32 to 3.3V.
.When I write a simple code to get values from thermistor, all the time I receive 0,I am changing the temperature, because I want to measure the temperature of the water, I put the thermistor in hot water, and still got a result 0. Where is the problem and what should I fix to get correct values. My wish is to improve the program with the Stein-Hart equation, but first I want to be sure the thermistor is properly working. Below is the code. The thermistor pin is going to 36 on esp32. What I need to change in the wiring or in the code to receive correct results?Thank you all in advance.
.When I write a simple code to get values from thermistor, all the time I receive 0,I am changing the temperature, because I want to measure the temperature of the water, I put the thermistor in hot water, and still got a result 0. Where is the problem and what should I fix to get correct values. My wish is to improve the program with the Stein-Hart equation, but first I want to be sure the thermistor is properly working. Below is the code. The thermistor pin is going to 36 on esp32. What I need to change in the wiring or in the code to receive correct results?Thank you all in advance.
Code: Select all
#define thermistorpin 36
void setup(){
Serial.begin(9600);
}
void loop(){
double thermVal;
thermVal=analogRead(thermistorpin);
Serial.println("Thermistor reading: ");
Serial.println(thermVal);
delay(2000);
}