背景介紹:
參數(shù)Steps per mm:這個參數(shù)是決定了工作臺每運動1mm,步進電機需要多少個脈沖。
計算方法(公式)=(步進電機旋轉1圈的標準脈沖數(shù)*驅動器細分數(shù))/絲杠導程(導程也就是螺距,如果絲杠不是直接連接電機而是通過減速后連接則計算結果還需要再乘以減速比)
例如:1.8度/脈沖的步進電機旋轉1圈需要360/1.8度=200個脈沖。驅動器使用8細分,絲杠導程為2.5mm。
Steps per=200*8/2.5=640個脈沖
http://reprap.org/wiki/Arduino_GCode_Interpreter
Usage
Firmware Configuration
In order for the firmware to operate properly, you must configure the proper variables in the firmware and then upload the firmware to your Arduino. The values are stored in the file _init.pde. An example version is included in the distribution called _init.pde.dist.
We'll cover each of the variables below:
X_STEPS_PER_INCH
This variable stores how many steps to take to move the X axis 1 inch. You will need to set this as accurately as possible if you want your machine to be accurate. There are two ways to set it:
Move and Measure - slap a pen or marker on as a toolhead and draw a 1000 step line. Measure it and divide 1000 by the length in inches.
Calculate Step Size - this one is the preferred way of doing things. Its rather easy to calculate step size based on your drive mechanism.
For threaded rod drive systems:
Find your TPI (threads per inch). for example, 1/4"-20 threaded rod means that there are 20 threads per inch (aka 20 turns = 1 inch.) Simply take that number and multiply it by the steps in a revolution. With a 400 step motor, it would be 8000 steps per inch.
For belt/pulley systems:
Find the circumference of your drive pulley. (remember circumference = 2*pi*r) (say: 2.75")
Calculate step size (ie: circumference / steps per revolution) (say: 2.75" / 400 = 0.00625")
Divide 1 inch by step size (1" / 0.00625" = 160 steps/inch)
X_STEPS_PER_MM
This variable stores how many steps to take to move the X axis 1mm. You can either calculate it independently, or take the number above and divide by 25.4.
實際設置:
在用雕刻機改裝成RepRap的過程中,遇到問題。電腦上面發(fā)指令走100mm,機器實際上只走了25mm。查閱資料無數(shù),始終不得要領。
根據(jù)上面的知識,理論上X_STEPS_PER_MM的設置應該是160(雕刻機原來是8細分,320 steps per mm,絲杠導程為5mm)。RepRap默認是4細分的。
可是實際上,當設置超過18以后,就走不動了。A3977的電流、細分都調過。始終無法解決。
在“process_g_code.pde”里面,把收到的GCode都加大4倍,可以暫時解決這個問題- //did we get a gcode?
- if (gc.seen & GCODE_G)
- {
- last_gcode_g = gc.G; /* remember this for future instructions */
- fp = where_i_am;
- if (abs_mode)
- {
- if (gc.seen & GCODE_X)
- fp.x = gc.X;
- if (gc.seen & GCODE_Y)
- fp.y = gc.Y;
- if (gc.seen & GCODE_Z)
- fp.z = gc.Z;
- if (gc.seen & GCODE_E)
- fp.e = gc.E;
- }
- else
- {
- if (gc.seen & GCODE_X)
- fp.x += gc.X;
- if (gc.seen & GCODE_Y)
- fp.y += gc.Y;
- if (gc.seen & GCODE_Z)
- fp.z += gc.Z;
- if (gc.seen & GCODE_E)
- fp.e += gc.E;
- }
復制代碼 |
|