Tuesday, January 6, 2015

GRBL Height Probing Tutorial

[Outdated, new version with arc support available on GitHub: https://github.com/martin2250/GrblHeightProbe2,http://www.youtube.com/watch?v=kzXzvcUAuus]


Hey makers!

I finally came around to record the promised tutorial on height mapping and auto-levelling G-Code files with a GRBL 0.9+ controller.


In this tutorial I show how I go from a design in E.A.G.L.E. to a finished single layer PCB with  traces narrower than 0.4mm using my custom toolchain to compensate for substrate unevenness.

The binaries of the toolchain are available here:
https://www.dropbox.com/s/tx9eoei24z616lk/PCBAutolevellingV2.zip?dl=0
The source is available here:
https://www.dropbox.com/s/i46by0twp191d9l/AutolevellingSource.zip?dl=0

(please note that google drive reported both files as viruses which is why I switched to Dropbox. If you don't trust me, just go through and recompile the source. there is nothing to worry about)

Be sure to read the readme included in the download, there are some more tips and tricks as well as a few instructions.

Notes:
The toolchain does not support arcs right now. This means that you have to use programs like GCodeRipper to convert all G2/G3s to smaller G1 moves. Since pcb-gcode does not use arcs this is no issue if you want to make PCBS. May get implemented in a later release.

To see some more information on how your gcode file was parsed, select the file in the list on the left in HeightToGCode3. you will see some basic info as well as all lines that could not be parsed.



27 comments:

  1. Excellent tutorial. Well done. I have been looking for a way to do this on my homemade router. Now I can.

    Ausgezeichnet. Vielen dank fuer Vorfuehrung.

    Mike (USA)

    ReplyDelete
    Replies
    1. Noch eine kurze Frage: Ich benuetzte Mach3. Ist GRBL damit kompatibel?

      Delete
    2. Hi Mike, glad you like it!
      Mach3 iisn't compatible with my software, but you could take a look at http://www.autoleveller.co.uk/ or similar software which will work with your setup.

      Delete
  2. Hi Martin, amazing job. What changes did you do at drill file to stop the machine and change the bits?

    ReplyDelete
    Replies
    1. Thanks Hector!
      I simply opened the file in N++ and copied the individual operations to seperate files. Also, there is quite a lot of code that can be removed if you only use GRBL to interpret it.

      Delete
  3. Hello Martin!
    I just try to create a pcb using your program but I have some problems. I Run the HeightProbe2.exe, using the same settings that you make, however when the bit touches the surface, it stops and says the work is done. The preview window reflects nothing, just like Excel spreadsheet. Is necessary an additional program to my computer? I'm using GRBL 0.9i
    Thank you in advanced :)

    ReplyDelete
    Replies
    1. Hello Hector,

      I really don't know what's up with 0.9i and at the moment I can't easily test it. Does it still work with 0.9g?

      Delete
  4. Hello,
    how do I hook up the two wires to the arduino when running the height probe software?

    ReplyDelete
    Replies
    1. Hi, you have to connect one wire to ground, the other one to A5

      Delete
  5. great work! one question: I am intrigued by the way you hold down the work piece. I looks like you added something that has threads ("Gewinde") in the wood board on the CNC. What are they called? What keeps them from rotating when you screw in the bolt from the top?

    ReplyDelete
    Replies
    1. Thanks, you're looking for threaded inserts. Basically, it's an adapter from very coarse "wood" thread to a standard M6 machine thread.
      http://i.ebayimg.com/00/$(KGrHqYOKiQE1(hTOBvzBN,YBT7Dkg~~_35.JPG?set_id=8800005007

      Delete
    2. Thank you!!! :-) Much better than having to push a bolt through a hole from the bottom every time.

      Delete
  6. Thanks for this excellent tutorial and program - looks like I'll have to swap from Mac to a PC for controlling my shapeoko so I can take advantage of it :)
    So far I've been holding pre-cut boards on a jig that I level by milling it, unfortunately I need to re-mill a jig for each change of board, or if I've removed and then replaced a jig, which is much more time consuming than your method!

    ReplyDelete
    Replies
    1. Great! If you have any questions or suggestions be sure to leave them on the github issue tracker!

      Delete
  7. Excellent stuff. I'm rather new to this G-Code stuff. Does your app query the GRBL device for axis steps per mm on connection? Just wondering how that is done.

    ReplyDelete
  8. thanks! grbl acts as an abstration layer so my app only sees the position in mm. no need for resolving step counts.

    ReplyDelete
  9. I am trying to use this with the G-Shield for the Arduino (XCarve). But while the G38.2 command works, any attempt to create an autolevel probe sequence fails with the router head not stopping, as if it is not getting the proper response from the G Shield

    ReplyDelete
  10. I am attempting to use the app but I am a bit confused by the offsets setting in the height map dialog. Are those for the size of the board? At the moment, the probe just descends until it crashes.

    ReplyDelete
  11. Martin. This is pretty sweet. We got a lot of it working but, I assume I have to GENERATE HEIGHT MAP prior to loading my Gcode file. When I attempt to create the height map I get an error "An object of type convertible to "double" is required." We're stuck there. Are you doing a cast or something that I need to change in the code?

    ReplyDelete
    Replies
    1. Hi Jona,

      great to see that you stuck around and got it to work so far. The "Generate" dialog is only there for testing purposes. Say you want to test the app without having to fire up your machine. The dialog takes a mathematical expression (2D scalar field) to create fake height maps.
      (my shitty proprietary file format makes it hard to do this by hand)

      If you actually want to probe something, you have to click "New" and enter all your parameters there (size, gridsize and offset). The sofware is clever enough to only probe empty spots in the grid which makes pausing and resuming (even after closing and re-opening the app) possible.

      Delete
    2. Concerning your questions regarding the offsets:
      The offset is basically the most bottom-left coordinate of the probed area. Grid size and point count then make up the size of the board.
      Both, however have no influence on the Z-motion of the machine. Be sure to manually (via the console) set Z0 to the surface of the board before you start probing. (If it still crashes, double check the connections and grbl settings. use "G38.2Z-5F20" to test your setup manually)

      Delete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Replies
    1. yes, together with a Stepper Driver Shield

      Delete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hi martin, im working on a CNC project, i created my own gcode sender and my owm arduino controller for the stepper motors, but i had some problems with the level of the pcb so i decided to adapt you wonderful program to my cnc, i'm able to move my cnc manually throught your program but when i hit start probing nothing happen, i the problem is that my arduino doesn't answer to the program in a proper way

    ReplyDelete