My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

thermistors.h 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #ifndef THERMISTORS_H_
  23. #define THERMISTORS_H_
  24. #include "../../inc/MarlinConfig.h"
  25. #define OVERSAMPLENR 16
  26. #define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n)
  27. // Pt1000 and Pt100 handling
  28. //
  29. // Rt=R0*(1+a*T+b*T*T) [for T>0]
  30. // a=3.9083E-3, b=-5.775E-7
  31. #define PtA 3.9083E-3
  32. #define PtB -5.775E-7
  33. #define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T)))
  34. #define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
  35. #define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T },
  36. #if ANY_THERMISTOR_IS(1) // 100k bed thermistor
  37. #include "thermistor_1.h"
  38. #endif
  39. #if ANY_THERMISTOR_IS(2) // 200k bed thermistor
  40. #include "thermistor_2.h"
  41. #endif
  42. #if ANY_THERMISTOR_IS(3) // mendel-parts
  43. #include "thermistor_3.h"
  44. #endif
  45. #if ANY_THERMISTOR_IS(4) // 10k thermistor
  46. #include "thermistor_4.h"
  47. #endif
  48. #if ANY_THERMISTOR_IS(5) // 100k ParCan thermistor (104GT-2)
  49. #include "thermistor_5.h"
  50. #endif
  51. #if ANY_THERMISTOR_IS(6) // 100k Epcos thermistor
  52. #include "thermistor_6.h"
  53. #endif
  54. #if ANY_THERMISTOR_IS(7) // 100k Honeywell 135-104LAG-J01
  55. #include "thermistor_7.h"
  56. #endif
  57. #if ANY_THERMISTOR_IS(71) // 100k Honeywell 135-104LAF-J01
  58. #include "thermistor_71.h"
  59. #endif
  60. #if ANY_THERMISTOR_IS(8) // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
  61. #include "thermistor_8.h"
  62. #endif
  63. #if ANY_THERMISTOR_IS(9) // 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
  64. #include "thermistor_9.h"
  65. #endif
  66. #if ANY_THERMISTOR_IS(10) // 100k RS thermistor 198-961 (4.7k pullup)
  67. #include "thermistor_10.h"
  68. #endif
  69. #if ANY_THERMISTOR_IS(11) // QU-BD silicone bed QWG-104F-3950 thermistor
  70. #include "thermistor_11.h"
  71. #endif
  72. #if ANY_THERMISTOR_IS(13) // Hisens thermistor B25/50 =3950 +/-1%
  73. #include "thermistor_13.h"
  74. #endif
  75. #if ANY_THERMISTOR_IS(20) // PT100 with INA826 amp on Ultimaker v2.0 electronics
  76. #include "thermistor_20.h"
  77. #endif
  78. #if ANY_THERMISTOR_IS(51) // 100k EPCOS (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
  79. #include "thermistor_51.h"
  80. #endif
  81. #if ANY_THERMISTOR_IS(52) // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
  82. #include "thermistor_52.h"
  83. #endif
  84. #if ANY_THERMISTOR_IS(55) // 100k ATC Semitec 104GT-2 (Used on ParCan) (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
  85. #include "thermistor_55.h"
  86. #endif
  87. #if ANY_THERMISTOR_IS(60) // Maker's Tool Works Kapton Bed Thermistor
  88. #include "thermistor_60.h"
  89. #endif
  90. #if ANY_THERMISTOR_IS(66) // DyzeDesign 500°C Thermistor
  91. #include "thermistor_66.h"
  92. #endif
  93. #if ANY_THERMISTOR_IS(12) // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
  94. #include "thermistor_12.h"
  95. #endif
  96. #if ANY_THERMISTOR_IS(70) // bqh2 stock thermistor
  97. #include "thermistor_70.h"
  98. #endif
  99. #if ANY_THERMISTOR_IS(75) // Many of the generic silicon heat pads use the MGB18-104F39050L32 Thermistor
  100. #include "thermistor_75.h"
  101. #endif
  102. #if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
  103. #include "thermistor_110.h"
  104. #endif
  105. #if ANY_THERMISTOR_IS(147) // Pt100 with 4k7 pullup
  106. #include "thermistor_147.h"
  107. #endif
  108. #if ANY_THERMISTOR_IS(1010) // Pt1000 with 1k0 pullup
  109. #include "thermistor_1010.h"
  110. #endif
  111. #if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
  112. #include "thermistor_1047.h"
  113. #endif
  114. #if ANY_THERMISTOR_IS(998) // User-defined table 1
  115. #include "thermistor_998.h"
  116. #endif
  117. #if ANY_THERMISTOR_IS(999) // User-defined table 2
  118. #include "thermistor_999.h"
  119. #endif
  120. #define _TT_NAME(_N) temptable_ ## _N
  121. #define TT_NAME(_N) _TT_NAME(_N)
  122. #ifdef THERMISTORHEATER_0
  123. #define HEATER_0_TEMPTABLE TT_NAME(THERMISTORHEATER_0)
  124. #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
  125. #elif defined(HEATER_0_USES_THERMISTOR)
  126. #error "No heater 0 thermistor table specified"
  127. #else
  128. #define HEATER_0_TEMPTABLE NULL
  129. #define HEATER_0_TEMPTABLE_LEN 0
  130. #endif
  131. #ifdef THERMISTORHEATER_1
  132. #define HEATER_1_TEMPTABLE TT_NAME(THERMISTORHEATER_1)
  133. #define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
  134. #elif defined(HEATER_1_USES_THERMISTOR)
  135. #error "No heater 1 thermistor table specified"
  136. #else
  137. #define HEATER_1_TEMPTABLE NULL
  138. #define HEATER_1_TEMPTABLE_LEN 0
  139. #endif
  140. #ifdef THERMISTORHEATER_2
  141. #define HEATER_2_TEMPTABLE TT_NAME(THERMISTORHEATER_2)
  142. #define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
  143. #elif defined(HEATER_2_USES_THERMISTOR)
  144. #error "No heater 2 thermistor table specified"
  145. #else
  146. #define HEATER_2_TEMPTABLE NULL
  147. #define HEATER_2_TEMPTABLE_LEN 0
  148. #endif
  149. #ifdef THERMISTORHEATER_3
  150. #define HEATER_3_TEMPTABLE TT_NAME(THERMISTORHEATER_3)
  151. #define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
  152. #elif defined(HEATER_3_USES_THERMISTOR)
  153. #error "No heater 3 thermistor table specified"
  154. #else
  155. #define HEATER_3_TEMPTABLE NULL
  156. #define HEATER_3_TEMPTABLE_LEN 0
  157. #endif
  158. #ifdef THERMISTORHEATER_4
  159. #define HEATER_4_TEMPTABLE TT_NAME(THERMISTORHEATER_4)
  160. #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE)
  161. #elif defined(HEATER_4_USES_THERMISTOR)
  162. #error "No heater 4 thermistor table specified"
  163. #else
  164. #define HEATER_4_TEMPTABLE NULL
  165. #define HEATER_4_TEMPTABLE_LEN 0
  166. #endif
  167. #ifdef THERMISTORBED
  168. #define BEDTEMPTABLE TT_NAME(THERMISTORBED)
  169. #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
  170. #else
  171. #ifdef BED_USES_THERMISTOR
  172. #error "No bed thermistor table specified"
  173. #endif
  174. #endif
  175. // Set the high and low raw values for the heaters
  176. // For thermistors the highest temperature results in the lowest ADC value
  177. // For thermocouples the highest temperature results in the highest ADC value
  178. #ifndef HEATER_0_RAW_HI_TEMP
  179. #ifdef HEATER_0_USES_THERMISTOR
  180. #define HEATER_0_RAW_HI_TEMP 0
  181. #define HEATER_0_RAW_LO_TEMP 16383
  182. #else
  183. #define HEATER_0_RAW_HI_TEMP 16383
  184. #define HEATER_0_RAW_LO_TEMP 0
  185. #endif
  186. #endif
  187. #ifndef HEATER_1_RAW_HI_TEMP
  188. #ifdef HEATER_1_USES_THERMISTOR
  189. #define HEATER_1_RAW_HI_TEMP 0
  190. #define HEATER_1_RAW_LO_TEMP 16383
  191. #else
  192. #define HEATER_1_RAW_HI_TEMP 16383
  193. #define HEATER_1_RAW_LO_TEMP 0
  194. #endif
  195. #endif
  196. #ifndef HEATER_2_RAW_HI_TEMP
  197. #ifdef HEATER_2_USES_THERMISTOR
  198. #define HEATER_2_RAW_HI_TEMP 0
  199. #define HEATER_2_RAW_LO_TEMP 16383
  200. #else
  201. #define HEATER_2_RAW_HI_TEMP 16383
  202. #define HEATER_2_RAW_LO_TEMP 0
  203. #endif
  204. #endif
  205. #ifndef HEATER_3_RAW_HI_TEMP
  206. #ifdef HEATER_3_USES_THERMISTOR
  207. #define HEATER_3_RAW_HI_TEMP 0
  208. #define HEATER_3_RAW_LO_TEMP 16383
  209. #else
  210. #define HEATER_3_RAW_HI_TEMP 16383
  211. #define HEATER_3_RAW_LO_TEMP 0
  212. #endif
  213. #endif
  214. #ifndef HEATER_4_RAW_HI_TEMP
  215. #ifdef HEATER_4_USES_THERMISTOR
  216. #define HEATER_4_RAW_HI_TEMP 0
  217. #define HEATER_4_RAW_LO_TEMP 16383
  218. #else
  219. #define HEATER_4_RAW_HI_TEMP 16383
  220. #define HEATER_4_RAW_LO_TEMP 0
  221. #endif
  222. #endif
  223. #ifndef HEATER_BED_RAW_HI_TEMP
  224. #ifdef BED_USES_THERMISTOR
  225. #define HEATER_BED_RAW_HI_TEMP 0
  226. #define HEATER_BED_RAW_LO_TEMP 16383
  227. #else
  228. #define HEATER_BED_RAW_HI_TEMP 16383
  229. #define HEATER_BED_RAW_LO_TEMP 0
  230. #endif
  231. #endif
  232. #endif // THERMISTORS_H_