Ender 5 mit BL Touch Sensor und Marlin – Meine Kopierpaste

Was zum Flashen benötigt wird

in der Arduino SW:

Das Board „Sanguino“ – das ist das Zielboard des Ender 5. Chip: ATMEGA1284p 16Mhz. Hier findet man das Boardfile für Arduino: https://github.com/Lauszus/Sanguino

Wenn der Ender 5 einmal den „Bootloader gebrannt“ bekommen hat kann über den direkten Mini USB Anschluss am Drucker neue SW aufgespielt werden – über das Marlin.ino Arduino Projekt (https://marlinfw.org/meta/download/)

Um das zu bewerkstelligen kann man einen Arduino Nano als ISP benutzen.

Arduino als ISP

Ein Arduino kann recht einfach auch als ISP-Programmer für andere Mikrocontroller verwendet werden. Dabei kommt die serielle SPI-Schnittstelle zum Einsatz.

Mit Hilfe eines ISP-Programmers ist es möglich, diverse Mikrocontrollertypen zu programmieren. ISP steht dabei für In-System-Programming, was so viel bedeutet, wie dass der Controller direkt im Einsatzsystem programmiert werden kann.

Im folgenden Beispiel verwende ich einen Arduino Nano zum Programmieren eines ATtiny85 Controllers. Es können natürlich auch andere Arduinos und andere Mikrocontroller (z.B. ATMega8, ATMega328, ATMega64, etc.) verwendet werden.

Arduino vorbereiten

Damit der Arduino als ISP-Programmer eingesetzt werden kann, muss dieser erst selbst entsprechend programmiert werden.

Hierfür ist in der Arduino IDE bereits das Beispiel “ArduinoISP” enthalten, welches lediglich geöffnet und über USB auf den Arduino geladen werden muss.

Verkabelung zum Ziel-Mikrocontroller

Die Verkabelung zum Ziel-Mikrocontroller erfolgt nach dem folgenden Muster.

Arduino PinISP-FunktionFarbe im Beispiel

Der Kondensator dient als Puffer für den Reset des Arduinos selbst, da der Arduino sonst beim Programmieren des Ziel-Mikrocontrollers oftmals resettet wird und damit das Programmieren fehlschlägt. Ich habe hier einen 22µF Elko verwendet, da dieser mir als erstes in die Hände fiel. Andere Kondensatoren in dieser Größenordnung sollen den gleichen Effekt haben.

Der Widerstand dient als Pull-Up für den Reset des Ziel-Mikrocontrollers.

Programmieren des Ziel-Mikrocontrollers

Arduino IDE

In der Arduino IDE muss über das Menü Werkzeuge -> Programmer -> Arduino as ISP ausgewählt werden.

Dann kann der Sketch entweder durch klicken des Hochladen-Buttons bei gedrückter Umschalttaste, oder über das Menü Sketch -> Hochladen mit Programmer auf den Ziel-Mikrocontroller geladen werden.


Bei Verwendung von avrdude über die Kommandozeile sind die folgenden Parameter anzugeben:

  • Programmer: -c arduino oder -c stk500v1
  • Port: -P /dev/ttyUSB0
  • Baud: -b 19200

Zum Lesen der Fuse-Bits des ATtiny85 würde der komplette avrdude-Befehl dann so aussehen:

avrdude -p t85 -c arduino -P /dev/ttyUSB0 -b 19200 -v -E noreset -F -U lfuse:r:-:i -U hfuse:r:-:i

A simple guide (and note to self) to configuring Marlin 2.0 for the Ender 3/Pro with BLTouch ABL sensor

The Template

Firstly, you’ll need the Marlin firmware with the appropriate template settings.

  1. Start by downloading the latest stable release of Marlin from here.
  2. Extract the zip.
  3. Copy the 4 files from config/examples/Creality/Ender-3 to the Marlin/ folder, overwriting the 2 already there.


Open the new Marlin/Configuration.h file using a text editor suitable for code, like Sublime Text or Notepad++. We’ll customise our configuration now:

  1. Change STRING_CONFIG_H_AUTHOR to clearly differentiate the configuration from the default
  2. Disable SHOW_BOOTSCREEN and SHOW_CUSTOM_BOOTSCREEN to save space by commenting out the lines (prefix them with //  )
  3. Ensure you have the correct BAUDRATE. The original Ender 3 was configured to 115200 by Creality, but the newer Ender 3 Pro (and newer Creality motherboards) default to 250000. You may be fine with 250000 on an older Ender 3.
  4. Change CUSTOM_MACHINE_NAME to represent your printer, e.g. "Ender 3 Pro"
  5. If you’re using a BLTouch ABL sensor:
    1. Uncomment #define BLTOUCH
    2. #define SERVO0_PIN 27 is not required to set up your BLTouch in Marlin 2.x, as it’s defined in the pins folder by default
    3. You’ll need to customise the offset between Probe and Extruder. In Marlin 1.x, this was done with X, Y and Z_PROBE_OFFSET_FROM_EXTRUDER. In Marlin 2.x, they’re now combined in NOZZLE_TO_PROBE_OFFSET. Instructions are in the comments. Using the Creality BLTouch Kit bracket, mine is { -43, -9, 0 }. It’s safer to leave Z as 0 here are calibrate this yourself later.
    4. To keep the probe away from the edge of the bed, increase MIN_PROBE_EDGE to 20
    5. You can increase XY_PROBE_SPEED to 10000 to speed up probing slightly
    6. Uncomment #define AUTO_BED_LEVELING_BILINEAR to enable bilinear ABL
    7. By default, bilinear ABL uses a 3×3 grid. You can change this by editing GRID_MAX_POINTS_X under EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR). Mine is set to 5, for a 5×5 grid
    8. Uncomment #define LCD_BED_LEVELING to add bed levelling menu items
  6. If your bed is non-standard, you’ll need to adjust the size and/or travel limits to make sure Marlin knows this. I use bulldog clips to secure a glass bed. To ensure the nozzle stays clear of the clips, I’ve changed the following: Y_BED_SIZE from 235 to 199, X_MIN_POS from 0 to -2, Y_MIN_POS from 0 to -24.
  7. Uncomment Z_SAFE_HOMING. This prevents your Z homing from occuring without prior X and Y homing. Without this, you may accidentally miss the bed when homing Z.
  8. To increase the homing speed, increase HOMING_FEEDRATE_XY from (20*60) to (40*60) and HOMING_FEEDRATE_Z from (4*60) to (8*60).
  9. If you want to use PID to efficiently heat your bed, uncomment #define PIDTEMPBED. You’ll need to calibrate this later.
  10. If you’re using a „silent“ Creality board v1.1.4 or v1.1.5, you’re using TMC2208 drivers in standalone mode. Uncomment X, Y, Z and E0_DRIVER_TYPE and set them to TMC2208_STANDALONE.
  11. To save space, uncomment #define SLIM_LCD_MENUS. This will remove many menu items that you won’t need if controlling using a PC or OctoPrint.
  12. To save space, comment out #define SPEAKER. This will stop fully disable the speaker.
  13. To save space if you won’t be printing from SD card, comment out #define SDSUPPORT.
  14. Save the file and close the file.


Open the new Marlin/Configuration_adv.h file in your chosen text editor.

  1. If you’re using a BLTouch:
    1. Uncomment #define BLTOUCH_DELAY and change from 500 to 200. This reduces the pause after each individual probe.
    2. Babystepping allows the nozzle to move a tiny amount without changing the recorded coordinates for the hotend. This is usually used for calibrating your Z Offset for a perfect first layer. You can increase BABYSTEP_MULTIPLICATOR_Z and _XY to 10 for faster motion.
  2. If you want to use Linear Advance to increase your print quality at higher speeds, uncomment #define LIN_ADVANCE and set LIN_ADVANCE_K from 0.22 to 0, which will enable the feature but turn it off. Your GCODE will need to specify the K value, which you’ll calibrate later. You need different K values for different filament types. Note that LinearsAdvance is not compatible with the TMC2208 stepper driver in Standalone mode (using StealthChop), so will not worth with Creality „silent“ boards v1.1.4 and v1.1.5.
  3. To save space, comment out #define ARC_SUPPORT. This feature is used by other types of CNC machines, but usually not 3D printers.
  4. If you want to display progress and time remaining from another system with the M73 command, such as OctoPrint, uncomment LCD_SET_PROGRESS_MANUALLY. If your system will also send the M73 R parameter to update the time remaining, uncomment USE_M73_REMAINING_TIME.
  5. Marlin watches the rate of temperature increase for hotend and bed. If it’s too slow, it will trigger an error and halt your print. If you have the windows open for ventilation and it’s cold out, this can be a problem. Increase WATCH_BED_TEMP_PERIOD a little if you have this issue.
  6. Save your changes and close the file.

To The Printer!

Take a copy of your `M503` output to save your current printer settings. You’ll need to put some of these back later.

Open Marlin/Marlin.ino with the Arduino IDE and write the new firmware to your printer.

Run M502 to set all settings to those specified in your firmware files, then M500 to store these settings in the EEPROM.

Depending on your configuration, you’ll now want to calibrate your Z-Probe Offset, PID for

Wie Speicher gespart werden kann

Marlin 2.0 program memory usage by feature on AVR 8Bit boards

Work in progress ~ This page is currently being updated frequently. Please submit feedback and ideas to @danielcrosslink on Twitter or leave a comment below. Highly appreciated.

This is a list of optional features or candidates to enable/disable to free up memory in Marlin 2.0 for 8Bit AVR boards. Sometimes each byte can make a difference whether you may be able to build the firmware or not.

Each line shows how much memory is needed to compile the feature. Actual byte sizes may change with newer versions of Marlin or newer compilers so take them as approximations.

Current investigations show that the minimum size of Marlin 2.0 on an 8Bit AVR like on the Ender 3 (ATMega1284p based CPU) is around 119408 bytes from 130048 bytes of maximum available space (if you keep SDSUPPORT enabled). This is true if the optiboot bootloader is installed. So you will normally have 11000 bytes for additional features (see detailed list below).

You may use up to 131072 bytes of program memory (resulting in 12024 bytes for additional features) if you don’t use a bootloader but upload your firmware using a programmer device like the TinyUSBISP or the USPASP directly. Also an Arduino UNO used as an ISP programmer will do the same.

So choose wisely, which features you like to enable – or switch to a processor/architecture that offers more available program memory (more references to alternatives to be added soon).

Sample Calculation

Let’s assume you like to enable MESH_BED_LEVELING with LCD_BED_LEVELING and RESTORE_LEVELING_AFTER_G28 on the Ender 3 for manual mesh bed leveling:

Ender 3 Initial firmware size (default config)124398
Available program memory5650
MESH_BED_LEVELING required memory7738
LCD_BED_LEVELING required memory1652
RESTORE_LEVELING_AFTER_G28 required memory16
Sum of required additional memory3756
Reclaimed memory from disabling ARC_SUPPORT
(in Configuration_adv.h)
Reclaimed memory from disabling SHOW_CUSTOM_BOOTSCREEN (in Configuration.h)764
Final memory usage129632


Compiling Marlin 2.0 firmware for 8Bit mainboards with only 128KB program memory can be a challenging task especially if you like all the good features of Marlin to be available. Especially if you like to use auto bed leveling probes, you will have to compromise on using other features like the SD-Card support.

You can work around missing SD-Card support for example by using Octoprint on a Raspberry PI connected to your printer via USB. This also has some advantages like being able to pimp your printer with even more exciting features like a Filament runout sensor and a camera to record timelapses.

All in all, the amount of memory used by Marlin 2.0 has increased between 1.1.9 and 2.0. We have another Anet A8 with BLTouch sensor, Auto bed leveling and a full graphical display running version 1.1.9 of Marlin and still have SD-Card support enabled. This is not possible anymore with version 2.0, so we would have to compromise on the SD-Card support when upgrading to version 2.0.




List of features in Configuration_adv.h and their memory consumption if ENABLED. Plus sign (+) means, enabling the feature takes MORE memory. Minus () means, enabling this feature REDUCES memory usage.

Line #Feature nameSize compiled
1068SCROLL_LONG_FILENAMES+ 202Disable if you can live with long filenames not scrolling on the display
1415LIN_ADVANCE+ 3262Use for better corner quality, needs calibration (see Marlin docs for more infos on Linear Advance).
1491ARC_SUPPORT+ 3410Not used by most slicers, disable to save memory
1688SLIM_LCD_MENUS– 5552Enable to slim the LCD menus to save memory
2766NO_VOLUMETRICS– 612Enable if you do not intent to use volumetric extrusion features

List of feature switches in Configuration.h and their memory consumption if ENABLED. Plus sign (+) means, enabling the feature takes MORE memory. Minus () means, enabling this feature REDUCES memory usage.

Line #Feature nameSize compiled
74STRING_CONFIG_H_AUTHOR+ 112Can be disabled
89SHOW_BOOTSCREEN+ 630Can be disabled
92SHOW_CUSTOM_BOOTSCREEN+ 764Can be disabled
1177AUTO_BED_LEVELING_BILINEAR with FIX_MOUNTED_PROBE (Capacitive, Inductive probes…)+ 14408The only way to enable this seems by disabling SDSUPPORT
1177AUTO_BED_LEVELING_BILINEAR with BLTOUCH sensor+ 15758The only way to enable this seems by disabling SDSUPPORT
1180MESH_BED_LEVELING+ 7738Enable for manual mesh bed leveling feature, LCD_BED_LEVELING is another optional feature if you want LCD menu for setup
1186RESTORE_LEVELING_AFTER_G28+ 16Convenience feature, otherwise use M420 S1 after G28 to restore mesh before print (see Marlin docs for more Infos on M420 command).
1284LCD_BED_LEVELING+ 1652Convenience for mesh bed leveling with the LCD screen. Use G29 commands otherwise. (see Marlin docs for G29)
1292LEVEL_BED_CORNERS+ 636Useful if you like to keep manual bed leveling but do it without moving the nozzle to the corners manually.
1632SDSUPPORT+ 17492If you don’t need to print from SD card, disable. You can use Pronterface, Octoprint or other software to print over USB.
1720SPEAKER0 bytes ?Size may depend on display choice. Investigation needed.

Cura Einstellungen

Im Slicer sollte bei den Druckereinstellungen zum START GCODE folgendes hinzugefügt werden. Anstatt

G28 ;Home

sollte hier

G28 ;Home
M190 S65 ;set bed temperature to 65 and wait for it if it is heating

stehen. Der zusätzliche M190 Befehl triggert die Einstellung einer Betttemperatur von 65°C um bei der anschließenden Bett Nivelierung (Bed Leveling) via G29 die Wärmeausdehnung zu berücksichtigen.

OctoPrint Headless auf einem Ubuntu 20.04 desktop laufen lassen

-> https://makenotes.de/2020/03/octoprint-on-ubuntu-using-python3-and-systemd/ TOP!

Bed Leveling einstellen über GCODE

Falls Ihr euch schon gefragt habt ob man jedesmal beim Auto-Leveling Sensor an den Drucker muss um dann erst im Menü rumfuchtelt bis man dann endlich den Z-Offset einstellen kann.. Nö muss nicht sein. Hier ein Kleines Tutorial !

  • Startet euren Drucker
  • Heizt Hotbed und Hotend auf tatsächliche Drucktemperatur
  • Entfernt jeglichen Dreck vom Hotbed und Hotend !
  • Sendet einen G-Code Befehl per Cura, S3D, Octoprint etc. an den Drucker -> “G28” für ein Home ALL
  • Nach “Home All” legt ihr ein Stück Papier unter die Noozle und geht per Interface solange in -0.1 oder -1.0 Schritten runter bis das Papier an der Noozle kratzt.
  • Notiert jetzt den Wert am Drucker der bei “Z” steht. z.B. -1.66
  • Jetzt den G-Code Befehl “M851” benutzen um die Eprom werte auszulesen, dort ist eine Zeile der mit “M851” anfängt. z.B. M851 Z-0.10
  • Rechnet EUREN “Z” Wert mit dem M851 Wert zusammen ! z.B. -1.66 + -0.10 = -1.76
  • Sendet nun den neuen Wert per G-Code Befehl an das Board “M851 Z-1.76
  • Sichert das ganze per G-Code Befehl “M500” in den Eprom !
  • Sendet nochmal den G-Code Befehl “G28” und legt danach ein Papier darunter und geht nochmals solange mit -0.1 oder -1.0 runter bis an eurem Drucker Z0 steht. Wenn
  • jetzt das Papier so ist wie ihr es haben wolltet ist alles eingestellt !

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.