stepconf.txt
1 = Stepper Configuration Wizard 2 3 [[cha:stepconf-wizard]] 4 5 == Introduction 6 7 LinuxCNC is capable of controlling a wide range of machinery 8 using many different hardware interfaces. 9 10 Stepconf is a program that generates configuration files for LinuxCNC 11 for a specific class of CNC machine: 12 those that are controlled via a 'standard parallel port', and 13 controlled by signals of type 'step & direction'. 14 15 Stepconf is installed when you install LinuxCNC and is in the CNC menu. 16 17 Stepconf places a file in the linuxcnc/config directory 18 to store the choices for each configuration you create. 19 When you change something, you need to pick the file 20 that matches your configuration name. 21 The file extension is .stepconf. 22 23 The Stepconf Wizard works best with at least 800 x 600 screen resolution. 24 25 26 == Start Page 27 28 .Entry Page 29 30 image::images/stepconf-start_en.png[align="center", alt="Entry Page"] 31 32 * 'Create New' - Creates a fresh configuration. 33 34 * 'Modify' - Modify an existing configuration. After selecting this a file 35 picker pops up so you can select the .stepconf file for modification. If you 36 made any modifications to the main .hal or the .ini file these will be lost. 37 Modifications to custom.hal and custom_postgui.hal will not be changed by 38 the Stepconf Wizard. Stepconf will highlight the lastconf that was built. 39 40 * 'Import' - Import a Mach configuration file and attempt to convert it to 41 a linuxcnc config file. After the import, you will go though the pages 42 of stepconf to confirm/modify the entries. The original mach xml file will 43 not be changed. 44 45 These next options will be recorded in a preference file for the next run of 46 Stepconf. 47 48 * 'Create Desktop Shortcut' - This will place a link on your desktop to the 49 files. 50 51 * 'Create Desktop Launcher' - This will place a launcher on your desktop to 52 start your application. 53 54 * 'Create Simulated Hardware' - This allows you to build a config for testing, 55 even if you don't have the actual hardware. 56 57 == Basic Information 58 59 .Basic Information Page 60 61 image::images/stepconf-base_en.png[align="center", alt="Basic Information Page"] 62 63 * 'Machine Name' - Choose a name for your machine. Use only uppercase letters, 64 lowercase letters, digits, - and _. 65 66 * 'Axis Configuration' - Choose XYZ (Mill), XYZA (4-axis mill) or XZ (Lathe). 67 68 * 'Machine Units' - Choose Inch or mm. All subsequent entries will be in the 69 chosen units. Changing this also changes the default values in the Axes section. 70 If you change this after selecting values in any of the axes sections, they will 71 be over-written by the default values of the selected units. 72 73 * 'Driver Type' - If you have one of the stepper drivers listed in the pull down 74 box, choose it. Otherwise, select 'Other' and find the timing values in your 75 driver's data sheet and enter them as 'nano seconds' in the 'Driver Timing 76 Settings'. If the data sheet gives a value in microseconds, multiply by 1000. 77 For example, enter 4.5us as 4500ns. 78 79 A list of some popular drives, along with their timing values, is on the 80 LinuxCNC.org Wiki under 81 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Stepper_Drive_Timing[Stepper Drive Timing]. 82 83 Additional signal conditioning or isolation such as optocouplers and RC filters 84 on break out boards can impose timing constraints of their own, in addition 85 to those of the driver. You may find it necessary to add some time to the 86 drive requirements to allow for this. 87 88 The LinuxCNC Configuration Selector has configs for Sherline already configured. 89 90 * 'Step Time' - How long the step pulse is 'on' in nano seconds. If your not 91 sure about this setting a value of 20,000 will work with most drives. 92 93 * 'Step Space' - Minimum time between step pulses in nano seconds. If your 94 not sure about this setting a value of 20,000 will work with most drives. 95 96 * 'Direction Hold' - How long the direction pin is held after a change of 97 direction in nanoseconds. If your not sure about this setting a value of 98 20,000 will work with most drives. 99 100 * 'Direction Setup' - How long before a direction change after the last 101 step pulse in nanoseconds. If your not sure about this setting a value of 102 20,000 will work with most drives. 103 104 * 'One / Two Parport' - Select how many parallel port are to be configured. 105 106 * 'Base Period Maximum Jitter' - Enter the result of the Latency Test here. 107 To run a latency test press the 'Test Base Period Jitter' button. See the 108 <<latency-test,Latency Test>> section for more details. 109 110 * 'Max Step Rate' -Stepconf automatically calculates the Max Step Rate based 111 on the driver characteristics entered and the latency test result. 112 113 * 'Min Base Period' - Stepconf automatically determines the Min Base Period 114 based on the driver characteristics entered and latency test result. 115 116 [[latency-test]](((Latency Test))) 117 118 == Latency Test 119 120 While the test is running, you should 'abuse' the computer. Move 121 windows around on the screen. Surf the web. Copy some large files 122 around on the disk. Play some music. Run an OpenGL program such as 123 glxgears. The idea is to put the PC through its paces while the latency 124 test checks to see what the worst case numbers are. Run the test at least a few 125 minutes. The longer you run the test the 126 better it will be at catching events that might occour at less frequent 127 intervals. This is a test for your computer only, so no hardware needs 128 to be connected to run the test. 129 130 [WARNING] 131 Do not attempt run LinuxCNC while the latency test is running. 132 133 .Latency Test 134 135 image::images/latency-test_en.png[align="center", alt="Latency Test"] 136 137 Latency is how long it takes the PC to stop what it is doing and 138 respond to an external request. In our case, the request is the 139 periodic 'heartbeat' that serves as a timing reference for the step 140 pulses. The lower the latency, the faster you can run the heartbeat, 141 and the faster and smoother the step pulses will be. 142 143 Latency is far more important than CPU speed. The CPU isn't the only 144 factor in determining latency. Motherboards, video cards, USB ports, 145 SMI issues, and a number of other things can hurt the latency. 146 147 .Troubleshooting SMI Issues (LinuxCNC.org Wiki) 148 ************************************************************ 149 Fixing Realtime problems caused by SMI on Ubuntu 150 151 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?FixingSMIIssues 152 ************************************************************ 153 154 The important numbers are the 'max jitter'. In the example above 9075 155 nanoseconds, or 9.075 microseconds, is the highest jitter. 156 Record this number, and enter it in 157 the Base Period Maximum Jitter box. 158 159 If your Max Jitter number is less than about 15-20 microseconds 160 (15000-20000 nanoseconds), the computer should give very nice results 161 with software stepping. If the max latency is more like 30-50 162 microseconds, you can still get good results, but your maximum step 163 rate might be a little disappointing, especially if you use 164 microstepping or have very fine pitch leadscrews. If the numbers are 165 100 us or more (100,000 nanoseconds), then the PC is not a good 166 candidate for software stepping. Numbers over 1 millisecond (1,000,000 167 nanoseconds) mean the PC is not a good candidate for LinuxCNC, regardless of 168 whether you use software stepping or not. 169 170 == Parallel Port Setup 171 172 .Parallel Port Setup Page 173 174 image::images/stepconf-parallel-1_en.png[align="center", alt="Parallel Port 1 Setup Page"] 175 You may specify the address as a hexidecimal (often 0x378) or as linux's default 176 port number (probably 0) 177 178 For each pin, choose the signal which matches 179 your parallel port pinout. 180 Turn on the 'invert' check box if the signal is inverted 181 (0V for true/active, 5V for false/inactive). 182 183 * 'Output pinout presets' - Automatically set pins 2 through 9 according to 184 the Sherline standard (Direction on pins 2, 4, 6, 8) or the Xylotex standard 185 (Direction on pins 3, 5, 7, 9). 186 187 * 'Inputs and Outputs' - If the input or output is not used set the option 188 to 'Unused'. 189 190 * 'External E Stop' - This can be selected from an input pin drop down box. 191 A typical E Stop chain uses all normally closed contacts. 192 193 * 'Homing & Limit Switches' - These can be selected from an input pin drop 194 down box for most configurations. 195 196 * 'Charge Pump' - If your driver board requires a charge pump signal select 197 Charge Pump from the drop down list for the output pin you wish to connect 198 to your charge pump input. The charge pump output is connected to the base 199 thread by Stepconf. The charge pump output will be about 1/2 of the maximum 200 step rate shown on the Basic Machine Configuration page. 201 202 == Parallel Port 2 Setup 203 204 .Parallel Port 2 Setup Page 205 206 image::images/stepconf-parallel-2_en.png[align="center", alt="Parallel Port 2 Setup Page"] 207 208 The second Parallel port (if selected) can be configured and It's pins 209 assigned on this page. + 210 No step and direction signals can be selected. + 211 You may select in or out to maximizes the number of input/output pins that 212 are available. + 213 You may specify the address as a hexidecimal (often 0x378) or as linux's default 214 port number (probably 1). 215 216 == Axis Configuration 217 218 .Axis Configuration Page 219 220 image::images/stepconf-axis-x_en.png[align="center", alt="Axis X Configuration Page"] 221 222 * 'Motor Steps Per Revolution' - The number of full steps per motor revolution. 223 If you know how many degrees per step the motor is (e.g., 1.8 degree), then 224 divide 360 by the degrees per step to find the number of steps per motor 225 revolution. 226 227 * 'Driver Microstepping' - The amount of microstepping performed by the driver. 228 Enter '2' for half-stepping. 229 230 * 'Pulley Ratio' - If your machine has pulleys between the motor and leadscrew, 231 enter the ratio here. If not, enter '1:1'. 232 233 * 'Leadscrew Pitch' - Enter the pitch of the leadscrew here. If you chose 234 'Inch' units, enter the number of threads per inch If you chose 'mm' units, 235 enter the number of millimeters per revolution (e.g., enter 2 for 2mm/rev). 236 If the machine travels in the wrong direction, enter a negative number here 237 instead of a positive number, or invert the direction pin for the axis. 238 239 * 'Maximum Velocity' -Enter the maximum velocity for the axis in units per 240 second. 241 242 * 'Maximum Acceleration' - The correct values for these items can only be 243 determined through experimentation. See 244 <<sub:finding-maximum-velocity,Finding Maximum Velocity>> to set the speed and 245 <<sub:finding-maximum-acceleration,Finding Maximum Acceleration>> to set the 246 acceleration. 247 248 * 'Home Location' - The position the machine moves to after completing the 249 homing procedure for this axis. For machines without home switches, this is 250 the location the operator manually moves the machine to before pressing the 251 Home button. If you combine the home and limit switches you must move off of 252 the switch to the home position or you will get a joint limit error. 253 254 * 'Table Travel' - The range of travel for that axis based on the machine 255 origin. The home location must be inside the 'Table Travel' and not equal to 256 one of the Table Travel values. 257 258 * 'Home Switch Location' - The location at which the home switch trips 259 or releases relative to the machine origin. This item and the two below only 260 appear when Home Switches were chosen in the Parallel Port Pinout. If 261 you combine home and limit switches the home switch location can not be 262 the same as the home position or you will get a joint limit error. 263 264 * 'Home Search Velocity' - The velocity to use when searching for the home 265 switch. If the switch is near the end of travel, this velocity must be chosen 266 so that the axis can decelerate to a stop before hitting the end of travel. 267 If the switch is only closed for a short range of travel 268 (instead of being closed from its trip point to one end of travel), 269 this velocity must be chosen so that the axis can decelerate to a stop 270 before the switch opens again, and homing must always be started from 271 the same side of the switch. 272 If the machine moves the wrong direction at the beginning of the 273 homing procedure, negate the value of 'Home Search Velocity'. 274 275 * 'Home Latch Direction' - Choose 'Same' to have the axis back off the switch, 276 then approach it again at a very low speed. The second time the switch 277 closes, the home position is set. Choose 'Opposite' to have the axis back off 278 the switch and when the switch opens, the home position is set. 279 280 * 'Time to accelerate to max speed' - Time to reach maximum speed calculated 281 from 'Max Acceleration' and 'Max Velocity'. 282 283 * 'Distance to accelerate to max speed' - Distance to reach maximum speed from 284 a standstill. 285 286 * 'Pulse rate at max speed' - Information computed based on the values entered 287 above. The greatest 'Pulse rate at max speed' determines the 'BASE_PERIOD'. 288 Values above 20000Hz may lead to slow response time or even lockups 289 (the fastest usable pulse rate varies from computer to computer) 290 291 * 'Axis SCALE' - The number that will be used in the ini file [SCALE] setting. 292 This is how many steps per user unit. 293 294 * 'Test this axis' - This will open a window to allow testing for each axis. 295 This can be used after filling out all the information for this axis. 296 297 === Test This Axis 298 299 .Test This Axis 300 301 image::images/stepconf-x-test_en.png[align="center", alt="Test This Axis"] 302 303 Test this axis is a basic tester that only outputs step and direction signals 304 to try different values for acceleration and velocity. 305 306 [IMPORTANT] 307 In order to use test this axis you have to manually enable the axis if this 308 is required. If your driver has a charge pump you will have to bypass it. 309 Test this axis does not react to limit switch inputs. Use with caution. 310 311 [[sub:finding-maximum-velocity]] 312 313 .Finding Maximum Velocity 314 315 Begin with a low Acceleration 316 // comment out latexmath until a fix is found for the html docs 317 // (e.g., latexmath:[ 2 in/s^2 ] or latexmath:[ 50 mm/s^2 ]) 318 (for example, *+2 inches/s^2^+* or *+50 mm/s^2^+*) 319 and the velocity you hope to attain. 320 Using the buttons provided, jog the axis to near the center of travel. 321 Take care because with a low acceleration value, 322 it can take a surprising distance for the axis to decelerate to a stop. 323 324 After gaging the amount of travel available, 325 enter a safe distance in Test Area, keeping in mind that 326 after a stall the motor may next start to move in an unexpected direction. 327 Then click Run. 328 The machine will begin to move back and forth along this axis. 329 In this test, it is important that the combination of Acceleration and 330 Test Area allow the machine to reach the selected Velocity and 'cruise' for 331 at least a short distance -- the more distance, the better this test is. 332 The formula *+d = 0.5 * v * v/a+* 333 // latexmath:[ d = 0.5 * v * v/a ] 334 gives the minimum distance required to reach the 335 specified velocity with the given acceleration. 336 If it is convenient and safe to do so, 337 push the table against the direction of motion to simulate cutting forces. 338 If the machine stalls, reduce the speed and start the test again. 339 340 If the machine did not obviously stall, click the 'Run' button off. The axis 341 now returns to the position where it started. If the position is incorrect, 342 then the axis stalled or lost steps during the test. Reduce Velocity and start 343 the test again. 344 345 If the machine doesn't move, stalls, or loses steps, no matter how low 346 you turn Velocity, verify the following: 347 348 - Correct step waveform timings 349 - Correct pinout, including 'Invert' on step pins 350 - Correct, well-shielded cabling 351 - Physical problems with the motor, motor coupling, leadscrew, etc. 352 353 Once you have found a speed at which the axis does not stall or lose steps 354 during this testing procedure, reduce it by 10% and use that as the axis 355 'Maximum Velocity'. 356 357 [[sub:finding-maximum-acceleration]](((Finding Maximum Acceleration))) 358 359 .Finding Maximum Acceleration 360 361 With the Maximum Velocity you found in the previous step, 362 enter the acceleration value to test. 363 Using the same procedure as above, 364 adjust the Acceleration value up or down as necessary. 365 In this test, it is important that the combination of 366 Acceleration and Test Area allow the machine to reach the selected Velocity. 367 Once you have found a value at which the axis 368 does not stall or lose steps during this testing procedure, 369 reduce it by 10% and use that as the axis Maximum Acceleration. 370 371 == Spindle Configuration 372 373 .Spindle Configuration Page 374 375 image::images/stepconf-spindle_en.png[align="center", alt="Spindle Configuration Page"] 376 377 This page only appears when 'Spindle PWM' is chosen in the 378 'Parallel Port Pinout' page for one of the outputs. 379 380 === Spindle Speed Control 381 382 If 'Spindle PWM' appears on the pinout, 383 the following information should be entered: 384 385 * 'PWM Rate' - The 'carrier frequency' of the PWM signal to the spindle. Enter 386 '0' for PDM mode, which is useful for generating an analog control voltage. 387 Refer to the documentation for your spindle controller for the appropriate value. 388 389 * 'Speed 1 and 2, PWM 1 and 2' - The generated configuration file uses a simple 390 linear relationship to determine the PWM value for a given RPM value. If the 391 values are not known, they can be determined. For more information see 392 <<sub:determining-spindle-calibration,Determining Spindle Calibration>>. 393 394 === Spindle-synchronized motion 395 396 When the appropriate signals from a spindle encoder are connected to 397 LinuxCNC via HAL, LinuxCNC supports lathe threading. 398 These signals are: 399 400 * 'Spindle Index' - Is a pulse that occurs once per revolution of the spindle. 401 402 * 'Spindle Phase A' - This is a pulse that occurs in multiple equally-spaced 403 locations as the spindle turns. 404 405 * 'Spindle Phase B (optional)' - This is a second pulse that occurs, but with 406 an offset from Spindle Phase A. The advantages to using both A and B are 407 direction sensing, increased noise immunity, and increased resolution. 408 409 If 'Spindle Phase A' and 'Spindle Index' appear 410 on the pinout, the following information should be entered: 411 412 * 'Use Spindle-At-Speed' - With encoder feedback one can choose to have linuxcnc 413 wait for the spindle to reach the commanded speed before feed moves. Select this 414 option and set the 'close enough' scale. 415 416 * 'Speed Display Filter Gain' - Setting for adjusting the stability of the 417 visual spindle speed display. 418 419 * 'Cycles per revolution' - The number of cycles of the 'Spindle A' signal 420 during one revolution of the spindle. This option is only enabled when an 421 input has been set to 'Spindle Phase A' 422 423 * 'Maximum speed in thread' - The maximum spindle speed used in threading. 424 For a high spindle RPM or a spindle encoder with high resolution, a low value 425 of 'BASE_PERIOD' is required. 426 427 [[sub:determining-spindle-calibration]](((Determining Spindle Calibration))) 428 429 === Determining Spindle Calibration 430 431 Enter the following values in the Spindle Configuration page: 432 433 [width="80%"] 434 |============================ 435 |Speed 1: | 0 | PWM 1: | 0 436 |Speed 2: | 1000 | PWM 2: | 1 437 |============================ 438 439 Finish the remaining steps of the configuration process, 440 then launch LinuxCNC with your configuration. 441 Turn the machine on and select the MDI tab. 442 Start the spindle turning by entering: 'M3 S100'. 443 Change the spindle speed by entering a different S-number: 'S800'. 444 Valid numbers (at this point) range from 1 to 1000. 445 446 For two different S-numbers, measure the actual spindle speed in RPM. 447 Record the S-numbers and actual spindle speeds. Run Stepconf again. 448 For 'Speed' enter the measured speed, and 449 for 'PWM' enter the S-number divided by 1000. 450 451 Because most spindle drivers are somewhat nonlinear in their response 452 curves, it is best to: 453 454 - Make sure the two calibration speeds are not too close together in RPM 455 - Make sure the two calibration speeds are in the range of speeds you 456 will typically use while milling 457 458 For instance, if your spindle will go from 0 RPM to 8000 RPM, 459 but you generally use speeds from 400 RPM (10%) to 4000 RPM (100%), 460 then find the PWM values that give 1600 RPM (40%) and 2800 RPM (70%). 461 462 == Options 463 464 .Options Configuration 465 466 image::images/stepconf-options_en.png[align="center", alt="Options Configuration"] 467 468 * 'Include Halui' - This will add the Halui user interface component. See the 469 <<cha:hal-user-interface,HALUI Chapter>> for more information on. 470 471 * 'Include pyVCP' - This option adds the pyVCP panel base file or a sample file 472 to work on. See the <<cha:pyvcp,PyVCP Chapter>> for more information. 473 474 * 'Include ClassicLadder PLC' - This option will add the ClassicLadder PLC 475 (Programmable Logic Controller). See the 476 <<cha:classicladder,Classicladder Chapter>> for more information. 477 478 * 'Onscreen Prompt For Tool Change' - If this box is checked, LinuxCNC will 479 pause and prompt you to change the tool when 'M6' is encountered. This feature 480 is usually only useful if you have presettable tools. 481 482 == Machine Configuration Complete 483 484 Click 'Apply' to write the configuration files. 485 Later, you can re-run this program and tweak the settings you entered before. 486 487 == Axis Travel and Home 488 489 For each axis, there is a limited range of travel. 490 The physical end of travel is called the 'hard stop'. 491 492 Before the 'hard stop' there is a 'limit switch'. 493 If the limit switch is encountered during normal operation, 494 LinuxCNC shuts down the motor amplifier. 495 The distance between the 'hard stop' and 'limit switch' 496 must be long enough to allow an unpowered motor to coast to a stop. 497 498 Before the 'limit switch' there is a 'soft limit'. 499 This is a limit enforced in software after homing. 500 If a MDI command or g code program would pass the soft limit, it is not executed. 501 If a jog would pass the soft limit, it is terminated at the soft limit. 502 503 The 'home switch' can be placed anywhere within the travel (between hard stops). 504 As long as external hardware does not deactivate the motor amplifiers 505 when the limit switch is reached, one of the limit switches 506 can be used as a home switch. 507 508 The 'zero position' is the location on the axis that is 0 in 509 the machine coordinate system. 510 Usually the 'zero position' will be within the 'soft limits'. 511 On lathes, constant surface speed mode requires that machine 'X=0' 512 correspond to the center of spindle rotation when no tool offset is in effect. 513 514 The 'home position' is the location within travel that the axis will 515 be moved to at the end of the homing sequence. 516 This value must be within the 'soft limits'. 517 In particular, the 'home position' 518 should never be exactly equal to a 'soft limit'. 519 520 === Operating without Limit Switches 521 522 A machine can be operated without limit switches. In this case, only 523 the soft limits stop the machine from reaching the hard stop. 524 Soft limits only operate after the machine has been homed. 525 526 === Operating without Home Switches[[sub:Operating-without-Home]] 527 (((Operating without Home Switches))) 528 529 A machine can be operated without home switches. 530 If the machine has limit switches, but no home switches, 531 it is best to use a limit switch as the home switch 532 (e.g., choose 'Minimum Limit + Home X' in the pinout). 533 If the machine has no switches at all, or the limit 534 switches cannot be used as home switches for another reason, then the 535 machine must be homed 'by eye' or by using match marks. Homing by eye 536 is not as repeatable as homing to switches, but it still allows the 537 soft limits to be useful. 538 539 === Home and Limit Switch wiring options 540 541 The ideal wiring for external switches would be one input per switch. 542 However, the PC parallel port only offers a total of 5 inputs, 543 while there are as many as 9 switches on a 3-axis machine. 544 Instead, multiple switches are wired together in various 545 ways so that a smaller number of inputs are required. 546 547 The figures below show the general idea of wiring multiple switches 548 to a single input pin. 549 In each case, when one switch is actuated, 550 the value seen on INPUT goes from logic HIGH to LOW. 551 However, LinuxCNC expects a TRUE value when a switch is closed, 552 so the corresponding 'Invert' box 553 must be checked on the pinout configuration page. 554 The pull up resistor show in the diagrams pulls the input high 555 until the connection to ground is made and then the input goes low. 556 Otherwise the input might float between on and off when the circuit is open. 557 Typically for a parallel port you might use 47k. 558 559 .Normally Closed Switches 560 561 Wiring N/C switches in series (simplified diagram) 562 563 image::images/switch-nc-series_en.svg[align="center", alt="Normally Closed Switches"] 564 565 .Normally Open Switches 566 567 Wiring N/O switches in parallel (simplified diagram) 568 569 image::images/switch-no-parallel_en.svg[align="center", alt="Normally Open Switches"] 570 571 The following combinations of switches are permitted in Stepconf: 572 573 * Combine home switches for all axes 574 * Combine limit switches for all axes 575 * Combine both limit switches for one axis 576 * Combine both limit switches and the home switch for one axis 577 * Combine one limit switch and the home switch for one axis 578 579 // vim: set syntax=asciidoc: 580 581