Hi Alden,
I'm wondering if you think using the G28.2 command could be an effective strategy to auto-level a PCB before milling? Or if you think there could be a better approach using TinyG?
PCBs typically have a warpage of 0.1 to 0.2 mm across the board depending on how large the PCB is. One way to combat this is to have a vacuum table to suck the PCB down flat. Most folks don't have a vacuum table and in many cases vacuum tables kill your ability to drill holes in the PCB.
An alternative technique is to measure the warpage by probing and then adjust the Z positions of the Gcode to compensate for the warpage. On a 40mm x 40mm PCB board you could probe every 2mm to get a good Z offset grid.
If I run a G28.2 command after attaching wires to the PCB and the endmill and then connecting those to the Z Min switch on the TinyG I get the following output from TinyG:
g28.2 z0
{"r":{"f":[1,0,9,3334]}}
{"sr":{"coor":0,"dist":1}}
{"qr":28}
{"qr":27}
{"sr":{"vel":15.21,"mpoz":-0.008,"stat":9}}
{"sr":{"vel":20.00,"mpoz":-0.041}}
{"sr":{"mpoz":-0.074}}
{"sr":{"mpoz":-0.106}}
{"sr":{"mpoz":-0.139}}
{"sr":{"mpoz":-0.172}}
{"sr":{"mpoz":-0.204}}
{"sr":{"mpoz":-0.237}}
{"sr":{"mpoz":-0.271}}
{"sr":{"mpoz":-0.302}}
{"sr":{"mpoz":-0.336}}
{"sr":{"mpoz":-0.369}}
{"sr":{"mpoz":-0.401}}
{"sr":{"mpoz":-0.434}}
{"sr":{"mpoz":-0.467}}
{"sr":{"mpoz":-0.499}}
{"sr":{"mpoz":-0.532}}
{"sr":{"mpoz":-0.566}}
{"sr":{"vel":19.05,"mpoz":-0.598}}
{"qr":27}
{"sr":{"vel":10.00,"mpoz":-0.587,"stat":9}}
{"sr":{"mpoz":-0.570}}
{"sr":{"mpoz":-0.553}}
{"sr":{"mpoz":-0.538}}
{"sr":{"mpoz":-0.521}}
{"sr":{"mpoz":-0.504}}
{"sr":{"mpoz":-0.488}}
{"sr":{"mpoz":-0.472}}
{"sr":{"mpoz":-0.455}}
{"sr":{"mpoz":-0.439}}
{"sr":{"vel":2.22,"mpoz":-0.425}}
{"sr":{"vel":0.00,"mpoz":-0.425,"stat":3}}
{"qr":28}
{"sr":{"mpoz":0.000,"coor":1,"dist":0}}
In that output, if I scan it and look for the lowest Z poisition I see "mpoz":-0.598. That would then be recorded for that probe location. Running this for all grid points I could get the differing values and create the auto-level grid.
The problem is my Z position reference is lost on each probe step because the Z gets set back to 0. So, i could reset it with a G28.3 command, but that seems like it wouldn't be accurate anymore. I could perhaps look at each probe step as if it's a relative offset from the last probe step. If I could instead just ask during the G28.2 to NOT reset Z to zero that could solve my problem perhaps. Also, the Z positions given to me by the TinyG may not be the bottom-most Z position when the Z Min switch is hit because the TinyG is only reporting to me every N ms. So, I may be getting decent data, but not perfect data.
Do you think this would work? Do you have any other strategies? One other idea is to just use an Arduino with an independent probe rather than try to coerce the TinyG into doing this for me.
Thanks,
John



