Java Magazine, Sept/Oct 2016
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2016 27 internet of things prbZ Double parseDouble matcher group 1 Additional empty methods omitted Executing this program homes the router and runs the probe algorithm to test the length of the tool The last method parses the probe output to find the Z coordinates of the router when the end mills tip is touching the probe To output the probe coordinates and cleanly shut down the router you can finish by using the following code System out println PRB_ Z listener prbZ TimeUnit SECONDS sleep 5 grblController closeCommPort Write down the value of PRB_ Z because you will need it for calculating the offset to the workplane Calculating the Workspace Location To figure out the workspace location you need to manually move the router to touch the surface of the work area The easiest way to do this is to open the UniversalGcodeSender user interface To run it use the appropriate platform specific script or simply type the following at the command line java jar UniversalGcodeSender jar The UI lets you specify the port and the baud rate Choose the same values you used in your Java program to connect to the CNC router and then click the Open button Once the router is connected it is in a WARN state because the router has not been homed Navigate to the Machine Control tab and click the H button to send a homing command Now you can manually control the router head by using the X Y and Z movement buttons Start with a course movement speed to get the head close to the work surface and then change to a finer movement speed as you get closer Using a piece of paper get the head as close to the work surface as you can without touching the paper as shown in Figure 1 The value for Z shown under the Machine Position section of the screen tells you where the top of your work surface is Record this value as WRK_ Z To calculate the PROBE_ OFFSET use the following formulas PROBE_ OFFSET PRB_ Z WRK_ Z 5 Plugging in the values that I got from my machine gives me Figure 1 Putting the head close to the work surface
You must have JavaScript enabled to view digital editions.