Quantcast
Channel: Reprap Forum - Firmware - Marlin
Viewing all articles
Browse latest Browse all 12089

Re: How to use AutoBedLeveling for CNC stock surface mapping ?

$
0
0
Sorry I was tied up on the weekend.
I didn't really understand the way Marlin worked regarding X Y Z positions, it keeps track of a RAW and a LOGICAL data set. Anyway, that made the whole thing a bit easier.
It looks like I've got a system working. But, I'm not sure the way I use it will be the same as the way you use it.
I use a Z-Max limit sw, so when i issue a G28 or G28 Z cmd, the spindle homes to the Max Z moving the spindle all the way up. My mapping probe is connected to Z-Min input.

My GCODE Header work flow is as follows - in Gcode -- without leveling:
; Beginning of Header
M80; Turn On Power Supply (PC ATX PS = Power for Steppers)
G90 ; ABSOLUTE MODE

g28 Z0 ; home to limit sw
g28 Y0 ; home to limit sw
g28 X0 ; home to limit sw

M3 S8500; turn Spindle On to Snnn RPM

; Move spindle to desired Start Pos - XY corner of the Work piece
; EDIT NEXT 2 LINES
G0 x20 y40 f12000 ; xy corner of material
G0 z132 f1200 ; top of material NOTE: in my set up, ZMAX == 210, so I am moving it down from 210 to 132 (This Value is obtained by running a G30 command and is different with each bit change and material height )

g92 x0 y0 z0 ; set current LOGICAL location to 0,0,0

G0 Z5.080 F1200; Spindle is now 5mm above the XY starting corner of the material.
;----- End Of Header
; --- run the actual Gcode for Cutting ----

So, to use the Surface mapping, here is my new work flow, before I run the above GCode header and cutting file

G28; Home
G0 Xnn Ynn Fnn; send the spindle to the XY corner of the work material, such as X20 Y40
G92 X0 Y0;

G29 L0 F0 Rrr Bbb Xxx Yyy T; Where rr = Right (X) size of work area to map, bb= back or Y size of material to map and X and Y = how many grid points per X and Y for the map if T is given it will print the results out to the serial port so the host software will display it (I am currently using Repetier Host for sending the GCode files)
; I can't use the Defaults for the LFRB at least not for the RB so i must send them with the g29 command, I've included a CNC_LEVELING_VALUES define in the configuration.h file that when enabled, the G29 command either HAS to have
; the LFRB XY values explicitly set, or it will give an Error and not run the mapping. The only exception is you can issue a G29 T and it will not do a map, but, will print out the current map to the serial port

; This will then create the MAP - but, it will calculate the Z Height at whatever Height the Probe is-- which will NOT be the same as the cutting Bit...
; so, after running G29 i move the spindle back to the material XY starting corner, which will be 0, 0 since I used the G92 command to set 0,0 to the work piece corner
G0 X0 Y0 F12000

; remove the Probe and if not already installed, install the router bit,
; then issue G30 command. This will do a single probe at the starting corner of the work piece.
; I have Modified the G30 it not only will not disable the Mapping, but, i've added a value to the configuration.h file called ZERO_PLATE_THICKNESS that you set to the thickness of the TouchPlate
; this way when we do a G30 it will calculate the Z height (-) (minus) the thickenss of the touchplate, so it will get the exact Z height of the work stock at the starting corner.
; the other thing it does, is it will get the Z value of the first map point, 0,0 and get the Difference between the Probed Z at that point, and the Z height of the Bit at that point. That gives me the Z-offset of the bit... so I don't have to calculate it, or set it manually, the G30 will now calculate it for us.
; Then, it will take this Difference value and apply it to all remaining points in the map, adjusting the map for the height of the bit to surface work area. This is all done automatically when we issue the G30 command, as long as CNC_LEVELING is defined in the configuration.h file
; so after this G30 we can then go ahead and run the Gcode script to cut the work piece,
; the Gcode can re-Home the spindle, etc, and the mapping data will still be there and mapping will still be enabled.
; After the first bit is done cutting, if another bit is needed, like a rough cut, then final cut or additional cuts,
; change the bit and move spindle to Starting corner of work piece and issue another G30 with the touch plate in place and it will get the Z height with the new bit - (minus) the thickness of the touch plate, get the difference in height and apply that new
; difference to the map - again, and it is ready to cut with the second bit, you can Home, etc, and cut away. And, you can do this as many times as you need, the map data will not be disabled.
; you can issue a G29 T to view the existing map data.

So far i have only DRY run it, i haven't had time to put on a piece of wood and cut it, but, after mapping, I issue HOME and G30, i can use G0, G1 and move the spindle around (I had purposefully put a board on the work area on a tilt) and as you move around the spindle in the X Y directions, the Z tracks up and down as needed to keep the spindle level to the tilted surface.

I am uploading the Configuration.h and Marlin_main.cpp HOWEVER, these two files were customized previously by someone else for the MPCNC machine. That machine uses 2 steppers for both the X and Y axis, and this modified Marlin controls each stepper individually with separate limit switches on each stepper. So, you may not be able to use the Marlin_Main.cpp I am sending directly, I have noted where i did the changes for the CNC Leveling, so search for "CNC_Added" and copy the code in those areas to the .cpp file that you use. Same with the Configuration.h file. Let me know if this works for you.

Viewing all articles
Browse latest Browse all 12089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>