Added Z and XY coordinates for Thermistor placment

This commit is contained in:
-help 2024-01-27 22:20:32 +02:00
parent 4e71830c8e
commit e117d72f53
3 changed files with 33 additions and 10 deletions

View File

@ -8,6 +8,9 @@ AnalogRef analogRef(5.0);
TempCalibration calibration_100K_3950 = {25, 100000, 86, 10324, 169, 1148}; TempCalibration calibration_100K_3950 = {25, 100000, 86, 10324, 169, 1148};
// Initalize the 3950 100K thermistors with ACTUAL reference resistor measurnment(Measured between Left pin and GND when the board is powered off) using the default calibration data for 100K thermistor // Initalize the 3950 100K thermistors with ACTUAL reference resistor measurnment(Measured between Left pin and GND when the board is powered off) using the default calibration data for 100K thermistor
// You can also make a custom calibration data for your thermistor and use that instead of the default one pass it as shown below --> keep the naming of the thermistor the same as the one you are replacing
//Thermistor thermistor1(THERMISTOR1_PIN, 100000, calibration_100K_3950,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//-------------------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------------------
@ -15,17 +18,19 @@ TempCalibration calibration_100K_3950 = {25, 100000, 86, 10324, 169, 1148};
//You can tweak them from the datasheet to best fit your thermistor but we reccoemnd using the default values and setting the potentiometer to these values //You can tweak them from the datasheet to best fit your thermistor but we reccoemnd using the default values and setting the potentiometer to these values
// Does not have to be perfect just set it close to this value and record the measured value and put it for the thermistors // Does not have to be perfect just set it close to this value and record the measured value and put it for the thermistors
//To measure the resistence turn off the controller completley and measure between GND and the left pin of the connector with the thermistor unplugged
//2.5k reference = Best accuracy around 138C //2.5k reference = Best accuracy around 138C
Thermistor thermistor1(THERMISTOR1_PIN, 2500); Thermistor thermistor1(THERMISTOR1_PIN, 2500,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
Thermistor thermistor2(THERMISTOR2_PIN, 2500); Thermistor thermistor2(THERMISTOR2_PIN, 2500,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
Thermistor thermistor3(THERMISTOR3_PIN, 2500); Thermistor thermistor3(THERMISTOR3_PIN, 2500,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//1k reference = Best accuracy around 173c //1k reference = Best accuracy around 173c
Thermistor thermistor4(THERMISTOR4_PIN, 1000); Thermistor thermistor4(THERMISTOR4_PIN, 1000,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//515R reference = Best accuracy around 210C //515R reference = Best accuracy around 210C
Thermistor thermistor5(THERMISTOR5_PIN, 515); Thermistor thermistor5(THERMISTOR5_PIN, 515,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//9k reference = Best accuracy around 90C -> This thermistor is used for the preheat phase if attached //9k reference = Best accuracy around 90C -> This thermistor is used for the preheat phase if attached
Thermistor thermistor6(THERMISTOR6_PIN, 9000); Thermistor thermistor6(THERMISTOR6_PIN, 9000,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//--------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------
@ -65,6 +70,7 @@ ReflowProfile reflowProfiles[] = {
}; };
//--------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------
ReflowProfile chosenReflowProfile = reflowProfiles[0]; ReflowProfile chosenReflowProfile = reflowProfiles[0];

View File

@ -55,7 +55,8 @@ float Thermistor::getResistance()
// Get resistance value // Get resistance value
float buffer = raw * systemVoltage; float buffer = raw * systemVoltage;
float vOut = (buffer) / 1023; float vOut = (buffer) / 1023;
// Serial.println(vOut);
//Calculate the resistance of the thermistor with the system voltage accounted for
buffer = (systemVoltage / vOut) - 1; buffer = (systemVoltage / vOut) - 1;
// return the resistence // return the resistence

View File

@ -21,7 +21,6 @@ struct TempCalibration
float highR; float highR;
}; };
extern TempCalibration calibration_100K_3950; extern TempCalibration calibration_100K_3950;
#define THERMISTOR1_PIN 39 #define THERMISTOR1_PIN 39
@ -35,17 +34,32 @@ extern AnalogRef analogRef;
// Include any necessary libraries here // Include any necessary libraries here
enum ThermistorZ_Placement
{
TOP,
BOTTOM
};
enum ThermistorXY_Placement
{
MIDDLE,
LEFT,
RIGHT
};
class Thermistor class Thermistor
{ {
public: public:
// Constructor // Constructor
Thermistor(); Thermistor();
Thermistor(uint8_t pin, uint16_t resistance, TempCalibration calibration): thermistorPin(pin), setRes(resistance), calibration(calibration) { Thermistor(uint8_t pin, uint16_t resistance, TempCalibration calibration,ThermistorZ_Placement zPlacement,ThermistorXY_Placement xyPlacment) : thermistorPin(pin), setRes(resistance), calibration(calibration),zPlacement(zPlacement),xyPlacment(xyPlacment)
{
calculateCoefficents(calibration); calculateCoefficents(calibration);
} }
Thermistor(uint8_t pin, uint16_t resistance): thermistorPin(pin), setRes(resistance), calibration(calibration_100K_3950) { Thermistor(uint8_t pin, uint16_t resistance,ThermistorZ_Placement zPlacement,ThermistorXY_Placement xyPlacment) : thermistorPin(pin), setRes(resistance), calibration(calibration_100K_3950),zPlacement(zPlacement),xyPlacment(xyPlacment)
{
calculateCoefficents(calibration); calculateCoefficents(calibration);
} }
@ -58,6 +72,8 @@ public:
void calculateCoefficents(TempCalibration calibration); void calculateCoefficents(TempCalibration calibration);
private: private:
ThermistorZ_Placement zPlacement;
ThermistorXY_Placement xyPlacment;
const double K = 273.15; const double K = 273.15;
float sensorResistance; float sensorResistance;
uint8_t thermistorPin; uint8_t thermistorPin;