<p>You can control in Marlin what the direction of the stepper motor is, e.g. my Hypercube CoreXY printer (which has a similar setup like you described) has the following set (in the Marlin <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration.h" rel="nofollow noreferrer"><code>Configuration.h</code></a> file) to ensure the platform raises when it has to decrease height:</p>
<pre><code>// Invert the stepper direction. Change (or reverse the motor connector) 
// if an axis goes the wrong way.
#define INVERT_Z_DIR true
</code></pre>
<p>Furthermore, it matters where the Z endstop is located, e.g. using a bed probe sensor or a min Z endstop, you need to home towards a decreasing height (in the direction of your probe/endstop):</p>
<pre><code>// Direction of endstops when homing; 1=MAX, -1=MIN
#define Z_HOME_DIR -1
</code></pre>
<p>Don't forget to set a max Z height that falls within the printer volume, e.g.:</p>
<pre><code>#define Z_MAX_POS 345
</code></pre>
<p>If the bed is heavy, you should also prevent the steppers to lose power when not being used, so at least set Z to <code>false</code>:</p>
<pre><code>// Disables axis stepper immediately when it's not being used.
// WARNING: When motors turn off there is a chance of losing position accuracy!
#define DISABLE_Z false
</code></pre>

CC BY-SA 4.0
2021-03-08T20:19:37.843Z
This is very helpful, when I get things build this will really help me get my firmware set up correctly.
Ben Crawford
CC BY-SA 4.0
2021-03-08T10:30:26.477Z
2021-03-08T12:47:36.770Z
2021-03-08T12:47:36.770Z
0scar
<p>To understand normal commands from a basic printer slicer, all movement commands in g-code are written to be away from the base layer as positive. Note that <em>technically</em> a &quot;lower the bed&quot; printer does violate Orthonormal coordinates unless you either swap X and Y while retaining 0 in the front-left corner or put 0 in the front-right corner, going left for +X (e.g. inverting that motor axis too) and back for -Y.</p>
<h1>Hardware</h1>
<p>To <em>invert</em> the movement direction of an axis without rewriting the firmware there are two main ways, from mos invasive to easiest:</p>
<ul>
<li>Mount the actuator &quot;upside-down&quot; as that flips the rotational normal vector.</li>
<li>use a left-hand-threaded rod and nut. This does not flip rotation but how rotation affects the bed.</li>
<li>alter the stepper cables by &quot;crossing&quot; one of the phases leads. The motor rotates reversed to its commands now.</li>
</ul>
<p><a href="https://i.sstatic.net/miZU6.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/miZU6.jpg" alt="enter image description here" /></a></p>
<h1>Firmware</h1>
<p>In Marlin, you can also just flip the direction of the motor via <code>configuration.h</code> by altering the line from <code>false</code> to <code>true</code>:</p>
<pre><code>#define INVERT_Z_DIR true
</code></pre>

CC BY-SA 4.0
2021-03-08T10:10:07.270Z
2021-03-08T14:40:05.593Z
2021-03-08T14:40:05.593Z
Trish
<p>I am building a 3D printer from scratch, the bed will only move on Z and the head will stay at the top of the printer and move X and Y.</p>
<p>How do I modify the Marlin firmware to have the bed lower as it prints instead of lift like most printers.</p>

<marlin><z-axis>
How to setup Marlin to use a moving bed (up-down)?
Ben Crawford
# How to setup Marlin to use a moving bed (up-down)?

(Asked by: username_0 on 2021-03-08)

I am building a 3D printer from scratch, the bed will only move on Z and the head will stay at the top of the printer and move X and Y.

How do I modify the Marlin firmware to have the bed lower as it prints instead of lift like most printers.

**Tags:** marlin, z-axis


---

## 2 answers

### Answer by username_1 on 2021-03-08. Score: 1 | Accepted answer

You can control in Marlin what the direction of the stepper motor is, e.g. my Hypercube CoreXY printer (which has a similar setup like you described) has the following set (in the Marlin [`Configuration.h`](https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration.h) file) to ensure the platform raises when it has to decrease height:

```
// Invert the stepper direction. Change (or reverse the motor connector) 
// if an axis goes the wrong way.
#define INVERT_Z_DIR true

```

Furthermore, it matters where the Z endstop is located, e.g. using a bed probe sensor or a min Z endstop, you need to home towards a decreasing height (in the direction of your probe/endstop):

```
// Direction of endstops when homing; 1=MAX, -1=MIN
#define Z_HOME_DIR -1

```

Don't forget to set a max Z height that falls within the printer volume, e.g.:

```
#define Z_MAX_POS 345

```

If the bed is heavy, you should also prevent the steppers to lose power when not being used, so at least set Z to `false`:

```
// Disables axis stepper immediately when it's not being used.
// WARNING: When motors turn off there is a chance of losing position accuracy!
#define DISABLE_Z false

```

> **Comments:**
> **username_0**: This is very helpful, when I get things build this will really help me get my firmware set up correctly.  

---

### Answer by username_2 on 2021-03-08. Score: 0

To understand normal commands from a basic printer slicer, all movement commands in g-code are written to be away from the base layer as positive. Note that *technically* a "lower the bed" printer does violate Orthonormal coordinates unless you either swap X and Y while retaining 0 in the front-left corner or put 0 in the front-right corner, going left for +X (e.g. inverting that motor axis too) and back for -Y.

# Hardware

To *invert* the movement direction of an axis without rewriting the firmware there are two main ways, from mos invasive to easiest:

* Mount the actuator "upside-down" as that flips the rotational normal vector.
* use a left-hand-threaded rod and nut. This does not flip rotation but how rotation affects the bed.
* alter the stepper cables by "crossing" one of the phases leads. The motor rotates reversed to its commands now.

[![enter image description here](https://i.sstatic.net/miZU6.jpg)](https://i.sstatic.net/miZU6.jpg)

# Firmware

In Marlin, you can also just flip the direction of the motor via `configuration.h` by altering the line from `false` to `true`:

```
#define INVERT_Z_DIR true

```


---

