MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.21k stars 19.22k forks source link

Auto-leveling not working as expected in Robo3D R1 #2293

Closed WheresWaldo closed 9 years ago

WheresWaldo commented 9 years ago

Background: Robo3D R1 (R1) with auto-level and 8 mm threaded rods using stock firmware based on 1.0.0 works after a fashion. This is a report about auto-leveling in 1.0.2 release with the proper modifications for use on the R1.

Issue stems from the use of Z_PROBE_OFFSET_FROM_EXTRUDER. I will explain as best as I can. The R1 uses two switches under the x-carriage in parallel to determine when it has hit the endstop for the Z axis. These switches are normally closed and actuating either results in the endstop being triggered. They are affixed to nuts that can travel independently from the Z axis mounts. When the lead screws are turned beyond the point that the extruder head hits the bed, one or both switches activate (open). This is how the R1 knows it has hit the endstop. The distance the lead screws move between the time that the hotend hits the bed and the switch actually triggers the endstop was measured on my machine, but should apply to all R1's with auto-leveling, the Z_PROBE_OFFSET_FROM_EXTRUDER will be a negative value. In my specific case one or both switches trigger -1.19 mm from the top of the bed.

On line 402 this offset was inserted in the proper line. Among other changes in Configuration.h to make it work for the R1.

--- D:\Documents\Arduino\Marlin-1.0.2-1\Marlin\Configuration.h 6/14/2015  4:07:30 PM
+++ D:\Documents\Arduino\Robo_1.0.2\Configuration.h 6/14/2015  4:09:02 PM
@@ -28,34 +28,34 @@
 //#define STRING_VERSION "1.0.2"

 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
-#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
+#define STRING_CONFIG_H_AUTHOR "(BH, R1 Single Extruder)" //--ROBO-BH

 // SERIAL_PORT selects which serial port should be used for communication with the host.
 // This allows the connection of wireless adapters (for instance) to non-default port pins.
@@ -44,54 +44,54 @@
 // The following define selects which electronics board you have.
 // Please choose the name from boards.h that matches your setup
 #ifndef MOTHERBOARD
-  #define MOTHERBOARD BOARD_ULTIMAKER
+  #define MOTHERBOARD BOARD_RAMPS_13_EFB   //--ROBO-BH
 #endif

 // Define this to set a custom name for your generic Mendel,
-// #define CUSTOM_MENDEL_NAME "This Mendel"
+#define CUSTOM_MENDEL_NAME "Robo3D v1.0.2" //--ROBO-BH

 // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
 // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
@@ -104,113 +104,113 @@
 // 147 is Pt100 with 4k7 pullup
 // 110 is Pt100 with 1k pullup (non standard)

-#define TEMP_SENSOR_0 -1
+#define TEMP_SENSOR_0 1        //--ROBO-BH
-#define TEMP_SENSOR_1 -1
+#define TEMP_SENSOR_1 0    //--ROBO-BH
 #define TEMP_SENSOR_2 0
-#define TEMP_SENSOR_BED 0
+#define TEMP_SENSOR_BED 1  //--ROBO-BH

 // This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
 //#define TEMP_SENSOR_1_AS_REDUNDANT
@@ -129,138 +129,138 @@
 // When temperature exceeds max temp, your heater will be switched off.
 // This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
 // You should use MINTEMP for thermistor short/failure protection.
-#define HEATER_0_MAXTEMP 275
+#define HEATER_0_MAXTEMP 330   //--ROBO-BH
 #define HEATER_1_MAXTEMP 275
 #define HEATER_2_MAXTEMP 275
-#define BED_MAXTEMP 150
+#define BED_MAXTEMP 120        //--ROBO-BH

 // If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
 // average current. The value should be an integer and the heat bed will be turned on for 1 interval of
@@ -219,225 +219,225 @@
 //if PREVENT_DANGEROUS_EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately.
 #define PREVENT_LENGTHY_EXTRUDE

-#define EXTRUDE_MINTEMP 170
+#define EXTRUDE_MINTEMP 165        //--ROBO-BH
 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.

 /*================== Thermal Runaway Protection ==============================
@@ -248,262 +248,262 @@
 // uncomment the 2 defines below:

 // Parameters for all extruder heaters
-//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds
+#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds  --ROBO-BH
-//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
+#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius  --ROBO-BH

 // If you want to enable this feature for your bed heater,
 // uncomment the 2 defines below:

 // Parameters for the bed heater
-//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds
+#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds  --ROBO-BH
-//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
+#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius  --ROBO-BH
 //===========================================================================

@@ -272,282 +272,282 @@

 #ifndef ENDSTOPPULLUPS
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
-  // #define ENDSTOPPULLUP_XMAX
+  #define ENDSTOPPULLUP_XMAX   //--ROBO-BH
-  // #define ENDSTOPPULLUP_YMAX
+  #define ENDSTOPPULLUP_YMAX   //--ROBO-BH
-  // #define ENDSTOPPULLUP_ZMAX
+  #define ENDSTOPPULLUP_ZMAX   //--ROBO-BH
-  // #define ENDSTOPPULLUP_XMIN
+  #define ENDSTOPPULLUP_XMIN   //--ROBO-BH
-  // #define ENDSTOPPULLUP_YMIN
+  #define ENDSTOPPULLUP_YMIN   //--ROBO-BH
   // #define ENDSTOPPULLUP_ZMIN
 #endif

@@ -290,302 +290,302 @@
 #endif

 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
-const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
+const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. --ROBO-BH
-const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
+const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. --ROBO-BH
-const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
+const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.  --ROBO-BH
-const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
+const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. --ROBO-BH
-const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
+const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. --ROBO-BH
-const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
+const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. --ROBO-BH
-//#define DISABLE_MAX_ENDSTOPS
+#define DISABLE_MAX_ENDSTOPS   //ROBO-BH
 //#define DISABLE_MIN_ENDSTOPS

 // Disable max endstops for compatibility with endstop checking routine
@@ -313,319 +313,319 @@
 // Disables axis when it's not being used.
 #define DISABLE_X false
 #define DISABLE_Y false
-#define DISABLE_Z false
+#define DISABLE_Z true //--ROBO-BH
 #define DISABLE_E false // For all extruders
 #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled

@@ -330,344 +330,344 @@
 #define Y_HOME_DIR -1
 #define Z_HOME_DIR -1

-#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
+#define min_software_endstops false // If true, axis won't move to coordinates less than HOME_POS. --ROBO-BH
 #define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.

 // Travel limits after homing
-#define X_MAX_POS 205
+#define X_MAX_POS 240    //--ROBO-BH
 #define X_MIN_POS 0
-#define Y_MAX_POS 205
+#define Y_MAX_POS 254   //--ROBO-BH
 #define Y_MIN_POS 0
-#define Z_MAX_POS 200
+#define Z_MAX_POS 240   //--ROBO-BH
 #define Z_MIN_POS 0

 #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
@@ -346,352 +346,352 @@
 #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
 //============================= Bed Auto Leveling ===========================

-//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
+#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)   //--ROBO-BH
 #define Z_PROBE_REPEATABILITY_TEST  // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled.

 #ifdef ENABLE_AUTO_BED_LEVELING
@@ -372,413 +372,413 @@

     // set the rectangle in which to probe
     #define LEFT_PROBE_BED_POSITION 15
-    #define RIGHT_PROBE_BED_POSITION 170
+    #define RIGHT_PROBE_BED_POSITION 200   //--ROBO-BH
-    #define BACK_PROBE_BED_POSITION 180
+    #define BACK_PROBE_BED_POSITION 240        //--ROBO-BH
     #define FRONT_PROBE_BED_POSITION 20

      // set the number of grid points per dimension
      // I wouldn't see a reason to go above 3 (=9 probing points on the bed)
-    #define AUTO_BED_LEVELING_GRID_POINTS 2
+    #define AUTO_BED_LEVELING_GRID_POINTS 3       //--ROBO-BH

   #else  // not AUTO_BED_LEVELING_GRID
     // with no grid, just probe 3 arbitrary points.  A simple cross-product
-    // is used to esimate the plane of the print bed
+    // is used to estimate the plane of the print bed

       #define ABL_PROBE_PT_1_X 15
-      #define ABL_PROBE_PT_1_Y 180
+      #define ABL_PROBE_PT_1_Y 15  //--ROBO-BH
-      #define ABL_PROBE_PT_2_X 15
+      #define ABL_PROBE_PT_2_X 220 //--ROBO-BH
-      #define ABL_PROBE_PT_2_Y 20
+      #define ABL_PROBE_PT_2_Y 15  //--ROBO-BH
-      #define ABL_PROBE_PT_3_X 170
+      #define ABL_PROBE_PT_3_X 114 //--ROBO-BH
-      #define ABL_PROBE_PT_3_Y 20
+      #define ABL_PROBE_PT_3_Y 240 //--ROBO-BH

   #endif // AUTO_BED_LEVELING_GRID

   // these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
   // X and Y offsets must be integers
-  #define X_PROBE_OFFSET_FROM_EXTRUDER -25
+  #define X_PROBE_OFFSET_FROM_EXTRUDER 0       //--ROBO-BH
-  #define Y_PROBE_OFFSET_FROM_EXTRUDER -29
+  #define Y_PROBE_OFFSET_FROM_EXTRUDER 0       //--ROBO-BH
-  #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
+  #define Z_PROBE_OFFSET_FROM_EXTRUDER -1.19    //Found by actual measurement  --ROBO-BH

   #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
                                         // Be sure you have this distance over your Z_MAX_POS in case

-  #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
+  #define XY_TRAVEL_SPEED 20000         // X and Y axis travel speed between probes, in mm/min --ROBO-BH

-  #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
+  #define Z_RAISE_BEFORE_PROBING 5    //How much the extruder will be raised before travelling to the first probing point. --ROBO-BH
-  #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
+  #define Z_RAISE_BETWEEN_PROBINGS 3  //How much the extruder will be raised when travelling from between next probing points  --ROBO-BH

   //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
   //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
@@ -475,489 +475,489 @@

 //// MOVEMENT SETTINGS
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
-#define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
+#define HOMING_FEEDRATE {50*60, 50*60, 10*60, 0}  // set the homing speeds (mm/min)    --ROBO-BH

 // default settings

-#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for Ultimaker
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {80,80,2560,810}  // default steps per unit for RoboR1   --ROBO-BH
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
 #define DEFAULT_MAX_ACCELERATION      {9000,9000,100,10000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.

-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
+#define DEFAULT_ACCELERATION          1300    // X, Y, Z and E max acceleration in mm/s^2 for printing moves  --ROBO-BH
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts

 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
@@ -493,499 +493,499 @@
 // #define EXTRUDER_OFFSET_Y {0.0, 5.00}  // (in mm) for each extruder, offset of the hotend on the Y axis

 // The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
-#define DEFAULT_XYJERK                20.0    // (mm/sec)
+#define DEFAULT_XYJERK                17.0    // (mm/sec)  --ROBO-BH
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
 #define DEFAULT_EJERK                 5.0    // (mm/sec)

@@ -516,533 +516,533 @@
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
 //define this to enable EEPROM support
-//#define EEPROM_SETTINGS
+#define EEPROM_SETTINGS    //--ROBO-BH
 //to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
 // please keep turned on if you can.
 //#define EEPROM_CHITCHAT

 // Preheat Constants
-#define PLA_PREHEAT_HOTEND_TEMP 180
+#define PLA_PREHEAT_HOTEND_TEMP 200     //--ROBO-BH
 #define PLA_PREHEAT_HPB_TEMP 70
 #define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255

 #define ABS_PREHEAT_HOTEND_TEMP 240
-#define ABS_PREHEAT_HPB_TEMP 100
+#define ABS_PREHEAT_HPB_TEMP 80        //--ROBO-BH
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255

 //LCD and SD support
@@ -559,565 +559,565 @@
 // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
-//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
+#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER  //--ROBO-BH

 // The RepRapWorld REPRAPWORLD_KEYPAD v1.1
 // http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626

Here is the issue. After uploading and resetting the printer I perform a M503 to make sure that I get the following output M206 X0.00 Y0.00 Z-1.19. Once it is determined the correct offset is both in Memory and in EEPROM. I proceed with a G28 followed by a G29.

The output of the G28 is noted in a serial monitor as well as on an LCD Smart Controller installed on the printer. After issuing the G28 but before issuing the G29 the printer moves appropriately to home X then home Y then center the hotend to home Z. The result is that my location is listed as X:120 Y:127 Z:-001.1 (output is truncated by the software). This is behavior that is expected. If I then issue a G1 Z0 I end up with the hotend exactly where I expect it hovering at the top of the bed and Z0 being the actual point it should be. Here is where the problem begins. Now executing a G29 Auto-leveling command, the printer moves to the appropriate nine locations on the print bed and performs a Z axis endstop probe. When it has reached its 9th and final location the firmware makes the assumption that it is resting at the Z0 location when in fact it is actually at the Z axis trigger point. The more egregious part is that the firmware actually believes this point is Z0 + -Z_OFFSET_FROM_EXTRUDER. So not only is it 1.19 mm too low, it is telling me that it is 1.19 mm in the air. Any command to move the Z axis is now too low by double the amount of the offset. This is repeatable with any amount of negative offset you want to put in the Configuration.h file.

To verify that it isn't simply assuming that the Z_PROBE_OFFSET_FROM_EXTRUDER should have been entered as a positive number I edited the source with a +1.19, recompiled and performed the same experiment. This time the result was that the final resting place of the G29 command was still the trigger point but the firmware reported that I was actually at Z:+002.3. Any Z axis moves are now too low by over 3.5 mm. No matter what is placed in Z_PROBE_OFFSET_FROM_EXTRUDER, G29 appears to always assume that the last Z axis endstop trigger point is Z0 and then it adds the positive value of the offset instead of what it really is.

I am willing to provide any additional information and test various solutions to solve this issue. I would not have reported this until I understood the problem and saw no solution in any of the configuration file options.

thinkyhead commented 9 years ago

I'm happy with how it works now. All offsets are as they are intended to be. So if the sign changed someplace recently (and I'm not convinced it has) then that would have been a bug correction.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.