Close



Results 1 to 10 of 68

Threaded View

  1. #1
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182

    Auto_Bed_Leveling: Z-Probe Repeatability code

    UPDATED 04-28-2014 to include the L (legs of movement) parameter.

    If you have Auto_Bed_Leveling running on your Rep_Rep, you may be interested in this thread. My printer's Z-Probe uses the cheapest micro-switch on eBay. I have the servo for the Z-Probe embedded in my heavily modified Wade's extruder. I am getting very good results with the Auto_Bed_Leveling, but I'm curious if a higher quality micro-switch would help me. I am also curious how good the mechanical repeatability of my various axis are. The problem is the tools don't exist to know this answer.

    As a result of this, I've written a Z-Probe Repeatability function for Marlin. It will return the standard deviation of a set of sampled points. The code is attached for those that want to compare their results to mine and share it in this thread. To use this code, edit Marlin_Main.cpp and search for:

    else if(code_seen('M'))
    {
    switch( (int)code_value() )
    {

    Insert the attached code at this point. Recompile and upload the new firmware to your board.

    To use the code, issue a G28 command to home all of the axis. Then issue an appropriate M48 command. The defaults for the M48 command are reasonable and should produce results with no extra parameters. Just a simple G28 followed by M48 will get you preliminary results.

    The code lets you specify a number of additional parameters. You can specify the X and Y coordinate where you want the sample taken. The Z-Probe's offset is factored into these numbers. If you specify the samples should be taken at (X,Y) = (50,75) it will move the nozzle such that the probe is being done at (50,75). This can be done by sending an M48 x 50 y 75 to your printer.

    You can specify the number of samples with the n parameter. If you want the M48 command to take 20 samples at the current location, this can be accomplished by sending an M48 n 20 to your printer. It is important to note that the parameters to the M48 command can be either upper or lower case letters with the exception of the n parameter. This must be lower case because Marlin has already grabbed the capital N for its protocol to communicate with the program sending it data. You will make Marlin horribly sick if you use a capital N. I could have picked a different letter, but n made sense for the sample set size.

    There is a V parameter to control verboseness. The default value is 1. You can set it as high as 4. You can limit chit chat by setting it to 0. The main value to setting it higher such as 3 or 4 is you will see the mean and standard deviation change slightly as more and more points are taken. You can safely ignore this parameter. If you want to play with this you can send your printer a M48 V 4 command.

    The latest addition is the L parameter. This specifies how many legs of movement to do prior to taking a measurement. It is used to stress the X and Y axis to help you understand if there is any slop on these axis that is contributing to unrepeatability in the Z-axis. Normally this code is not invoked but when specified it will decide on a rotational direction at random and move some nominal radius from the probe point. It will step along an arc that is more or less at the originally decided radius until the specified number of legs is accomplished. Then the measurement will be taken. You can try this parameter by sending a M48 n10 v4 l8 to your printer and seeing if it increases your typical standard deviation at the measurement location.

    Lastly, there is an E parameter. This Engages and Retracts the Z-Probe for each sample. It is a good way to see if your Z-Probe mechanism is adding any instability to your system. To check this, you could do a G28 and then a M48 n 15 x 50 y 50 followed by a M48 n 15 x 50 y 50 e command. At the end of each M48 command you will be told the standard deviation for the sampled points. If the M48 command with the e parameter has a higher standard deviation it is likely to indicate you have some inconsistencies in where the Z-Probe is being positioned between engagements.


    OK... Now for the good stuff. Here is a cut & paste of my printer getting two M48 commands telling it to measure things at the center of the bed. One is with the Z-Probe down the entire time and the other is with the Z-Probe engaging and retracting.

    Connecting...
    Printer is now online.
    >>>G28
    SENDING:G28
    >>>M48 x 100 y 100
    SENDING:M48 x 100 y 100
    M48 Z-Probe Repeatability test. Version 1.50
    Mean: 4.162425
    Standard Deviation: 0.009255
    echo:endstops hit: Z:4.17
    >>>M48 x 100 y 100 e
    SENDING:M48 x 100 y 100 e
    M48 Z-Probe Repeatability test. Version 1.50
    Mean: 4.166162
    Standard Deviation: 0.015431
    echo:endstops hit: Z:4.16

    I have very limited data to work with. I only know that my printer is doing well with the Auto_Bed_Leveling. With more people contributing their results to this thread we will probably be able to determine how much repeatability is necessary to get good results. My G29 command is modified so the Z-Probe stays engaged the entire time. Most of you will not have that feature so you probably should be paying more attention to the second standard deviation with the e parameter specified. Right now, my standard deviation is 1/30 of my typical layer height (because I'm comparing myself to the first result). It is possible the rational I'm using to choose the number I'm comparing against is flawed. I'm most certainly open to criticism and to being corrected!

    So, with a sample size of 1 (me!!!), I'm thinking you probably will get good results if your standard deviation for Z-Probes is 1/30 of your layer height!
    Attached Files Attached Files
    • File Type: c M48.c (7.5 KB, 60 views)
    Last edited by Roxy; 04-28-2014 at 10:41 AM. Reason: Updated to include new L parameter to stress X & Y mechanics

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •