3D打印机的固件非常多,但是常用的也就几种。Sprinter、Marlin是使用人最多的。Sprinter功能相对简单,但是基本的功能都是有的;Marlin的功能相对复杂、强大(更多固件介绍,请 《3D打印技术普及(三)主流的3D打印机固件 》)。网上相关的配置文章页很多,但是很多都是不负责任的拷贝,和英文翻译,根本说的不清不楚。所以今天详细说明一下Marlin固件的配置方法。 固件里面有着大量的宏,和很多的条件编译,各个模块功能都是可以选择是否编译。一些重要的参数配置是通过宏定义的,都放在了 Configuration.h里面,所以我们配置固件的时候只需要简单的修改一下里面的东西就可以了。(并不难,所以新手并不需要担心软件方面的问题)。阅读代码我推荐大家使用Source Insight 3.5 网上可以下载到。主要修改的参数有波特率、控制板类型、挤出机喷嘴个数、打印机的各轴的运动行程、运动速度、运动单位距离所需要的脉冲数等。下面把需要配置的地方代码贴出来(行数和你的不一定一致,看具体代码为主)。 28行 #define BAUDRATE 250000 /* 配置通信波特率 */ 78行 #define MOTHERBOARD 33 /* 配置控制板类型 (我这里用的是RAMPS控制板)*/ 84行 #define EXTRUDERS 1 /* 配置挤出头个数 */ 124行 /* 配置温度传感器类型,最常用的是100K热敏电阻,选择1即可*/ #define TEMP_SENSOR_0 1/*挤出机0*/ #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_BED 1/*热床*/ 142行 //下面的配置是为了保护打印机而做的参数,一般情况不需要修改 // The minimal temperature defines the temperature below which the heater will not be enabled It is used // to check that the wiring to the thermistor is not broken. // Otherwise this would lead to the heater being powered on all the time. #define HEATER_0_MINTEMP 5 #define HEATER_1_MINTEMP 5 #define HEATER_2_MINTEMP 5 #define BED_MINTEMP 5 //温度低于5度时,打印机将不能启动,表现为报错,并且加热头和热床的加热无法打开 //下面的最高温度的配置,防止将打印机烧坏 // When temperature exceeds max temp, your heater will be switched off. // This feature exists to protect your hotend from overheating accidentally, but NOT from thermistor short/failure! // You should use MINTEMP for thermistor short/failure protection. #define HEATER_0_MAXTEMP 275 #define HEATER_1_MAXTEMP 275 #define HEATER_2_MAXTEMP 275 #define BED_MAXTEMP 150 //此配置是为了防止加热床电阻太小,长时间加热容易烧mos管,增加这个数字,防止mos管太热,但加热时间会增长 // If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the // average current. The value should be an integer and the heat bed will be turned on for 1 interval of // HEATER_BED_DUTY_CYCLE_DIVIDER intervals. //#define HEATER_BED_DUTY_CYCLE_DIVIDER 4 228行 /* 保护挤出头配置 */ //this prevents dangerous Extruder moves, i.e. if the temperature is under the limit //can be software-disabled for whatever purposes by #define PREVENT_DANGEROUS_EXTRUDE //if PREVENT_DANGEROUS_EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately. #define PREVENT_LENGTHY_EXTRUDE #define EXTRUDE_MINTEMP 170 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances. 245行 /* 限位开关上拉配置,机械开关应保留 */ // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors 268行 /* 机械限位开关不用修改*/ // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. 298行 /* 根据相应的机械情况进行修改,修改过后电机会反转 */ #define INVERT_X_DIR true // for Mendel set to false, for Orca set to true #define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false #define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true #define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false #define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false #define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false /* 回到原点方向配置,max为1 ,min为-1 */ // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 #define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. 316行 /* 打印尺寸配置*/ // Travel limits after homing #define X_MAX_POS 180 #define X_MIN_POS 0 #define Y_MAX_POS 180 #define Y_MIN_POS 0 #define Z_MAX_POS 100 #define Z_MIN_POS 0 #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS) #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS) #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS) 405行 /* 每运动1mm所需要的步数(已经被划分了 1/16) // default settings #define DEFAULT_AXIS_STEPS_PER_UNIT {57.1284,57.1284,2560,625} // default steps per unit for Ultimaker #define DEFAULT_MAX_FEEDRATE {500, 500, 2.5, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot. #define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves #define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts 446行 /* 预加热配置,默认即可*/ // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 #define PLA_PREHEAT_HPB_TEMP 70 #define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 #define ABS_PREHEAT_HOTEND_TEMP 240 #define ABS_PREHEAT_HPB_TEMP 100 #define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 /* LCD 和SD 卡配置*/ //LCD and SD support //#define ULTRA_LCD //general lcd support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) //#define SDSUPPORT // Enable SD Card Support in Hardware Console //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error) //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store. //#define ULTIPANEL //the ultipanel as on thingiverse 需要修改的地方拿红色标注出来了。基本都很简单,都是选择性的配置,有一个地方需要注意一下,就是405行,每运动1mm所需要的步数。这个是计算工具http://calculator./#steppers ,输入自己机器的相应的参数就可以了。下面我来说明一下 #define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,2560,625} // default steps per unit for Ultimaker #define DEFAULT_MAX_FEEDRATE {500, 500, 2.5, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated 第一行是配置X、Y、Z、E轴每运动1mm步进电机所需要脉冲数 第二行是配置各轴的运动速度 第三行是最大加速度 第一行是肯定需要修改的,X、Y轴是一样的(前提是同步轮一样)。我这里用的是20齿,齿距为2mm的S2M同步轮,运动一周的距离是:20*2mm=40mm 42步进电机电机运动一周需要200个脉冲,我们步进电机驱动芯片A4988可以再进行细分。(默认是1/16细分,有3个引脚接了短路帽接地,如果前面2个短路帽接地那就是1/8细分)。那运动一周需要200*16=3200个脉冲。这样每运动1mm需要脉冲数=3200/40=80。其他几个轴的配置方法也是一样。第二行各轴速度可以不修改,当是当你Z轴往上运动比较困难的时候,修改Z轴速度(调小,我这里把默认的5改成2.5了)。第三行加速度,默认即可。 |
|