Welcome! Log In Create A New Profile

Advanced

User thermistor tables in Repetier firmware

Posted by kscharf 
User thermistor tables in Repetier firmware
August 22, 2014 10:33PM
I thought I had the user temperature table working in Repetier firmware, it looks like it IS working on my extruder. I had added the table for thermistor #7 from marlin in the configuration table, but I just noticed that I the number of temperatures was wrong (the table is 58 pairs long, I had the number at 67. It was copied from a post on this forum.) and YET it compiled. I corrected the number, and I also added another table for thermistor #10 from marlin (I just bought an aluhotend). What bothers me, is that with the new table added, the sketch length IS THE SAME! If I remove both tables, or change the ext0 sensor type back to zero, the sketch length remains the same! This indicates to me that the added tables are being ignored by the compiler. BTW I'm using Arduino 1.0.5 on Linux.

....exert of configuration.h below.....

//for Marlin # 7
#define EXT0_TEMPSENSOR_TYPE 5


//Type 5
//two defines in a row, the second probably took over.....
//#define USER_THERMISTORTABLE0 {}
//#define NUM_TEMPS_USERTHERMISTOR0 0
// This was wrong! How did it ever work?
//#define NUM_TEMPS_USERTHERMISTOR0 67
#define NUM_TEMPS_USERTHERMISTOR0 58
#define USER_THERMISTORTABLE0 {\
{1*4, 941*8},\
{19*4, 362*8},\
{37*4, 299*8},\
{55*4, 266*8},\
{73*4, 245*8},\
{91*4, 229*8},\
{109*4, 216*8},\
{127*4, 206*8},\
{145*4, 197*8},\
{163*4, 190*8},\
{181*4, 183*8},\
{199*4, 177*8},\
{217*4, 171*8},\
{235*4, 166*8},\
{253*4, 162*8},\
{271*4, 157*8},\
{289*4, 153*8},\
{307*4, 149*8},\
{325*4, 146*8},\
{343*4, 142*8},\
{361*4, 139*8},\
{379*4, 135*8},\
{397*4, 132*8},\
{415*4, 129*8},\
{433*4, 126*8},\
{451*4, 123*8},\
{469*4, 121*8},\
{487*4, 118*8},\
{505*4, 115*8},\
{523*4, 112*8},\
{541*4, 110*8},\
{559*4, 107*8},\
{577*4, 105*8},\
{595*4, 102*8},\
{613*4, 99*8},\
{631*4, 97*8},\
{649*4, 94*8},\
{667*4, 92*8},\
{685*4, 89*8},\
{703*4, 86*8},\
{721*4, 84*8},\
{739*4, 81*8},\
{757*4, 78*8},\
{775*4, 75*8},\
{793*4, 72*8},\
{811*4, 69*8},\
{829*4, 66*8},\
{847*4, 62*8},\
{865*4, 59*8},\
{883*4, 55*8},\
{901*4, 51*8},\
{919*4, 46*8},\
{937*4, 41*8},\
{955*4, 35*8},\
{973*4, 27*8},\
{991*4, 17*8},\
{1009*4, 1*8},\
{1023*4, 0}}


//Type 6
#define NUM_TEMPS_USERTHERMISTOR1 31
#define USER_THERMISTORTABLE1 {\
{1*4, 929*8},\
{36*4, 299*8},\
{71*4, 246*8},\
{106*4, 217*8},\
{141*4, 198*8},\
{176*4, 184*8},\
{211*4, 173*8},\
{246*4, 163*8},\
{281*4, 154*8},\
{316*4, 147*8},\
{351*4, 140*8},\
{386*4, 134*8},\
{421*4, 128*8},\
{456*4, 122*8},\
{491*4, 117*8},\
{526*4, 112*8},\
{561*4, 107*8},\
{596*4, 102*8},\
{631*4, 97*8},\
{666*4, 91*8},\
{701*4, 86*8},\
{736*4, 81*8},\
{771*4, 76*8},\
{806*4, 70*8},\
{841*4, 63*8},\
{876*4, 56*8},\
{911*4, 48*8},\
{946*4, 38*8},\
{981*4, 23*8},\
{1005*4, 5*8},\
{1016*4, 0*8}}
Re: User thermistor tables in Repetier firmware
August 23, 2014 02:44AM
It in deed works with large rnumers of tempertures then present. This is because we search from the beginning until we find a matching range, which normally happens before the end of list. If that would not happen we would overflow the array and use the garbage found behind as temperature conversion.

Why the code did not get longer I can not say. As you see in this code from Extruder.cpp

#if NUM_TEMPS_USERTHERMISTOR1>0
const short temptable_6[NUM_TEMPS_USERTHERMISTOR1][2] PROGMEM = USER_THERMISTORTABLE1 ;
#endif

the table gets inserted as soon as NUM_TEMPS_USERTHERMISTOR1 is larger zero.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: User thermistor tables in Repetier firmware
March 21, 2016 08:02AM
Repetier doesn't use the temperature table I made.
Temperature reading is off 25C to 30C. When the room temperature is 25C, it reads 46C to 47C.

Are there any codes that I need to modify?

/*
   This file is optimized for version 0.92
   generator: [www.repetier.com]
*/

#define PID_CONTROL_RANGE 20
#define SKIP_M109_IF_WITHIN 2
#define SCALE_PID_TO_MAX 0
#define TEMP_HYSTERESIS 0
#define EXTRUDE_MAXLENGTH 160
#define NUM_TEMPS_USERTHERMISTOR0 35 // 0
#define USER_THERMISTORTABLE0 {\
 {51*4, 260*8},\
 {52*4, 250*8},\
 {62*4, 240*8},\
 {76*4, 230*8},\
 {81*4, 225*8},\
 {92*4, 220*8},\
 {97*4, 215*8},\
 {116*4, 210*8},\
 {119*4, 205*8},\
 {134*4, 200*8},\
 {140*4, 195*8},\
 {128*4, 190*8},\
 {177*4, 180*8},\
 {215*4, 170*8},\
 {247*4, 160*8},\
 {335*4, 150*8},\
 {407*4, 140*8},\
 {461*4, 130*8},\
 {550*4, 120*8},\
 {665*4, 110*8},\
 {724*4, 105*8},\
 {820*4, 100*8},\
 {1017*4, 90*8},\
 {1167*4, 80*8},\
 {1380*4, 70*8},\
 {1638*4, 60*8},\
 {1789*4, 58*8},\
 {1910*4, 50*8},\
 {2113*4, 45*8},\
 {2191*4, 40*8},\
 {2244*4, 35*8},\
 {2301*4, 30*8},\
 {2615*4, 27*8},\
 {3124*4, 11*8},\
 {3444*4, 0*8} }
#define NUM_TEMPS_USERTHERMISTOR1 0
#define USER_THERMISTORTABLE1 {}
#define NUM_TEMPS_USERTHERMISTOR2 0
#define USER_THERMISTORTABLE2 {}
#define USE_GENERIC_THERMISTORTABLE_1 //
#define GENERIC_THERM1_T0 25  // 1
#define GENERIC_THERM1_R0 20000
#define GENERIC_THERM1_BETA 3991
#define GENERIC_THERM1_MIN_TEMP -40
#define GENERIC_THERM1_MAX_TEMP 250
#define GENERIC_THERM1_R1 0
#define GENERIC_THERM1_R2 4700
#define GENERIC_THERM_VREF 5
#define GENERIC_THERM_NUM_ENTRIES 35
#define HEATER_PWM_SPEED 0
Re: User thermistor tables in Repetier firmware
March 21, 2016 08:34AM
You need to set thermstor type to 5 to use the USER_THERMISTORTABLE0 table.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: User thermistor tables in Repetier firmware
March 21, 2016 09:30PM
@repetier

I set the value to 5 and it read thermistor temperature. But the temperature was off 100C.

#define EXT0_TEMPSENSOR_TYPE 5 // 97

#define NUM_TEMPS_USERTHERMISTOR0 35 // 28  
#define USER_THERMISTORTABLE0 {\
 {51*4, 260*8},\
 {52*4, 250*8},\
 {62*4, 240*8},\
 {76*4, 230*8},\
 {81*4, 225*8},\
 {92*4, 220*8},\
 {97*4, 215*8},\
 {116*4, 210*8},\
 {119*4, 205*8},\
 {134*4, 200*8},\
 {140*4, 195*8},\
 {128*4, 190*8},\
 {177*4, 180*8},\
 {215*4, 170*8},\
 {247*4, 160*8},\
 {335*4, 150*8},\
 {407*4, 140*8},\
 {461*4, 130*8},\
{550*4, 120*8},\
 {665*4, 110*8},\
 {724*4, 105*8},\
 {820*4, 100*8},\
 {1017*4, 90*8},\
 {1167*4, 80*8},\
 {1380*4, 70*8},\
 {1638*4, 60*8},\
 {1789*4, 58*8},\
 {1910*4, 50*8},\
 {2113*4, 45*8},\
 {2191*4, 40*8},\
 {2244*4, 35*8},\
 {2301*4, 30*8},\
 {2615*4, 27*8},\
 {3124*4, 11*8},\
 {3444*4, 0*8} }

I generated manually below table on the configuration tool menu of Repetier website.
I referenced the termistor's data sheet to generate the temperature-resistance table.
(NTC-20KGJG, 20.0 kohm at 25C, B constant (25/85C) 3991)

# python 3

resistance_temperature = ( NTC-20KGJG, 20.0 kohm at 25C, B constant (25/85C)
        (-10.0, 5.6191), NTC-20KGJG, 20.0 kohm at 25C, B constant (25/85C)
        (5.0,   4.2837),
        (0.0, 3.2951),
        (5.0, 2.5563),
        (10.0, 1.9992),
        (15.0, 1.5756),
        (20.0, 1.2509),
        (25.0, 1.0),
        (30.0, 0.80447),
        (35.0, 0.65178),
        (40.0, 0.43523),
        (50.0, 0.35867),
        (55.0, 0.29715),
        (60.0, 0.24744),
        (65.0, 0.20705),
        (70.0, 0.17407),
        (75.0, 0.14700),
        (80.0, 0.12468),
        (85.0, 0.10619),
        (90.0, 0.090802),
        (95.0, 0.077947),
        (100.0, 0.067161),
        (105.0, 0.058076),
        (110.0, 0.050395),
        (105.0, 0.058076),
        (110.0, 0.050395),
        (115.0, 0.043876),
        (120.0, 0.038325),
        (125.0, 0.033581),
        (130.0, 0.029513),
        (135.0, 0.026015),
        (140.0, 0.022997),
        (145.0, 0.020385),
        (150.0, 0.018118),
        (155.0, 0.016145),
        (160.0, 0.014423),
        (165.0, 0.012916),
        (170.0, 0.011595),
        (175.0, 0.010432),
        (180.0, 0.0094078),
        (185.0, 0.0085024),
        (190.0, 0.0077006),
        (195.0, 0.0069890),
        (200.0, 0.0063559),
        (205.0, 0.0057917),
        (210.0, 0.0052878),
        (215.0, 0.0048367),
        (220.0, 0.0044323),
        (225.0, 0.0040690),
        (230.0, 0.0037421),
        (235.0, 0.0034473),
        (240.0, 0.0031811),
        (245.0, 0.0029403),
        (250.0, 0.0027220)
        )

for item in resistance_temperature:
    r = int(item[1] * 20000.0)
    print('{0} -> {1}'.format(item[0], r))

'''
Output
-10.0 -> 112382
5.0 -> 85673
0.0 -> 65902
5.0 -> 51125
10.0 -> 39984
15.0 -> 31511
20.0 -> 25017
25.0 -> 20000
30.0 -> 16089
35.0 -> 13035
40.0 -> 8704
50.0 -> 7173
55.0 -> 5943
60.0 -> 4948
65.0 -> 4141
70.0 -> 3481
75.0 -> 2940
80.0 -> 2493
85.0 -> 2123
90.0 -> 1816
95.0 -> 1558
100.0 -> 1343
105.0 -> 1161
110.0 -> 1007
115.0 -> 877
120.0 -> 766
125.0 -> 671
130.0 -> 590
135.0 -> 520
140.0 -> 459
145.0 -> 407
150.0 -> 362
155.0 -> 322
160.0 -> 288
165.0 -> 258
170.0 -> 231
175.0 -> 208
180.0 -> 188
185.0 -> 170
190.0 -> 154
195.0 -> 139
200.0 -> 127
205.0 -> 115
210.0 -> 105
215.0 -> 96
220.0 -> 88
225.0 -> 81
230.0 -> 74
235.0 -> 68
240.0 -> 63
245.0 -> 58
250.0 -> 54
'''

#define USER_THERMISTORTABLE0 {{47,2000},{50,1960},{54,1920},{58,1880},{63,1840},{69,1800},{75,1760},{82,1720},{89,1680},{98,1640},{108,1600},{118,1560},{130,1520},{143,1480},{158,1440},{174,1400},{192,1360},{213,1320},{236,1280},{364,1120},{574,960},{910,800},{1419,640},{2100,480},{2659,320},{3316,200},{3750,40},{3931,-80}}

Temperature reading was from 15C to 17C off.
Sorry, only registered users may post in this forum.

Click here to login