Skip to content

Surface scan

Sven edited this page Jan 4, 2019 · 45 revisions

Surface scan

Alternative source for Z-Value

How to get the height information of a work piece.

  • Install a probe at your machine which triggers the Probe pin (A5 at arduino) when touching the work piece surface. A NO (normally open) switch, connected to ground and A5, is what we need. (Or when using a NC (normally closed) switch, change $6=1).
    Note: if the probe is triggered, the Z axis needs some time and distance to decelerate, which could cause mechnical stress to your probe-switch (depending on mounting).
    Z position by probe trigger -13.654: Z triggered
    Z position after stop -13.794:Z stop
    Floating fixture: https://youtu.be/UWsjam4jfIQ
  • Be sure the max. speed settings $110, $111, $112 are not too high - causing step loss
  • A homing of the machine is recommended
  • Find the needed travel range downwards for the Z axis. Manual probing can be started via the command "G38.3 Z-5 F200" (probe toward workpiece, stop on contact), where Z-5 a max. travel depth of 5 units (mm) defines with a speed of 200. If the probe is not triggered until -5, a depth of -5 will be assumed.
    With the manual triggered probing you can check the difference between Z position where the probe was triggered (check output in COM window) and the final stop position (check position in main window).
  • Setup and run the surface scan to get a height map
  • Apply height map to GCode to do auto leveling
  • Or export height map for further use as STL or X3D (soon)

The Probe

Some examples of DIY probes:
probes
1 with micro-switch, 2, 3 using a needle, 4, 5 made of brass

Setup of the surface scan

  • Open the surface scan window via [Machine control - Surface scan].
    Surface scan
  • Define the area where to scan the height profile via lower-left and upper-right edge, or via lower-left edge and X- and Y-dimension.
  • Set "Grid size X and Y" the distance from one to the next measurement point in units (mm)
  • Set "Max depth" the needed depth for probing before abort a specific probing
  • Set "Save height" above the work piece. Note: as less travel way the Z axis has, as faster the surface scan is.
  • Finally set "Probing speed Z" the speed of the downwards movement. The upwards speed is defined by the $112 setup, because "G0" is used.
  • Be sure the probe is above the work piece and Z coordinate is set to zero
  • Start the surface scan via "Generate Height Map"

During the surface scan

  • The main window shows the scan grid in yellow
  • The depth will be measured from the lower-left to the upper-right point, line by line, raster-point by raster-point.
  • Because the final depth-range is not known during the surface scan the result picture looks strange at the beginning.
  • If the probe-switch is still triggered when the next probing started, an error occurs and the scan will be aborted.
    Alarm 4 "Probe fail. The probe is not in the expected initial state before starting probe cycle, where G38.2 and G38.3 is not triggered and G38.4 and G38.5 is triggered."
    Error 9 "G-code locked out during alarm or jog state" - because there are still commands in the queue.

After the surface scan

  • After finishing the surface scan, the picture will be updated with the correct color-range and interpolated values (steps will be smoothed)
  • The offset to the max. measured Z value can be reomved from all measure points via "set max. value = 0"
  • The generated height map can be applied to an already loaded GCode. Be sure height map is greater than GCode object!
    All circles (G2, G3) will be converted to tiny line-segments All G1 movements will be converted to tiny line-segments The interpolated Z-value from the height map will be applied to each line-segment
    Note: any line-segment outside the height map area will be set to Zmax of the height map (lowest depth).

Getting height map data

Export of height map as X3D model

It took almost 9 hours to probe 32761 points in 0.1 mm resolution for this coin.
Z axis was stretched by factor 100 before export to X3D.

Z-Value from DIY-Control interface

Setup your external hardware to send the Z-Value in the format "(PRB:Z-5.12)", where -5.12 the actual Z-Value is.
Your hardware should send the value frequently or on trigger when receiving "<IDLE..."
In the surface-scan-window set "Probe-Max. depth" to zero. This triggers GRBL-Plotter to process received Z.values instead of sending G38 to grbl. Change Save height also to zero to speed up scan.