Skip to content

Instantly share code, notes, and snippets.

@Wurstnase
Created November 19, 2015 18:27
Show Gist options
  • Save Wurstnase/fc34aeaf61c4fce18ef1 to your computer and use it in GitHub Desktop.
Save Wurstnase/fc34aeaf61c4fce18ef1 to your computer and use it in GitHub Desktop.
// Thermistor lookup table for RepRap Temperature Sensor Boards (http://reprap.org/wiki/Temperature_Sensor_2_0)
// Made with createTemperatureLookup.py (https://github.com/traumflug/Teacup_Firmware/blob/master/createTemperatureLookup.py)
// (patched per https://github.com/drf5n/Teacup_Firmware/blob/Gen7/createTemperatureLookup.py)
// default thermistor lookup table
// You may be able to improve the accuracy of this table in various ways.
// 1. Measure the actual resistance of the resistor. It's "nominally" 4.7K, but that's ± 5%.
// 2. Measure the actual beta of your thermistor:http://reprap.org/wiki/MeasuringThermistorBeta
// 3. Generate more table entries than you need, then trim down the ones in uninteresting ranges.
// In either case you'll have to regenerate this table, which requires python, which is difficult to install on windows.
// Since you'll have to do some testing to determine the correct temperature for your application anyway, you
// may decide that the effort isn't worth it. Who cares if it's reporting the "right" temperature as long as it's
// keeping the temperature steady enough to print, right?
// Temp*4 table from https://github.com/drf5n/Teacup_Firmware/blob/Gen7/createTemperatureLookup.py
// ./createTemperatureLookup.py --r0=10000 --t0=25 --r1=680 --r2=1600 --beta=3947 --max-adc=305 --min-adc=1 --multiplier=4 --vadc=5.0
// r0: 10000
// t0: 25
// r1: 680 (parallel with rTherm)
// r2: 1600 (series with rTherm)
// beta: 3947
// min adc: 1 at 0.0048828125 V
// max adc: 305 at 1.4892578125 V
// ADC counts from 1 to 305 by 16
#define NUMTEMPS 20
const uint16_t temptable[NUMTEMPS][2] PROGMEM = {
// {ADC, temp*4 }, // temp Rtherm Vtherm resolution power
{ 1, 2433}, // 608.44 C, 2 Ohm, 0.005 V, 118.68 C/count, 0.02mW
{ 17, 1051}, // 262.81 C, 28 Ohm, 0.083 V, 4.70 C/count, 0.25mW
{ 33, 860}, // 215.06 C, 58 Ohm, 0.161 V, 2.09 C/count, 0.45mW
{ 49, 755}, // 189.00 C, 91 Ohm, 0.239 V, 1.33 C/count, 0.63mW
{ 65, 683}, // 170.95 C, 129 Ohm, 0.317 V, 0.98 C/count, 0.78mW
{ 81, 627}, // 156.97 C, 172 Ohm, 0.396 V, 0.79 C/count, 0.91mW
{ 97, 581}, // 145.38 C, 222 Ohm, 0.474 V, 0.67 C/count, 1.01mW
{ 113, 541}, // 135.30 C, 280 Ohm, 0.552 V, 0.60 C/count, 1.09mW
{ 129, 504}, // 126.24 C, 349 Ohm, 0.630 V, 0.54 C/count, 1.14mW
{ 145, 471}, // 117.85 C, 431 Ohm, 0.708 V, 0.51 C/count, 1.16mW
{ 161, 439}, // 109.90 C, 532 Ohm, 0.786 V, 0.49 C/count, 1.16mW
{ 177, 408}, // 102.17 C, 658 Ohm, 0.864 V, 0.48 C/count, 1.14mW
{ 193, 377}, // 94.49 C, 819 Ohm, 0.942 V, 0.48 C/count, 1.08mW
{ 209, 346}, // 86.67 C, 1034 Ohm, 1.021 V, 0.50 C/count, 1.01mW
{ 225, 313}, // 78.49 C, 1335 Ohm, 1.099 V, 0.53 C/count, 0.90mW
{ 241, 278}, // 69.62 C, 1785 Ohm, 1.177 V, 0.58 C/count, 0.78mW
{ 257, 238}, // 59.51 C, 2533 Ohm, 1.255 V, 0.68 C/count, 0.62mW
{ 273, 188}, // 47.05 C, 4019 Ohm, 1.333 V, 0.89 C/count, 0.44mW
{ 289, 115}, // 28.97 C, 8404 Ohm, 1.411 V, 1.46 C/count, 0.24mW
{ 301, 2} // 0.56 C, 32605 Ohm, 1.470 V, 4.01 C/count, 0.07mW
};
const uint16_t THERMISTOR_EXTRUDER[NUMTEMPS][2] PROGMEM = {
// {ADC, temp*4 }, // temp Rtherm Vtherm resolution power
{ 1, 2433}, // 608.44 C, 2 Ohm, 0.005 V, 118.68 C/count, 0.02mW
{ 17, 1051}, // 262.81 C, 28 Ohm, 0.083 V, 4.70 C/count, 0.25mW
{ 33, 860}, // 215.06 C, 58 Ohm, 0.161 V, 2.09 C/count, 0.45mW
{ 49, 755}, // 189.00 C, 91 Ohm, 0.239 V, 1.33 C/count, 0.63mW
{ 65, 683}, // 170.95 C, 129 Ohm, 0.317 V, 0.98 C/count, 0.78mW
{ 81, 627}, // 156.97 C, 172 Ohm, 0.396 V, 0.79 C/count, 0.91mW
{ 97, 581}, // 145.38 C, 222 Ohm, 0.474 V, 0.67 C/count, 1.01mW
{ 113, 541}, // 135.30 C, 280 Ohm, 0.552 V, 0.60 C/count, 1.09mW
{ 129, 504}, // 126.24 C, 349 Ohm, 0.630 V, 0.54 C/count, 1.14mW
{ 145, 471}, // 117.85 C, 431 Ohm, 0.708 V, 0.51 C/count, 1.16mW
{ 161, 439}, // 109.90 C, 532 Ohm, 0.786 V, 0.49 C/count, 1.16mW
{ 177, 408}, // 102.17 C, 658 Ohm, 0.864 V, 0.48 C/count, 1.14mW
{ 193, 377}, // 94.49 C, 819 Ohm, 0.942 V, 0.48 C/count, 1.08mW
{ 209, 346}, // 86.67 C, 1034 Ohm, 1.021 V, 0.50 C/count, 1.01mW
{ 225, 313}, // 78.49 C, 1335 Ohm, 1.099 V, 0.53 C/count, 0.90mW
{ 241, 278}, // 69.62 C, 1785 Ohm, 1.177 V, 0.58 C/count, 0.78mW
{ 257, 238}, // 59.51 C, 2533 Ohm, 1.255 V, 0.68 C/count, 0.62mW
{ 273, 188}, // 47.05 C, 4019 Ohm, 1.333 V, 0.89 C/count, 0.44mW
{ 289, 115}, // 28.97 C, 8404 Ohm, 1.411 V, 1.46 C/count, 0.24mW
{ 301, 2} // 0.56 C, 32605 Ohm, 1.470 V, 4.01 C/count, 0.07mW
};
const uint16_t THERMISTOR_BED[NUMTEMPS][2] PROGMEM = {
// {ADC, temp*4 }, // temp Rtherm Vtherm resolution power
{ 1, 2433}, // 608.44 C, 2 Ohm, 0.005 V, 118.68 C/count, 0.02mW
{ 17, 1051}, // 262.81 C, 28 Ohm, 0.083 V, 4.70 C/count, 0.25mW
{ 33, 860}, // 215.06 C, 58 Ohm, 0.161 V, 2.09 C/count, 0.45mW
{ 49, 755}, // 189.00 C, 91 Ohm, 0.239 V, 1.33 C/count, 0.63mW
{ 65, 683}, // 170.95 C, 129 Ohm, 0.317 V, 0.98 C/count, 0.78mW
{ 81, 627}, // 156.97 C, 172 Ohm, 0.396 V, 0.79 C/count, 0.91mW
{ 97, 581}, // 145.38 C, 222 Ohm, 0.474 V, 0.67 C/count, 1.01mW
{ 113, 541}, // 135.30 C, 280 Ohm, 0.552 V, 0.60 C/count, 1.09mW
{ 129, 504}, // 126.24 C, 349 Ohm, 0.630 V, 0.54 C/count, 1.14mW
{ 145, 471}, // 117.85 C, 431 Ohm, 0.708 V, 0.51 C/count, 1.16mW
{ 161, 439}, // 109.90 C, 532 Ohm, 0.786 V, 0.49 C/count, 1.16mW
{ 177, 408}, // 102.17 C, 658 Ohm, 0.864 V, 0.48 C/count, 1.14mW
{ 193, 377}, // 94.49 C, 819 Ohm, 0.942 V, 0.48 C/count, 1.08mW
{ 209, 346}, // 86.67 C, 1034 Ohm, 1.021 V, 0.50 C/count, 1.01mW
{ 225, 313}, // 78.49 C, 1335 Ohm, 1.099 V, 0.53 C/count, 0.90mW
{ 241, 278}, // 69.62 C, 1785 Ohm, 1.177 V, 0.58 C/count, 0.78mW
{ 257, 238}, // 59.51 C, 2533 Ohm, 1.255 V, 0.68 C/count, 0.62mW
{ 273, 188}, // 47.05 C, 4019 Ohm, 1.333 V, 0.89 C/count, 0.44mW
{ 289, 115}, // 28.97 C, 8404 Ohm, 1.411 V, 1.46 C/count, 0.24mW
{ 301, 2} // 0.56 C, 32605 Ohm, 1.470 V, 4.01 C/count, 0.07mW
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment