Introduction: Motion Configuration on Ramps 1.4 With Marlin Firmware @section Machine

About: I'm blogging about my projects before they make it to Instructables.com Once I've finished a subject on my blog, I'll put it together and post it on Instructables, so you can get a preview on my site.

As promised in my last Instructables Configuring Endstops on Ramps 1.4 with Marlin firmware - @section homing the time has now come to make a follow up. This time about Motion Configuration.

This is going to be a, hopefully, complete tutorial on configuring Motion Control on 3D printers build on Ramps 1.4 using Marlin firmware. Not having Delta, or CoreXY printers included.

I am going to use Pronterface/Printrun host program to connect to my printer and issue Terminal commands (G-codes). That sounded very hairy, but it is just a simple program with a graphical interface.

Even though I'm going to use Ramps 1.4 and Marlin firmware 1.0.2, this tutorial will most likely be usefull for most setups. We are going to use the newest Arduino IDE to edit the Marlin firmware.

What we cover in this Instructables:

  1. Stepper Direction
    1. Homing Direction
  2. Software Endstops
  3. Some final tweaks
    1. Quick Home
    2. Babystepping
    3. All set

Small change since last:

My last instructable was made using Release Candidate 2 of the Marlin firwmware. Due to some incompatibilities I had to change to the latest stable firwmare, so the layout is a bit changed from the images in the previous Instructables. It means I made brand new images for this one :)

Requirments

  1. It is required/necessary that you have setup your endstops before beginning on this Instructable.
  2. You need to have defined you steps for your steppers. You can find calculators here:
    1. http://prusaprinters.org/calculator/

    2. http://reprap.org/wiki/Triffid_Hunter's_Calibration_Guide

    3. http://lmgtfy.com/?q=reprap+calculate+steps+per+mm

Step 1: Stepper Directions @section Machine

Place your Carriage (hotend assembly) in the middle of your X and Y axes, and connect to your printer using Pronterface/Printrun. Also power it up.

Check Endstop Status

Start by sending M119 to the printer to check endstop status. They should all show Open before continuing.

Pronterface - Check Stepper Directions

Now use the directional arrows in Pronterface to gently move the axes, using 1mm and 10mm. You might only be able to move an axis using the + for that axes.

The main thing here is to write down wheter an axis is moving the right direction or not.

Pro-tip: You might want to keep you finger near the on/off switch on your printer.

Firmware - Stepper Direction

Find INVERT_X_DIR in your Marlin firmware in the Configuration.h tab. If you use a Release Candidate of the firmware, it will be located in the @section Machine.

#define INVERT_X_DIR true    // for Mendel set to false, for Orca set to true
#define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
#define INVERT_Z_DIR true     // for Mendel set to false, for Orca set to true

For any axis which moves the wrong way, you change the true to false or vice versa.

Firmware - Homing direction

Next we setup homing direction.

For most printers we want to home it to our front left corner, which we define as our X and Y minimum endstops. We also want our hotend to be close to our bed, which is Z min as well.

These XYZ minimum endstops are also referred to as our Origin and will normally be 0 on their respective axes.

Find X_HOME_DIR in Configuration.h file, and set HOME_DIR for X, Y and Z to -1. - as shown in below code-block.

This tells our axes to home to the minimum endstops.

// ENDSTOP SETTINGS:
// Sets direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1

Some printers use different topologies, so you might need to change this. Ultimaker 2 homes to X min, Y max and Z max.

Verify our changes

Disconnect Pronterface, Upload firwmare and check if the axes move in the right directions. Make changes if neccessary.

Homing

When everything moves as it should , you test the homing function. You can test using the icons with a "house (home)" on it for each axis, or use the G28 command followed by the axis you want to home.

If you just type G28; you home all axes.

You can also type G28 X or G28 XY or some other combination.

Step 2: Software Endstops - @section Machine

Before starting on this section we need to make a change in the Configuration_adv.h sketch.

Locate and make sure ENDSTOPS_ONLY_FOR_HOMING is commented out, like so:

// #define ENDSTOPS_ONLY_FOR_HOMING

We need to complete this step in order to get readings from any max-endstops we might have in place.

If you do not have any max-endstops, you can ignore thisstep.

G28 - Start by homing

  1. Home all axes using G28 (1)
  2. Use M114 (2) to verify that your printer is actually considering itself at 0 n all axes.
  3. Pro-tip: The M84 (3) I send (shown in image) is to turn off motors, as they buzz while I type.

Software endstop - Travel limits after homing

In Configuration.h find max and min_software_endstops, and make sure they are set to true

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

Below is the default settings for software endstops.

For our purpose it is usefull if you change them to something more than your actuall axes lengths in order to move our axes as far as we need to find the max area for the printer.

Pro-tip: If you have your homing endstop at a MAX_POS, you will need to use negative values to indicate how far back it can go in order to reach the MIN_POS

// Travel limits after homing
#define X_MAX_POS 205
#define X_MIN_POS 0
#define Y_MAX_POS 205
#define Y_MIN_POS 0
#define Z_MAX_POS 200
#define Z_MIN_POS 0

Axes MAX positions

Below points are shown in the image numbered blue 1-4

  1. If you havn't done so allready, you start by homing all axes, using G28 (1)
  2. Issue M114 command to make sure all axes are at 0.
  3. Now move all AXES as far towards MAX as you can. Either untill you hit a MAX endstop, if you have any such, or just as far as you can move it and stay within you bed - you do not have to Count!
    1. If you have Max endstops you can read the position in the terminal window.

  4. Issue M114 to get a read out on posistions. You can see it rounded up.

Update your firmware

Now go update your firmware according to your system. Notice how I substracted some 11mm due to a clip on my heated bed. You might have similar considerations.

Pro-tip: Note how I place // after the mm input and then write notes. This is a good way to keep tabs on what you did for what reason.

// Travel limits after homing
#define X_MAX_POS 227 // 227.81 MAX
#define X_MIN_POS 0
#define Y_MAX_POS 180 // 190.96 MAX - 11 for clip
#define Y_MIN_POS 0
#define Z_MAX_POS 190
#define Z_MIN_POS 0

Step 3: Final Tweaks and Famous Last Words

Some final tweaks


We might want to undo the setting we made to ENDSTOPS_ONLY_FOR_HOMING. Meaning we enable it again, in the Configuration_adv.h file.

I'm enabling it again as I want to be able to use Z-offset to tweak nozzle distance from the bed, which would be impossible with this setting enabled - I'll see if I can't make a simpler guide than the one I linked to. If you have no such plans, then keep it disabled as it is an extra safety measure. I've used it up untill now and liked it.
Notice I made a comment above the line. It's to make it easier for me to find it.

// MDN Endstops only for homing
#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing

Quick Home

I do not like waiting for the X and Y axes hóming seperately. Luckily we can make them home at the same time by ennabling (uncommenting) QUICK_HOME in the Configuration_adv.h

// MDN Quick home
#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.

Babystepping

You can also enable BABYSTEPPING, which I do below here - it Means you can use your LCD knob to move the axes in tiny increments to tweak the printer after it has started printing. Very usefull to tweak Z-axis if it is a bit off. There is also a setting to define feedrates when using an ULTIPANEL (lcd).

Pro-tip: If you aren't aware of it, you can bring up the search box by using CTRL+F og from Edit -> Find...

Pay attention to the warning about this functions ignores Z-min, so you can "crash" the bed against the nozzle.

In reality you have to turn the knob a lot to make the bed move.. like an entire turn to even notice the bed moving, so you have to have very quick fingers to do any harm. I know I've played a lot with it and took a while to even figure out that it wasindeed moving.

The Babystepping is only gong to show up in the display after you have startet printing.

// Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
// it can e.g. be used to change z-positions in the print startup phase in real-time
// does not respect endstops!
// MDN Babystepping
#define BABYSTEPPING

All set

Now your all set with all the basic movement settings configured :)
I'll recommend you read through the Configuration.h and Configuration_adv.h files and see if you find anything interesting. Like X_HOME_RETRACT_MM which tells the printer how much to retract after hittingendstop, then slowlinggoing back.

Have fun and maybe even follow me here on Instructables.com :)

Tech Contest

Participated in the
Tech Contest