Hello everyone.
First of all, I'm new to the forum so I apologize if I opened this topic in the wrong place.
I want to control the hotend of my 3D printer using Arduino Nano. As a result of my research, I learned that "100K Semitec 104GT2 NTC thermistor" was used in the hotend. and accordingly I found that the beta coefficient of my thermistor is 4267K. I made my connections to A0 pin using a 4.7kohm resistor. I ran the system using the codes I shared below. However, the measured temperature value appears as 368.80 every time. What could be the problem and how can it be solved? I couldn't find any solution. I would be glad if you can help me.
hotend I use: "E3D-v6 HotEnd"
connections:
codes :
#define THERMISTOR_PIN A0
#define SERIES_RESISTOR 4700 // 4.7 kohm resistor
// Steinhart-Hart coefficients for Semitec 104GT2 NTC Thermistor
#define A 0.001129148
#define B 0.0004267
#define C 0.0000000876741
void setup() {
Serial.begin(9600);
}
void loop() {
// Measure the thermistor resistance
int rawValue = analogRead(THERMISTOR_PIN);
// Calculate the thermistor resistance
float resistance = SERIES_RESISTOR / (1023.0 / rawValue - 1.0);
// Calculate temperature using the Steinhart-Hart equation
float steinhart;
steinhart = resistance / 100000.0; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= B; // 1/B * ln(R/Ro)
steinhart += 1.0 / (25 + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // Convert to Celsius
// Print the obtained temperature value to the Serial Monitor
Serial.print("Temperature: ");
Serial.println(steinhart);
delay(1000);
}
Thank you everyone.
Run this code:
I forced the analog pin reading values between 200 and 1000 to facilitate debugging.
and observe what happens in each line as your calculation.
#define THERMISTOR_PIN A0
#define SERIES_RESISTOR 4700 // 4.7 kohm resistor
// Steinhart-Hart coefficients for Semitec 104GT2 NTC Thermistor
#define A 0.001129148
#define B 0.0004267
#define C 0.0000000876741
void setup() {
Serial.begin(9600);
}
int rawValue = 200;
void loop() {
// Measure the thermistor resistance
//int rawValue = analogRead(THERMISTOR_PIN);
rawValue = abs(rawValue) - 1200;
rawValue = abs(rawValue);
Serial.print("rawValue: "); Serial.println(rawValue);
// Calculate the thermistor resistance
float resistance = SERIES_RESISTOR / (1023.0 / rawValue - 1.0);
Serial.print("resistance: "); Serial.println(resistance);
// Calculate temperature using the Steinhart-Hart equation
float steinhart;
steinhart = resistance / 100000.0; // (R/Ro)
Serial.print("steinhart1: "); Serial.print(steinhart);
steinhart = log(steinhart); // ln(R/Ro)
Serial.print(" steinhart2: "); Serial.print(steinhart);
steinhart /= B; // 1/B * ln(R/Ro)
Serial.print(" steinhart3: "); Serial.println(steinhart);
steinhart += 1.0 / (25 + 273.15); // + (1/To)
Serial.print("steinhart4: "); Serial.print(steinhart);
steinhart = 1.0 / steinhart; // Invert
Serial.print(" steinhart5: "); Serial.print(steinhart);
steinhart = steinhart - 273.15; // modified // Convert to Celsius
// Print the obtained temperature value to the Serial Monitor
Serial.print(" Temperature: "); Serial.println(steinhart);
Serial.println(" ");
delay(1000);
}
The resistance of the thermister is SO high that the percent change in resistance is very tiny, so the voltage variation will also be very tiny.
JCA34F
January 20, 2024, 7:20pm
4
Try a 100k resistor and change your #define to match.
Wawa
January 20, 2024, 8:13pm
5
Not if you use that thermistor for a hotbed.
4k7 or 10k could be the optimum value for that pull up resistor. For maximum resolution it should be about the same value of the thermistor at the temps you're using it with. Look at 100k thermistor resistance tables.
Leo..
I followed your suggestion but the result did not change.
system
Closed
July 22, 2024, 8:44am
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.