Configuring and calibrating a delta printer using the dc42 fork of RepRapFirmware

From RepRap
Revision as of 18:04, 1 August 2015 by Dc42 (talk | contribs) (Setting up the auto calibration file)
Jump to: navigation, search

Telling RepRapFirmware that your printer is a delta

To tell RepRapFirmware that your printer is a delta and to define its parameters, put command M665 L### R### H### B### X### Y### in your sys/config.g file on the SD card, where ### represents a number. The L parameter is the diagonal rod length. The R parameter is your estimate of the delta radius. The H parameter is the height of the nozzle above the bed when the carriages are activating the endstop switches. The B parameter is the printable radius of the bed. X and Y are the angular offsets of the X and Y towers, and may be omitted or set to zero. All these values may include decimal portions.

You can also use an M666 command to set the homing switch corrections.

You also need to tell RepRapFirmware that the endstop switches are all at the high end using the M574 command. Here is an extract from a sample config.g file for the Mini Kossel:

; Axis and motor configuration
M569 P0 S1                    ; Drive 0 goes forwards
M569 P1 S1                    ; Drive 1 goes forwards
M569 P2 S1                    ; Drive 2 goes forwards
M569 P3 S1                    ; Drive 3 goes forwards
M569 P4 S1                    ; Drive 4 goes forwards
M574 X2 Y2 Z2 S1              ; all endstops at high end, active high
M665 R105.6 L215.0 B85 H235   ; set delta radius, diagonal rod length, printable radius and homed height
M666 X0 Y0 Z0                 ; put your endstop adjustments here

Setting up the homing file

You need to set up the homing commands in file sys/homedelta.g on the SD card. When configured for a delta printer, RepRapFirmware will always home all three towers when any G28 command is processed, ignoring any X, Y or Z parameters. Typical contents of homedelta.g would be:

G91                         ; use relative positioning
G1 S1 X250 Y250 Z250 F5000  ; move all carriages up 250mm, stopping at the endstops
G1 S2 X-5 Y-5 Z-5           ; move all towers down 5mm
G1 S1 X8 Y8 Z8 F500         ; move towers slowly up 8mm, stopping at the endstops
G1 S2 X-5 Y-5 Z-5 F10000    ; move carriages down 5mm
G90                         ; back to absolute positioning

Adjust the “250” numbers in the first line to be somewhat greater than your maximum print height, to ensure that the carriages reach the endstops. During initial testing, you may wish to reduce the homing speed value “5000” in the second line to a lower value, to give yourself more time to press the reset or power button if something goes wrong. Alternatively, reduce the motor currents during initial testing using the M906 command.

The above works because when the S1 or S2 parameter is used in a G0 or G1 command, the X, Y and Z values in the command are used as values for the individual towers instead of the head coordinates. In the case of S1, the endstops are activated too.

Setting up the Z probe deploy and retract files

If your machine has a mechanical Z probe that needs to be deployed by moving the head in certain ways (e.g. standard Mini Kossel), then you need to set up macro files for deploying and retracting the probe. These are typically named sys/deployprobe.g and sys/retractprobe.g. Here is a sample deployprobe.g file:

M564 S0                ; don't apply limits
G1 X25 Y93 Z40 F10000  ; put probe arm next to belt
G1 X-5 F500            ; move probe arm slowly across belt
G1 X12 F1000           ; move probe back
G1 X0 Y0 F10000        ; move to somewhere sensible
M564 S1                ; apply limits again

Here is a sample retractprobe.g file:

M564 S0           ; don't apply limits
G1 Z40 F10000     ; raise head
G1 X-59 Y66 Z35   ; move over the post
G1 Z7 F500        ; push probe down on post
G1 Z35 F10000     ; raise head again
G1 X0 Y0          ; move to somewhere sensible
M564 S1           ; apply limits again

Setting up the auto calibration file

Auto calibration is performed by sending command G32 (which is the same command used to do auto bed compensation on a Cartesian printer). This command runs macro file sys/bed.g, so all the work is done there. Here is a sample bed.g file:

M561                            ; clear any bed transform, otherwise homing may be at the wrong height
G31 X0 Y0                       ; don't want any probe offset for this
G28                             ; home the printer

;*** Remove the following two lines if your Z probe does not need to be deployed
M98 Pdeployprobe.g              ; deploy the mechanical Z probe
G30 P0 X0 Y0 Z-99999            ; dummy probe, because the mechanical probe gives inaccurate results the first time it is used after deployment

; Probe the bed and do 6-factor auto calibration
G30 P0 X-73.6 Y-42.5 Z-99999    ; X tower
G30 P1 X0 Y-85 Z-99999          ; between X and Y towers
G30 P2 X73.6 Y-42.5 Z-99999     ; Y tower
G30 P3 X73.6 Y20 Z-99999        ; between Y and Z towers
G30 P4 X0 Y67 Z-99999           ; Z tower
G30 P5 X-73.6 Y20 Z-99999       ; between Z and X towers
G30 P6 X-36.8 Y-21.25 Z-99999   ; half way to X tower
G30 P7 X36.8 Y-21.25 Z-99999    ; half way to Y tower
G30 P8 X0 Y42.5 Z-99999         ; half way to Z tower
G30 P9 X0 Y0 Z-99999 S6         ; centre, and auto-calibrate 6 factors

;*** Remove the following line if your Z probe does not need to be retracted
M98 Pretractprobe.g             ; retract the mechanical Z probe

G1 X0 Y0 Z150 F15000            ; get the head out of the way of the bed

The probing is commanded by the G30 commands. You can have up to 16 probe points, numbered P0 to P15. The probe positions and order are not critical, but you should cover at least the centre and the extremities of the bed. The XY coordinates are where the nozzle will be, so if the Z probe is displaced from the nozzle then you must ensure that the probe is always over the bed, even if this means moving some of the probe points in from the edge.

This example uses ten points: six around the periphery, one at the centre, and three halfway between the centre and the periphery. For large delta printers, add at least 3 more probe points halfway to the periphery. If your Z probe has different trigger heights at different XY positions, you can add G31 Z commands to change the Z probe trigger height during the probing sequence, immediately before the corresponding G30 commands.

The S parameter on the final G30 command defines what calculation is actually done, as follows:

S=-1 Don't adjust anything, just print the height error at each probe point

S=0 Equivalent to S=<number_of_points_probed>

S=3 Adjust homing switch corrections only

S=4 Adjust homing switch corrections and delta radius

S=6 Adjust homing switch corrections, delta radius, and X and Y tower position offsets

S=7 Adjust homing switch corrections, delta radius, X and Y tower position offsets, and diagonal rod length

The adjustments are made so as to minimise the sum of the squares of the height errors.

If your printer is accurately built, then 4-factor calibration may be sufficient. For normal use I recommend 6-factor calibration. I don't recommend 7-factor calibration, because the diagonal rod length is not very well defined by the probing errors, and adjusting diagonal rod length will alter the XY dimensions of your prints.

If you wish, you can define several variants of bed.g and run them using the M98 command, or just 'print' them like any other gcode file. In particular, it is useful to have a variant that uses S-1 on the final G30 command, so that you can check the height errors multiple times without adjusting anything, to get an idea of how reproducible the Z probe height readings are.

Updating config.g

If the calibration errors are small, a single execution of bed.g will calibrate your printer accurately. Larger errors my require 2 or 3 runs to calibrate out. So I suggest the following procedure:

1. Run auto calibration, then use the M665 and M666 commands with no parameters to see the adjustments made.

2. Repeat (1) until the M665 and M666 results converge.

3. Edit those results into the M665 and M666 commands in config.g.

After this, a single auto calibration run will be sufficient. Note that the X and Y parameters of the M665 command are only supported in firmware version 1.09d-dc42 and later.