<p><a href="https://3dprinting.stackexchange.com/users/4762/greenonline">Greenonline</a> and I spent this evening hacking/reverse engineering the Ender3 to solve this. <a href="https://gr33nonline.wordpress.com/2018/08/13/compiling-marlin-for-a-creality-ender-3/" rel="nofollow noreferrer">Greenonline also wrote about this in his blog</a>.</p>
<h2>Step 1 - Get the Firmware</h2>
<p>To do this, there are basically two ways:</p>
<ol>
<li>Find the a ready-to-use firmware</li>
<li>Make your own</li>
</ol>
<p>Variant 1 would be to use the pre-supplied .hex files from Creality or some other manufacturer. Variant 2 means writing the settings yourself or using <a href="https://www.repetier.com/firmware/v100/" rel="nofollow noreferrer">Repetier firmware</a> to write the files for you. In the case of the Ender 3, the chip used sadly disqualified Repetier firmware, so writing it yourself is the only option.</p>
<p>To write the firmware yourself or using Repetier firmware, you need the old settings. To get these, connect the printer via USB, connect it with a software like <a href="https://www.repetier.com/" rel="nofollow noreferrer">Repetier host</a> and send <a href="http://marlinfw.org/docs/gcode/M503.html" rel="nofollow noreferrer"><code>M503</code></a> to get all the settings.</p>
<p>Now, either hack those into Repetier firmware or use a blank <a href="http://marlinfw.org/meta/download/" rel="nofollow noreferrer"><code>Marlin.ino</code></a> and the Arduino IDE to customise it. In the later case, you need to put the folder <code>Marlin-?.?.X.ZIP/Marlin-?.?.X/Marlin</code> into the <code>Arduino</code> folder in Documents (Windows) or Home (Mac). Now open the <code>Marlin.ino</code> in <a href="https://www.arduino.cc/en/Main/Software" rel="nofollow noreferrer">Arduino IDE</a>. Set up the new firmware with these base settings or adjust as needed.</p>
<h2>Step 2 - Adjust</h2>
<p>Now that we have our Configuration files (in the end we pretty much skipped step 1 and <a href="https://www.chaos-drucker.de/wp-content/uploads/2018/04/Marlin-Ender3-V1.zip" rel="nofollow noreferrer">grabbed a fitting (<strong>German!</strong>) one</a> from <a href="https://www.chaos-drucker.de/anleitungen-und-tutorials/creality-ender3-mit-marlin-ausstatten/" rel="nofollow noreferrer">Christian</a>, a German maker also known as &quot;Chaos-Drucker&quot;), we need to first adjust them as needed to fit our needs and then compile them properly (next step!). As an alternative (<strong>English!</strong>) base to work with, the <a href="https://www.th3dstudio.com/knowledge-base/th3d-unified-firmware/?seq_no=10" rel="nofollow noreferrer">TH3D firmware</a> is also available, provided by the Hooglands and team at TH3D.</p>
<p>So, let's open your <code>Marlin.ino</code> with <a href="https://www.arduino.cc/en/Main/Software" rel="nofollow noreferrer">arduino</a> and find the <code>X_MIN_POS</code> (<code>CTRL</code>+<code>F</code> &gt; <code>X_MIN_POS</code> &gt; Search all sketches).</p>
<p>In the configurations we grabbed the sketch file <code>Configuration.h</code> contains lines 786-789 <em>(might differ)</em>:</p>
<pre><code>// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -10
#define Y_MIN_POS -15
#define Z_MIN_POS 0
</code></pre>
<p>Adjust these till the wanted position is achieved - Repetier Host can help here to determine the right position.</p>
<h2>Step 3 - Compile</h2>
<p>The hardest step with the Ender3 was to get the code to actually compile, as it uses an <a href="http://www.technoblogy.com/show?19OV" rel="nofollow noreferrer">ATmega1284P 16Bit</a> which isn't supported by Arduino natively. While the <a href="https://github.com/MCUdude/MightyCore" rel="nofollow noreferrer">MightyCore</a> supports this chip, it doesn't compile with this hardware library. However, Christian did figure out that the <a href="https://github.com/Lauszus/Sanguino" rel="nofollow noreferrer">Sanguino</a> set to an ATmega 1284P 16bit does work. These belong as <em>extracted folders</em> into the <code>Arduino/hardware</code> folder, usually in your Documents (if you use Windows) or Home (on mac). Now, we did set <code>Tools&gt;Board:&gt; Sanguino</code> and <code>Tools&gt;Processor:&gt;ATmega1284 or ATmega1284P (16 MHz)</code></p>
<p>It was also mandatory to have the <a href="https://github.com/olikraus/U8glib_Arduino" rel="nofollow noreferrer">U8glib.h for Arduino</a> installed. To do this, download the zip from github, then in the Arduino software <code>Sketch&gt;Include Library&gt;Add .ZIP Library...</code> and choose the whole zip repository to auto install.</p>
<p>With these settings we were able to compile the settings.</p>
<h2>Step 4 - Getting it on the machine</h2>
<p>Most people would expect to read about bootloaders and flashing now, and indeed that is an option. But as I had just figured out <a href="https://3dprinting.stackexchange.com/questions/6654/how-to-install-a-hex-firmware">how to install firmware from .hex</a> and so I wondered: Can't we make .hex files from our settings? And yes, <a href="https://3dprinting.stackexchange.com/a/6658/8884">Arduino supports this</a>.</p>
<p>So, in Arduino IDE press <code>Ctrl</code>+<code>Alt</code>+<code>S</code> (or <code>Sketch &gt; Export Compiled Binary</code>). This will result in two files:</p>
<ul>
<li><code>Marlin.ino.sanguino.hex</code></li>
<li><code>Marlin.ino.with_bootloader.sanguino.hex</code></li>
</ul>
<p>Of these two, the <code>Marlin.ino.sanguino.hex</code> is the interesting one for &quot;direct flashing&quot; via CURA. Use this file with the process starting at Step 2 <a href="https://3dprinting.stackexchange.com/a/6655/8884">here</a> or use one of <a href="https://3dprinting.stackexchange.com/a/6656/8884">Greenonline's solutions</a> to get the firmware flashed - no bootloader needed!</p>

CC BY-SA 4.0
2018-08-13T21:00:01.393Z
2018-12-04T03:08:37.333Z
2020-06-18T08:29:41.667Z
Trish
<p>When homing the printer, the hot end carriage will be instructed to hit the (mechanical or optical) end stops. From this point a well configured firmware knows where to find the origin of the heat bed. </p>

<p>For the printer to know the origin of the bed, offsets are defined in the firmware from the end stop locations to the actual origin of the heat bed. </p>

<p>E.g. in Marlin Firmware this is defined by</p>

<pre><code> #define X_MIN_POS -35 ; move the head 35 mm to the right to place the 
                       ; nozzle at X = 0
 #define Y_MIN_POS -8  ; move the head 8 mm to the back (or the plate
                       ; forward) to place the nozzle at Y = 0
</code></pre>

<p>When you change the hardware (e.g. carriage), you need to re-calibrate the movement from the end stop location to the origin of the bed. Note that any arbitrary point on the heat bed can be used to re-calibrate this. E.g. the center of the bed can also be used, and is frequently much more easy to re-calibrate as the heated beds usually have rounded corners or are slightly larger than the actual print area (e.g. I have a 300 x 300 mm heat bed that actually measures 315 x 315 mm). Printing a large square on the heat bed will therefore give you a good impression of the offset of the nozzle due to your new carriage design. </p>

<p>Note that, if you cannot or will not flash new firmware, an alternative solution exists to set new incremental offset values using the <a href="https://reprap.org/wiki/G-code#M206:_Offset_axes" rel="noreferrer"><code>M206</code></a> command <strong>IF</strong> <a href="https://reprap.org/wiki/G-code#M206:_Offset_axes" rel="noreferrer">your current firmware supports</a> this.</p>

<p>A detailed description to re-calibrate is found in answer <a href="https://3dprinting.stackexchange.com/a/6376/5740">How to center my prints on the build platform?</a> or in external link <a href="https://www.thingiverse.com/thing:2280529" rel="noreferrer">Bed center calibration</a>.</p>

CC BY-SA 4.0
2018-08-12T11:25:51.647Z
Your answer skips over essential stepts, now that I actually am testing it: 1) how to get the firmware settings currently installed? 2) How to implement the changes via Repetier Host? 3) How to upload the modified Firmware?
Trish
CC BY-SA 4.0
2018-08-13T19:59:47.437Z
You could improve the answer massively by including 1) M503 to get the current Firmware settings. 2) indicating which files of a Firmware Configuration usually contain these commands and 3) mention that one usually uses an arduino as Bootloader to flash new firmware and link to a tutorial for this.
Trish
CC BY-SA 4.0
2018-08-13T21:39:33.480Z
@Trish Getting, changing and uploading is already described in another question, but very nice you have figured out to compile it on your board! Good to hear it   works out!
0scar
CC BY-SA 4.0
2018-08-13T21:42:20.870Z
just... had to pretty much reverse engineer parts of the ender3 XD
Trish
CC BY-SA 4.0
2020-03-10T08:15:13.133Z
oh god, I just realized how much I learned in the last 1.5 years about firmware... back then I was a noob, now I instruct on how to do this by pointing back to this question!
Trish
CC BY-SA 4.0
2020-03-10T08:25:26.657Z
@Trish Note that the Marlin source is still actively developed and changes are between the 1.1.9 and 2.0.x version. E.g. for sensor offset, in 2.0.x the offset is defined by `#define NOZZLE_TO_PROBE_OFFSET { XXX, YYY, ZZZ }` it is also more hard to get the individual values from the array, I've described this [here](/a/8154/).
0scar
CC BY-SA 4.0
2020-03-10T08:29:15.207Z
we might do a Step-By-Step guide to swapping firmware for the knowledgebase, using all the answers here and updating them for 2.x??
Trish
CC BY-SA 4.0
2018-07-15T14:16:15.513Z
2018-08-13T21:02:59.207Z
2018-08-13T21:02:59.207Z
0scar
<p><em>Following on from 0scar's answer</em></p>
<hr />
<p>To change or obtain your EEPROM settings you need to open Repetier Host (for Linux or Windows, v2.1.3 - the OSX version I tried, v1.1.0, didn't seem to have this functionality).</p>
<h3>To change existing settings</h3>
<p>From <a href="https://forum.repetier.com/discussion/4641/how-to-make-changes-to-the-eeprom-data" rel="nofollow noreferrer">How to make changes to the EEPROM data</a>. Apparently there is an EEPROM editor available (in Repetier Host). From <a href="https://forum.repetier.com/discussion/comment/18712/#Comment_18712" rel="nofollow noreferrer">this post</a>:</p>
<blockquote>
<p>If you see it in eeprom editor just change them. If it is repetier-firmware based it will store changes in eeprom on pressing &quot;ok&quot;.</p>
</blockquote>
<h3>To retrieve existing settings</h3>
<p><a href="https://forum.repetier.com/discussion/comment/2817/#Comment_2817" rel="nofollow noreferrer">This post</a> from <a href="https://forum.repetier.com/discussion/933/retrieval-of-existing-settings" rel="nofollow noreferrer">retrieval of existing settings...</a>, shows how:</p>
<blockquote>
<p>To copy eeprom data:</p>
<ul>
<li>Connect with host</li>
<li>Open eeprom settings</li>
<li>Select export eeprom settings. That saves all data in a epr file and you can later use import eepsom settings to rewrite it.</li>
</ul>
</blockquote>
<p>An example of the resulting file is shown in the question, <a href="https://3dprinting.stackexchange.com/questions/4184/help-with-repetier-firmware-variables-dimension-dual-delta-j-group-robotics">Help with Repetier firmware variables (Dimension Dual Delta - J Group Robotics)</a>, a sample of which I have included below:</p>
<pre><code>&lt;Repetier-Firmware-EEPROM&gt;
&lt;epr pos=&quot;1028&quot; type=&quot;0&quot; value=&quot;0&quot;&gt;Language&lt;/epr&gt;
&lt;epr pos=&quot;75&quot; type=&quot;2&quot; value=&quot;115200&quot;&gt;Baudrate&lt;/epr&gt;
&lt;epr pos=&quot;129&quot; type=&quot;3&quot; value=&quot;32.752&quot;&gt;Filament printed [m]&lt;/epr&gt;
&lt;epr pos=&quot;125&quot; type=&quot;2&quot; value=&quot;21644&quot;&gt;Printer active [s]&lt;/epr&gt;
&lt;epr pos=&quot;79&quot; type=&quot;2&quot; value=&quot;0&quot;&gt;Max. inactive time [ms,0=off]&lt;/epr&gt;
</code></pre>
<hr />
<p>However, you would appear to have to be running Repetier firmware for these two solutions to work, and not Marlin (but I may be wrong).</p>

CC BY-SA 4.0
2018-08-13T11:46:39.467Z
2018-08-13T15:09:01.080Z
2020-06-18T08:29:41.667Z
Greenonline
<p>I got myself the Ender 3. The Home position is about 1 mm left and 2 mm in front of the front left corner. Now, the hotend center axis is 11 mm from the carrier plate with the &quot;Mk 10&quot; cooler mounted right onto a pair of 5 mm pegs that are part of the plate. As I want to change to an e3D v6, which has a diameter of 22 mm, I will have to move out some distance (ca. 13 mm) to the current Z axis. This means, that any Y command will be off by this distance.</p>
<p><strong>How do I reconfigure the Home position to have an offset to the 0-positions gained from the limit switches?</strong></p>
<p>According to Repetier Host it runs on <strong>Marlin 1.0</strong>. Creality offers the firmware on <a href="https://www.creality3d.cn/download/firmware_c0001" rel="nofollow noreferrer">their website</a> as a <strong>.hex</strong> file - which is hard to edit.</p>

CC BY-SA 4.0
2018-07-14T21:31:10.630Z
Basically, you want to center the nozzle in the middle of the bed from what I understand from your question. When the nozzle is in the center all other dimensions are correct also. I have described how you do that in [How to center my prints on the build platform?](https://3dprinting.stackexchange.com/questions/6375/how-to-center-my-prints-on-the-build-platform). Solution 2 and 3 are firmware, not slicer solutions, and do exactly what you want. Once you have centered the nozzle in the middle of the plate, the nozzle will be at the origin (0,0), so the corner of the plate.
0scar
CC BY-SA 4.0
2022-09-19T19:35:10.727Z
The working origin/print bed origin at 0,0,0 does not necessarily need to be the homing switch location.  Industrial CNCs put the limit switches at the mechanical/safety limits of the system, and then calibrate the working coordinate  system to the work with "Offsets".  The offset in Z, X, Y between the home location and the bed coordinate system is configurable in Marlin with M206: https://marlinfw.org/docs/gcode/M206.html You can hard code some default offsets into the mMarlin source code and recompile the firmware, or use M206 and then write the offsets into EEPROM on your current firmware.
Dave X
<creality-ender-3><marlin><homing><knowledgebase>
Recalibrating Home-position
Trish
# Recalibrating Home-position

(Asked by: username_0 on 2018-07-14)

I got myself the Ender 3. The Home position is about 1 mm left and 2 mm in front of the front left corner. Now, the hotend center axis is 11 mm from the carrier plate with the "Mk 10" cooler mounted right onto a pair of 5 mm pegs that are part of the plate. As I want to change to an e3D v6, which has a diameter of 22 mm, I will have to move out some distance (ca. 13 mm) to the current Z axis. This means, that any Y command will be off by this distance.

**How do I reconfigure the Home position to have an offset to the 0-positions gained from the limit switches?**

According to Repetier Host it runs on **Marlin 1.0**. Creality offers the firmware on [their website](https://www.creality3d.cn/download/firmware_c0001) as a **.hex** file - which is hard to edit.

**Tags:** creality-ender-3, marlin, homing, knowledgebase
> **Comments:**
> **username_1**: Basically, you want to center the nozzle in the middle of the bed from what I understand from your question. When the nozzle is in the center all other dimensions are correct also. I have described how you do that in [How to center my prints on the build platform?](https://3dprinting.stackexchange.com/questions/6375/how-to-center-my-prints-on-the-build-platform). Solution 2 and 3 are firmware, not slicer solutions, and do exactly what you want. Once you have centered the nozzle in the middle of the plate, the nozzle will be at the origin (0,0), so the corner of the plate.  
> **username_2**: The working origin/print bed origin at 0,0,0 does not necessarily need to be the homing switch location.  Industrial CNCs put the limit switches at the mechanical/safety limits of the system, and then calibrate the working coordinate  system to the work with "Offsets".  The offset in Z, X, Y between the home location and the bed coordinate system is configurable in Marlin with M206: https://marlinfw.org/docs/gcode/M206.html You can hard code some default offsets into the mMarlin source code and recompile the firmware, or use M206 and then write the offsets into EEPROM on your current firmware.  

---

## 3 answers

### Answer by username_0 on 2018-08-13. Score: 4 | Accepted answer

Greenonline and I spent this evening hacking/reverse engineering the Ender3 to solve this. Greenonline also wrote about this in his blog.
Step 1 - Get the Firmware
To do this, there are basically two ways:

Find the a ready-to-use firmware
Make your own

Variant 1 would be to use the pre-supplied .hex files from Creality or some other manufacturer. Variant 2 means writing the settings yourself or using Repetier firmware to write the files for you. In the case of the Ender 3, the chip used sadly disqualified Repetier firmware, so writing it yourself is the only option.
To write the firmware yourself or using Repetier firmware, you need the old settings. To get these, connect the printer via USB, connect it with a software like Repetier host and send M503 to get all the settings.
Now, either hack those into Repetier firmware or use a blank Marlin.ino and the Arduino IDE to customise it. In the later case, you need to put the folder Marlin-?.?.X.ZIP/Marlin-?.?.X/Marlin into the Arduino folder in Documents (Windows) or Home (Mac). Now open the Marlin.ino in Arduino IDE. Set up the new firmware with these base settings or adjust as needed.
Step 2 - Adjust
Now that we have our Configuration files (in the end we pretty much skipped step 1 and grabbed a fitting (German!) one from Christian, a German maker also known as "Chaos-Drucker"), we need to first adjust them as needed to fit our needs and then compile them properly (next step!). As an alternative (English!) base to work with, the TH3D firmware is also available, provided by the Hooglands and team at TH3D.
So, let's open your Marlin.ino with arduino and find the X_MIN_POS (CTRL+F > X_MIN_POS > Search all sketches).
In the configurations we grabbed the sketch file Configuration.h contains lines 786-789 (might differ):
// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -10
#define Y_MIN_POS -15
#define Z_MIN_POS 0

Adjust these till the wanted position is achieved - Repetier Host can help here to determine the right position.
Step 3 - Compile
The hardest step with the Ender3 was to get the code to actually compile, as it uses an ATmega1284P 16Bit which isn't supported by Arduino natively. While the MightyCore supports this chip, it doesn't compile with this hardware library. However, Christian did figure out that the Sanguino set to an ATmega 1284P 16bit does work. These belong as extracted folders into the Arduino/hardware folder, usually in your Documents (if you use Windows) or Home (on mac). Now, we did set Tools>Board:> Sanguino and Tools>Processor:>ATmega1284 or ATmega1284P (16 MHz)
It was also mandatory to have the U8glib.h for Arduino installed. To do this, download the zip from github, then in the Arduino software Sketch>Include Library>Add .ZIP Library... and choose the whole zip repository to auto install.
With these settings we were able to compile the settings.
Step 4 - Getting it on the machine
Most people would expect to read about bootloaders and flashing now, and indeed that is an option. But as I had just figured out how to install firmware from .hex and so I wondered: Can't we make .hex files from our settings? And yes, Arduino supports this.
So, in Arduino IDE press Ctrl+Alt+S (or Sketch > Export Compiled Binary). This will result in two files:

Marlin.ino.sanguino.hex
Marlin.ino.with_bootloader.sanguino.hex

Of these two, the Marlin.ino.sanguino.hex is the interesting one for "direct flashing" via CURA. Use this file with the process starting at Step 2 here or use one of Greenonline's solutions to get the firmware flashed - no bootloader needed!


---

### Answer by username_1 on 2018-07-15. Score: 10

When homing the printer, the hot end carriage will be instructed to hit the (mechanical or optical) end stops. From this point a well configured firmware knows where to find the origin of the heat bed. 
For the printer to know the origin of the bed, offsets are defined in the firmware from the end stop locations to the actual origin of the heat bed. 
E.g. in Marlin Firmware this is defined by
 #define X_MIN_POS -35 ; move the head 35 mm to the right to place the 
                       ; nozzle at X = 0
 #define Y_MIN_POS -8  ; move the head 8 mm to the back (or the plate
                       ; forward) to place the nozzle at Y = 0

When you change the hardware (e.g. carriage), you need to re-calibrate the movement from the end stop location to the origin of the bed. Note that any arbitrary point on the heat bed can be used to re-calibrate this. E.g. the center of the bed can also be used, and is frequently much more easy to re-calibrate as the heated beds usually have rounded corners or are slightly larger than the actual print area (e.g. I have a 300 x 300 mm heat bed that actually measures 315 x 315 mm). Printing a large square on the heat bed will therefore give you a good impression of the offset of the nozzle due to your new carriage design. 
Note that, if you cannot or will not flash new firmware, an alternative solution exists to set new incremental offset values using the M206 command IF your current firmware supports this.
A detailed description to re-calibrate is found in answer How to center my prints on the build platform? or in external link Bed center calibration.

> **Comments:**
> **username_0**: Your answer skips over essential stepts, now that I actually am testing it: 1) how to get the firmware settings currently installed? 2) How to implement the changes via Repetier Host? 3) How to upload the modified Firmware?  
> **username_0**: You could improve the answer massively by including 1) M503 to get the current Firmware settings. 2) indicating which files of a Firmware Configuration usually contain these commands and 3) mention that one usually uses an arduino as Bootloader to flash new firmware and link to a tutorial for this.  
> **username_1**: @Trish Getting, changing and uploading is already described in another question, but very nice you have figured out to compile it on your board! Good to hear it   works out!  
> **username_0**: just... had to pretty much reverse engineer parts of the ender3 XD  
> **username_0**: oh god, I just realized how much I learned in the last 1.5 years about firmware... back then I was a noob, now I instruct on how to do this by pointing back to this question!  
> **username_1**: @Trish Note that the Marlin source is still actively developed and changes are between the 1.1.9 and 2.0.x version. E.g. for sensor offset, in 2.0.x the offset is defined by `#define NOZZLE_TO_PROBE_OFFSET { XXX, YYY, ZZZ }` it is also more hard to get the individual values from the array, I've described this [here](/a/8154/).  
> **username_0**: we might do a Step-By-Step guide to swapping firmware for the knowledgebase, using all the answers here and updating them for 2.x??  

---

### Answer by username_3 on 2018-08-13. Score: 4

Following on from 0scar's answer

To change or obtain your EEPROM settings you need to open Repetier Host (for Linux or Windows, v2.1.3 - the OSX version I tried, v1.1.0, didn't seem to have this functionality).
To change existing settings
From How to make changes to the EEPROM data. Apparently there is an EEPROM editor available (in Repetier Host). From this post:

If you see it in eeprom editor just change them. If it is repetier-firmware based it will store changes in eeprom on pressing "ok".

To retrieve existing settings
This post from retrieval of existing settings..., shows how:

To copy eeprom data:

Connect with host
Open eeprom settings
Select export eeprom settings. That saves all data in a epr file and you can later use import eepsom settings to rewrite it.


An example of the resulting file is shown in the question, Help with Repetier firmware variables (Dimension Dual Delta - J Group Robotics), a sample of which I have included below:

Language
Baudrate
Filament printed [m]
Printer active [s]
Max. inactive time [ms,0=off]


However, you would appear to have to be running Repetier firmware for these two solutions to work, and not Marlin (but I may be wrong).


---

