summaryrefslogtreecommitdiff
path: root/docs/src/config/stepconf.txt
blob: 4666b99badefd4f13556a8cb3859a604f6277d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
= Stepper Configuration Wizard

[[cha:stepconf-wizard]] (((Stepconf Wizard)))

LinuxCNC is capable of controlling a wide range of machinery 
using many different hardware interfaces.

Stepconf is a program that generates configuration files for LinuxCNC
for a specific class of CNC machine:
those that are controlled via a 'standard parallel port', and
controlled by signals of type 'step & direction'.

Stepconf is installed when you install LinuxCNC and is in the CNC menu.

Stepconf places a file in the linuxcnc/config directory
to store the choices for each configuration you create.
When you change something, you need to pick the file
that matches your configuration name.
The file extension is .stepconf.

The Stepconf Wizard needs at least 800 x 600 screen resolution 
to see the buttons on the bottom of the pages.

[float]
Step by Step Instructions
=========================

== Entry Page[[sec:Entry-Page]]

.Entry Page[[cap:Entry-Page]]

image::images/stepconf-config.png[align="center"]

* 'Create New' - Creates a fresh configuration.

* 'Modify' - Modify an existing configuration. After selecting this a file
picker pops up so you can select the .stepconf file for modification. If you
made any modifications to the main .hal or the .ini file these will be lost.
Modifications to custom.hal and custom_postgui.hal will not be changed by
the Stepconf Wizard.

* 'Create Desktop Shortcut' - This will place a link on your desktop to the
files.

* 'Create Desktop Launcher' - This will place a launcher on your desktop to
start your application.

== Basic Information[[sec:Basic-Information]]

.Basic Information Page[[cap:Basic-Information-Page]]

image::images/stepconf-basic.png[align="center"]

* 'Machine Name' - Choose a name for your machine. Use only uppercase letters,
lowercase letters, digits, - and _.

* 'Axis Configuration' - Choose XYZ (Mill), XYZA (4-axis mill) or XZ (Lathe).

* 'Machine Units' - Choose Inch or mm. All subsequent entries will be in the
chosen units

* 'Driver Type' - If you have one of the stepper drivers listed in the pull down
box, choose it. Otherwise, select 'Other' and find the timing values in your
driver's data sheet and enter them as 'nano seconds' in the 'Driver Timing
Settings'. If the data sheet gives a value in microseconds, multiply by 1000.
For example, enter 4.5us as 4500ns.

A list of some popular drives, along with their timing values, is on the
LinuxCNC.org Wiki under
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Stepper_Drive_Timing[Stepper Drive Timing].

Additional signal conditioning or isolation such as optocouplers and RC filters
on break out boards can impose timing constraints of their own, in addition
to those of the driver. You may find it necessary to add some time to the
drive requirements to allow for this.

The LinuxCNC Configuration Selector has configs for Sherline already configured.

* 'Step Time' - How long the step pulse is 'on' in nano seconds. If your not
sure about this setting a value of 10,000 will work with most drives.

* 'Step Space' - Minimum time between step pulses in nano seconds. If your
not sure about this setting a value of 10,000 will work with most drives.

* 'Direction Hold' - How long the direction pin is held after a change of
direction in nanoseconds. If your not sure about this setting a value of
200,000 will work with most drives.

* 'Direction Setup' - How long before a direction change after the last
step pulse in nanoseconds.  If your not sure about this setting a value of
200,000 will work with most drives.

* 'First Parport' - Usually the default of 0x378 is correct. 

* 'Second Parport' - If you need to specify additional parallel ports enter
the address and the type. For information on finding the address of PCI
parallel ports see the Port Address in the Integrator Manual.
(Try 0x278 or 0x3BC first.)

* 'Base Period Maximum Jitter' - Enter the result of the Latency Test here.
To run a latency test press the 'Test Base Period Jitter' button. See the
<<latency-test,Latency Test>> section for more details.

* 'Max Step Rate' -Stepconf automatically calculates the Max Step Rate based
on the driver characteristics entered and the latency test result.

* 'Min Base Period' - Stepconf automatically determines the Min Base Period
based on the driver characteristics entered and latency test result.

* 'Onscreen Prompt For Tool Change' - If this box is checked, LinuxCNC will
pause and prompt you to change the tool when 'M6' is encountered. This feature
is usually only useful if you have presettable tools.

== Latency Test[[latency-test]](((Latency Test)))

While the test is running, you should 'abuse' the computer. Move
windows around on the screen. Surf the web. Copy some large files
around on the disk. Play some music. Run an OpenGL program such as
glxgears. The idea is to put the PC through its paces while the latency
test checks to see what the worst case numbers are.  Run the test at least a few
minutes. The longer you run the test the
better it will be at catching events that might occour at less frequent
intervals. This is a test for your computer only, so no hardware needs
to be connected to run the test.

[WARNING]
Do not attempt run LinuxCNC while the latency test is running.

.Latency Test[[cap:Latency-Test]]

image::images/latency.png[align="center"]

Latency is how long it takes the PC to stop what it is doing and
respond to an external request. In our case, the request is the
periodic 'heartbeat' that serves as a timing reference for the step
pulses. The lower the latency, the faster you can run the heartbeat,
and the faster and smoother the step pulses will be.

Latency is far more important than CPU speed. The CPU isn't the only
factor in determining latency. Motherboards, video cards, USB ports, 
SMI issues, and a number of other things can hurt the latency.

.Troubleshooting SMI Issues (LinuxCNC.org Wiki)
************************************************************
Fixing Realtime problems caused by SMI on Ubuntu

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?FixingSMIIssues
************************************************************

The important numbers are the 'max jitter'. In the example above 9075
nanoseconds, or 9.075 microseconds, is the highest jitter. 
Record this number, and enter it in
the Base Period Maximum Jitter box.

If your Max Jitter number is less than about 15-20 microseconds
(15000-20000 nanoseconds), the computer should give very nice results
with software stepping. If the max latency is more like 30-50
microseconds, you can still get good results, but your maximum step
rate might be a little disappointing, especially if you use
microstepping or have very fine pitch leadscrews. If the numbers are
100 us  or more (100,000 nanoseconds), then the PC is not a good
candidate for software stepping. Numbers over 1 millisecond (1,000,000
nanoseconds) mean the PC is not a good candidate for LinuxCNC, regardless of
whether you use software stepping or not.

== Parallel Port Setup[[sec:Parallel-Port-Setup]](((Parallel Port Setup)))

.Parallel Port Setup Page[[cap:Parallel-Port-Setup]]

image::images/stepconf-pinout.png[align="center"]

For each pin, choose the signal which matches 
your parallel port pinout. 
Turn on the 'invert' check box if the signal is inverted 
(0V for true/active, 5V for false/inactive).

* 'Output pinout presets' - Automatically set pins 2 through 9 according to
the Sherline standard (Direction on pins 2, 4, 6, 8) or the Xylotex standard
(Direction on pins 3, 5, 7, 9).

* 'Inputs and Outputs' - If the input or output is not used set the option
to 'Unused'.

* 'External E Stop' - This can be selected from an input pin drop down box.
A typical E Stop chain uses all normally closed contacts.

* 'Homing & Limit Switches' - These can be selected from an input pin drop
down box for most configurations.

* 'Charge Pump' - If your driver board requires a charge pump signal select
Charge Pump from the drop down list for the output pin you wish to connect
to your charge pump input. The charge pump output is connected to the base
thread by Stepconf. The charge pump output will be about 1/2 of the maximum
step rate shown on the Basic Machine Configuration page.

== Axis Configuration[[sec:Axis-Configuration]](((Axis Configuration)))

.Axis Configuration Page[[cap:Axis-Configuration-Page]]

image::images/stepconf-axis.png[align="center"]

* 'Motor Steps Per Revolution' - The number of full steps per motor revolution.
If you know how many degrees per step the motor is (e.g., 1.8 degree), then
divide 360 by the degrees per step to find the number of steps per motor
revolution.

* 'Driver Microstepping' - The amount of microstepping performed by the driver.
Enter '2' for half-stepping.

* 'Pulley Ratio' - If your machine has pulleys between the motor and leadscrew,
enter the ratio here. If not, enter '1:1'.

* 'Leadscrew Pitch' - Enter the pitch of the leadscrew here. If you chose
'Inch' units, enter the number of threads per inch If you chose 'mm' units,
enter the number of millimeters per revolution (e.g., enter 2 for 2mm/rev).
If the machine travels in the wrong direction, enter a negative number here
instead of a positive number, or invert the direction pin for the axis.

* 'Maximum Velocity' -Enter the maximum velocity for the axis in units per
second.

* 'Maximum Acceleration' - The correct values for these items can only be
determined through experimentation. See
<<finding-maximum-velocity,Finding Maximum Velocity>> to set the speed and
<<finding-maximum-acceleration,Finding Maximum Acceleration>> to set the
acceleration.

* 'Home Location' - The position the machine moves to after completing the
homing procedure for this axis. For machines without home switches, this is
the location the operator manually moves the machine to before pressing the
Home button. If you combine the home and limit switches you must move off of
the switch to the home position or you will get a joint limit error.

* 'Table Travel' - The range of travel for that axis based on the machine
origin. The home location must be inside the 'Table Travel' and not equal to
one of the Table Travel values.

* 'Home Switch Location' - The location at which the home switch trips
or releases reletive to the machine origin. This item and the two below only
appear when Home Switches were chosen in the Parallel Port Pinout. If
you combine home and limit switches the home switch location can not be
the same as the home position or you will get a joint limit error.

* 'Home Search Velocity' - The velocity to use when searching for the home
switch. If the switch is near the end of travel, this velocity must be chosen
 so that the axis can decelerate to a stop before hitting the end of travel.
If the switch is only closed for a short range of travel
(instead of being closed from its trip point to one end of travel),
this velocity must be chosen so that the axis can decelerate to a stop
before the switch opens again, and homing must always be started from
the same side of the switch.
If the machine moves the wrong direction at the beginning of the
homing procedure, negate the value of 'Home Search Velocity'.

* 'Home Latch Direction' - Choose 'Same' to have the axis back off the switch,
then approach it again at a very low speed. The second time the switch
closes, the home position is set. Choose 'Opposite' to have the axis back off
the switch and when the switch opens, the home position is set.

* 'Time to accelerate to max speed' - Time to reach maximum speed calculated
from 'Max Acceleration' and 'Max Velocity'.

* 'Distance to accelerate to max speed' - Distance to reach maximum speed from
a standstill.

* 'Pulse rate at max speed' - Information computed based on the values entered
above. The greatest 'Pulse rate at max speed' determines the 'BASE_PERIOD'.
Values above 20000Hz may lead to slow response time or even lockups
(the fastest usable pulse rate varies from computer to computer)

* 'Axis SCALE' - The number that will be used in the ini file [SCALE] setting.
This is how many steps per user unit.

* 'Test this axis' - This will open a window to allow testing for each axis.
This can be used after filling out all the information for this axis.

=== Test This Axis

.Test This Axis[[cap:Test-This-Axis]]

image::images/stepconf-test.png[align="center"]

Test this axis is a basic tester that only outputs step and direction signals
to try different values for acceleration and velocity.

[IMPORTANT] 
In order to use test this axis you have to manually enable the axis if this
is required. If your driver has a charge pump you will have to bypass it.
Test this axis does not react to limit switch inputs. Use with caution.

==== Finding Maximum Velocity[[finding-maximum-velocity]](((Finding Maximum Velocity)))

Begin with a low Acceleration
// comment out latexmath until a fix is found for the html docs
// (e.g., latexmath:[ 2 in/s^2 ] or latexmath:[ 50 mm/s^2 ])
(for example, *+2 inches/s^2^+* or *+50 mm/s^2^+*)
and the velocity you hope to attain.
Using the buttons provided, jog the axis to near the center of travel.
Take care because with a low acceleration value,
it can take a surprising distance for the axis to decelerate to a stop.

After gaging the amount of travel available,
enter a safe distance in Test Area, keeping in mind that
after a stall the motor may next start to move in an unexpected direction.
Then click Run.
The machine will begin to move back and forth along this axis.
In this test, it is important that the combination of Acceleration and
Test Area allow the machine to reach the selected Velocity and 'cruise' for
at least a short distance -- the more distance, the better this test is.
The formula *+d = 0.5 * v * v/a+*
// latexmath:[ d = 0.5 * v * v/a ]
gives the minimum distance required to reach the
specified velocity with the given acceleration.
If it is convenient and safe to do so,
push the table against the direction of motion to simulate cutting forces.
If the machine stalls, reduce the speed and start the test again.

If the machine did not obviously stall, click the 'Run' button off. The axis
now returns to the position where it started. If the position is incorrect,
then the axis stalled or lost steps during the test. Reduce Velocity and start
the test again.

If the machine doesn't move, stalls, or loses steps, no matter how low
you turn Velocity, verify the following:

- Correct step waveform timings
- Correct pinout, including 'Invert' on step pins
- Correct, well-shielded cabling
- Physical problems with the motor, motor coupling, leadscrew, etc.

Once you have found a speed at which the axis does not stall or lose steps
during this testing procedure, reduce it by 10% and use that as the axis
'Maximum Velocity'.

==== Finding Maximum Acceleration[[finding-maximum-acceleration]](((Finding Maximum Acceleration)))

With the Maximum Velocity you found in the previous step,
enter the acceleration value to test.
Using the same procedure as above,
adjust the Acceleration value up or down as necessary.
In this test, it is important that the combination of
Acceleration and Test Area allow the machine to reach the selected Velocity.
Once you have found a value at which the axis
does not stall or lose steps during this testing procedure,
reduce it by 10% and use that as the axis Maximum Acceleration.

== Spindle Configuration[[sec:Spindle-Configuration]](((Spindle Configuration)))

.Spindle Configuration Page[[cap:Spindle-Configuration-Page]]

image::images/stepconf-spindle.png[align="center"]

This page only appears when 'Spindle PWM' is chosen in the
'Parallel Port Pinout' page for one of the outputs.

=== Spindle Speed Control[[spindle-speed-control]](((spindle speed control)))

If 'Spindle PWM' appears on the pinout,
the following information should be entered:

* 'PWM Rate' - The 'carrier frequency' of the PWM signal to the spindle. Enter
'0' for PDM mode, which is useful for generating an analog control voltage.
Refer to the documentation for your spindle controller for the appropriate value.

* 'Speed 1 and 2, PWM 1 and 2' - The generated configuration file uses a simple
linear relationship to determine the PWM value for a given RPM value. If the
values are not known, they can be determined. For more information see
<<determining-spindle-calibration,Determining Spindle Calibration>>.

=== Spindle-synchronized motion[[sub:Spindle-synchronized-motion-lathe]]
(((Spindle-synchronized motion)))(((Lathe Threading)))

When the appropriate signals from a spindle encoder are connected to 
LinuxCNC via HAL, LinuxCNC supports lathe threading.
These signals are:

* 'Spindle Index' - Is a pulse that occurs once per revolution of the spindle.

* 'Spindle Phase A' - This is a pulse that occurs in multiple equally-spaced
locations as the spindle turns.

* 'Spindle Phase B (optional)' - This is a second pulse that occurs, but with
an offset from Spindle Phase A. The advantages to using both A and B are
direction sensing, increased noise immunity, and increased resolution.

If 'Spindle Phase A' and 'Spindle Index' appear 
on the pinout, the following information should be entered:

* 'Cycles per revolution' - The number of cycles of the 'Spindle A' signal
during one revolution of the spindle. This option is only enabled when an
input has been set to 'Spindle Phase A'

* 'Maximum speed in thread' - The maximum spindle speed used in threading.
For a high spindle RPM or a spindle encoder with high resolution, a low value
of 'BASE_PERIOD' is required.

=== Determining Spindle Calibration[[determining-spindle-calibration]]
(((Determining Spindle Calibration)))

Enter the following values in the Spindle Configuration page:

[width="80%"]
|============================
|Speed 1: | 0    | PWM 1: | 0
|Speed 2: | 1000 | PWM 2: | 1
|============================

Finish the remaining steps of the configuration process,
then launch LinuxCNC with your configuration.
Turn the machine on and select the MDI tab.
Start the spindle turning by entering: 'M3 S100'.
Change the spindle speed by entering a different S-number: 'S800'.
Valid numbers (at this point) range from 1 to 1000.

For two different S-numbers, measure the actual spindle speed in RPM.
Record the S-numbers and actual spindle speeds. Run Stepconf again.
For 'Speed' enter the measured speed, and
for 'PWM' enter the S-number divided by 1000.

Because most spindle drivers are somewhat nonlinear in their response
curves, it is best to:

- Make sure the two calibration speeds are not too close together in RPM
- Make sure the two calibration speeds are in the range of speeds you
will typically use while milling

For instance, if your spindle will go from 0 RPM to 8000 RPM,
but you generally use speeds from 400 RPM (10%) to 4000 RPM (100%),
then find the PWM values that give 1600 RPM (40%) and 2800 RPM (70%).

== Advanced Configuration Options[[sec:Advanced-Configuration-Options]](((Advanced Configuration Options)))

.Advanced Configuration[[cap:Advanced-Configuration]]

image::images/stepconf-advanced.png[align="center"]

* 'Include Halui' - This will add the Halui user interface component. See the
Integrator Manual for more information on Halui.

* 'Include pyVCP' - This option adds the pyVCP panel base file or a sample file
to work on. See the Integrator Manual for more information on pyVCP.

* 'Include ClassicLadder PLC' - This option will add the ClassicLadder PLC
(Programmable Logic Controller). See the Integrator Manual for more information
on ClassicLadder.

== Machine Configuration Complete[[sub:Machine-Configuration-Complete]]

Click 'Apply' to write the configuration files. 
Later, you can re-run this program and tweak the settings you entered before.

== Axis Travel, Home Location, and Home Switch Location[[sec:Axis-Travel-Home]]
(((Axis Travel)))(((Home Location)))(((Home Switch Location)))

For each axis, there is a limited range of travel.
The physical end of travel is called the 'hard stop'.

Before the 'hard stop' there is a 'limit switch'.
If the limit switch is encountered during normal operation, 
LinuxCNC shuts down the motor amplifier.
The distance between the 'hard stop' and 'limit switch'
must be long enough to allow an unpowered motor to coast to a stop.

Before the 'limit switch' there is a 'soft limit'.
This is a limit enforced in software after homing.
If a MDI command or g code program would pass the soft limit, it is not executed.
If a jog would pass the soft limit, it is terminated at the soft limit.

The 'home switch' can be placed anywhere within the travel (between hard stops).
As long as external hardware does not deactivate the motor amplifiers 
when the limit switch is reached, one of the limit switches
can be used as a home switch.

The 'zero position' is the location on the axis that is 0 in
the machine coordinate system.
Usually the 'zero position' will be within the 'soft limits'.
On lathes, constant surface speed mode requires that machine 'X=0' 
correspond to the center of spindle rotation when no tool offset is in effect.

The 'home position' is the location within travel that the axis will
be moved to at the end of the homing sequence.
This value must be within the 'soft limits'.
In particular, the 'home position'
should never be exactly equal to a 'soft limit'.

=== Operating without Limit Switches[[sub:Operating-without-Limit]]
(((Operating without Limit Switches)))

A machine can be operated without limit switches. In this case, only
the soft limits stop the machine from reaching the hard stop.
Soft limits only operate after the machine has been homed.

=== Operating without Home Switches[[sub:Operating-without-Home]]
(((Operating without Home Switches)))

A machine can be operated without home switches.
If the machine has limit switches, but no home switches,
it is best to use a limit switch as the home switch
(e.g., choose 'Minimum Limit + Home X'  in the pinout).
If the machine has no switches at all, or the limit
switches cannot be used as home switches for another reason, then the
machine must be homed 'by eye' or by using match marks. Homing by eye
is not as repeatable as homing to switches, but it still allows the
soft limits to be useful.

=== Home and Limit Switch wiring options[[sub:Home-and-Limit]]
(((Home and Limit Switch wiring options)))

The ideal wiring for external switches would be one input per switch.
However, the PC parallel port only offers a total of 5 inputs,
while there are as many as 9 switches on a 3-axis machine.
Instead, multiple switches are wired together in various
ways so that a smaller number of inputs are required.

The figures below show the general idea of wiring multiple switches 
to a single input pin.
In each case, when one switch is actuated,
the value seen on INPUT goes from logic HIGH to LOW.
However, LinuxCNC expects a TRUE value when a switch is closed,
so the corresponding 'Invert' box
must be checked on the pinout configuration page.
The pull up resistor show in the diagrams pulls the input high
until the connection to ground is made and then the input goes low.
Otherwise the input might float between on and off when the circuit is open.
Typically for a parallel port you might use 47k.

.Normally Closed Switches[[cap:Normally-Closed-Switches]]

Wiring N/C switches in series (simplified diagram)

image::images/switch-nc-series.png[align="center"]

.Normally Open Switches[[cap:Normally-Open-Switches]]

Wiring N/O switches in parallel (simplified diagram)

image::images/switch-no-parallel.png[align="center"]

The following combinations of switches are permitted in Stepconf:

* Combine home switches for all axes
* Combine limit switches for all axes
* Combine both limit switches for one axis
* Combine both limit switches and the home switch for one axis
* Combine one limit switch and the home switch for one axis

// vim: set syntax=asciidoc: