Browse Source

Added support for AD8495 K-type thermocouple amplifier

Requires removal of 4.7k pull resistor on sense pins.
Supports AD8495 amplifier board WITHOUT 1.25V on reference pin
(ie. TriangleLab's sensor and not Adafruit's breakout board)
Kevin Lee 3 years ago
parent
commit
b951f913d0

+ 14 - 0
Firmware/Configuration_adv.h

@@ -50,6 +50,11 @@
 #define TEMP_SENSOR_AD595_OFFSET 0.0
 #define TEMP_SENSOR_AD595_GAIN   1.0
 
+//These defines help to calibrate the AD8495 sensor in case you get wrong temperature measurements.
+//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET"
+#define TEMP_SENSOR_AD8495_OFFSET 0.0
+#define TEMP_SENSOR_AD8495_GAIN   1.0
+
 //This is for controlling a fan to cool down the stepper drivers
 //it will turn on when any driver is enabled
 //and turn off after the set amount of seconds from last driver being disabled again
@@ -438,6 +443,15 @@ const unsigned int dropsegments=5; //everything with less than this number of st
 #if TEMP_SENSOR_0 == -2
   #define HEATER_0_USES_MAX6675
 #endif
+#if TEMP_SENSOR_0 == -4
+  #define HEATER_0_USES_AD8495
+#endif
+#if TEMP_SENSOR_1 == -4
+  #define HEATER_1_USES_AD8495
+#endif
+#if TEMP_SENSOR_2 == -4
+  #define HEATER_2_USES_AD8495
+#endif
 #if TEMP_SENSOR_0 == 0
   #undef HEATER_0_MINTEMP
   #undef HEATER_0_MAXTEMP

+ 4 - 0
Firmware/temperature.cpp

@@ -948,7 +948,11 @@ static float analog2temp(int raw, uint8_t e) {
 
     return celsius;
   }
+#if defined(HEATER_0_USES_AD595)
   return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
+#elif defined (HEATER_0_USES_AD8495)
+  return ((raw * 5.0 / 1024.0 / OVERSAMPLENR) / 0.005 * TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET; //for 5V 10bit ADC
+#endif
 }
 
 // Derived from RepRap FiveD extruder::getTemperature()

+ 7 - 3
Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h

@@ -31,10 +31,11 @@
 
 
 // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
-#define E3D_PT100_EXTRUDER_WITH_AMP
+//#define E3D_PT100_EXTRUDER_WITH_AMP
 //#define E3D_PT100_EXTRUDER_NO_AMP
 //#define E3D_PT100_BED_WITH_AMP
 //#define E3D_PT100_BED_NO_AMP
+#define E3D_AD8495_EXTRUDER_WITH_AMP
 
 
 /*------------------------------------
@@ -310,7 +311,7 @@
 #define AMBIENT_MINTEMP -30
 
 // Maxtemps
-#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
+#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) || defined(E3D_AD8495_EXTRUDER_WITH_AMP)
 #define HEATER_0_MAXTEMP 410
 #else
 #define HEATER_0_MAXTEMP 305
@@ -320,7 +321,7 @@
 #define BED_MAXTEMP 125
 #define AMBIENT_MAXTEMP 100
 
-#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
+#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) || defined(E3D_AD8495_EXTRUDER_WITH_AMP)
 // Define PID constants for extruder with PT100
 #define  DEFAULT_Kp 21.70
 #define  DEFAULT_Ki 1.60
@@ -546,6 +547,7 @@
 //// Temperature sensor settings:
 // -2 is thermocouple with MAX6675 (only for sensor 0)
 // -1 is thermocouple with AD595
+// -4 is thermocouple with AD8495 (4.7k pullup removed)
 // 0 is not used
 // 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
 // 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
@@ -581,6 +583,8 @@
 #define TEMP_SENSOR_0 247
 #elif defined(E3D_PT100_EXTRUDER_NO_AMP)
 #define TEMP_SENSOR_0 148
+#elif defined(E3D_AD8495_EXTRUDER_WITH_AMP)
+#define TEMP_SENSOR_0 -4
 #else
 #define TEMP_SENSOR_0 5
 #endif