From e4679c1b787887c466fa607b7408f69e420f4b90 Mon Sep 17 00:00:00 2001 From: Artur Petrzak Date: Fri, 31 Jan 2020 01:00:37 +0100 Subject: [PATCH] (21) PT100 for MCUs with 3.3v logic (#16731) --- Marlin/Configuration.h | 3 +- Marlin/src/lcd/thermistornames.h | 4 +- Marlin/src/module/thermistor/thermistor_21.h | 77 ++++++++++++++++++++ Marlin/src/module/thermistor/thermistors.h | 6 +- 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 Marlin/src/module/thermistor/thermistor_21.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 7f242dce7..550ea3546 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -379,7 +379,8 @@ * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" * 15 : 100k thermistor calibration for JGAurora A5 hotend * 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 - * 20 : Pt100 with circuit in the Ultimainboard V2.x + * 20 : Pt100 with circuit in the Ultimainboard V2.x with 5v excitation (AVR) + * 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v excitation (STM32 \ LPC176x....) * 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 * 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup diff --git a/Marlin/src/lcd/thermistornames.h b/Marlin/src/lcd/thermistornames.h index 17772d788..9cfb80fba 100644 --- a/Marlin/src/lcd/thermistornames.h +++ b/Marlin/src/lcd/thermistornames.h @@ -85,7 +85,9 @@ #elif THERMISTOR_ID == 18 #define THERMISTOR_NAME "ATC Semitec 204GT-2" #elif THERMISTOR_ID == 20 - #define THERMISTOR_NAME "Pt100 UltiMB" + #define THERMISTOR_NAME "Pt100 UltiMB 5v" +#elif THERMISTOR_ID == 21 + #define THERMISTOR_NAME "Pt100 UltiMB 3.3v" #elif THERMISTOR_ID == 201 #define THERMISTOR_NAME "Pt100 OverLord" #elif THERMISTOR_ID == 60 diff --git a/Marlin/src/module/thermistor/thermistor_21.h b/Marlin/src/module/thermistor/thermistor_21.h new file mode 100644 index 000000000..e65f90b75 --- /dev/null +++ b/Marlin/src/module/thermistor/thermistor_21.h @@ -0,0 +1,77 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define REVERSE_TEMP_SENSOR_RANGE + +#undef OV_SCALE +#define OV_SCALE(N) (float((N) * 5) / 3.3f) + +// Pt100 with INA826 amp with 3.3v excitation based on "Pt100 with INA826 amp on Ultimaker v2.0 electronics" +const short temptable_21[][2] PROGMEM = { + { OV( 0), 0 }, + { OV(227), 1 }, + { OV(236), 10 }, + { OV(245), 20 }, + { OV(253), 30 }, + { OV(262), 40 }, + { OV(270), 50 }, + { OV(279), 60 }, + { OV(287), 70 }, + { OV(295), 80 }, + { OV(304), 90 }, + { OV(312), 100 }, + { OV(320), 110 }, + { OV(329), 120 }, + { OV(337), 130 }, + { OV(345), 140 }, + { OV(353), 150 }, + { OV(361), 160 }, + { OV(369), 170 }, + { OV(377), 180 }, + { OV(385), 190 }, + { OV(393), 200 }, + { OV(401), 210 }, + { OV(409), 220 }, + { OV(417), 230 }, + { OV(424), 240 }, + { OV(432), 250 }, + { OV(440), 260 }, + { OV(447), 270 }, + { OV(455), 280 }, + { OV(463), 290 }, + { OV(470), 300 }, + { OV(478), 310 }, + { OV(485), 320 }, + { OV(493), 330 }, + { OV(500), 340 }, + { OV(507), 350 }, + { OV(515), 360 }, + { OV(522), 370 }, + { OV(529), 380 }, + { OV(537), 390 }, + { OV(544), 400 }, + { OV(614), 500 } +}; + +#undef OV_SCALE +#define OV_SCALE(N) (N) diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 875f742cc..58e1ef115 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -37,7 +37,8 @@ #error "MAX_RAW_THERMISTOR_VALUE is too large for int16_t. Reduce OVERSAMPLENR or HAL_ADC_RESOLUTION." #endif -#define OV(N) int16_t((N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE)) +#define OV_SCALE(N) (N) +#define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE)) #define ANY_THERMISTOR_IS(n) (THERMISTOR_HEATER_0 == n || THERMISTOR_HEATER_1 == n || THERMISTOR_HEATER_2 == n || THERMISTOR_HEATER_3 == n || THERMISTOR_HEATER_4 == n || THERMISTOR_HEATER_5 == n || THERMISTOR_HEATER_6 == n || THERMISTOR_HEATER_7 == n || THERMISTORBED == n || THERMISTORCHAMBER == n || THERMISTORPROBE == n) @@ -105,6 +106,9 @@ #if ANY_THERMISTOR_IS(20) // Pt100 with INA826 amp on Ultimaker v2.0 electronics #include "thermistor_20.h" #endif +#if ANY_THERMISTOR_IS(21) // Pt100 with INA826 amp with 3.3v excitation based on "Pt100 with INA826 amp on Ultimaker v2.0 electronics" + #include "thermistor_21.h" +#endif #if ANY_THERMISTOR_IS(51) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 1 kOhm, "EPCOS" #include "thermistor_51.h" #endif