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 Pin | ISP-Funktion | Farbe im Beispiel |
---|---|---|
D13 | SCK | gelb |
D12 | MISO | grün |
D11 | MOSI | orange |
D10 | RESET | weiß |
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.
avrdude
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
The Template
Firstly, you’ll need the Marlin firmware with the appropriate template settings.
- Start by downloading the latest stable release of Marlin from here.
- Extract the zip.
- Copy the 4 files from
config/examples/Creality/Ender-3
to theMarlin/
folder, overwriting the 2 already there.
Configuration.h
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:
- Change
STRING_CONFIG_H_AUTHOR
to clearly differentiate the configuration from the default - Disable
SHOW_BOOTSCREEN
andSHOW_CUSTOM_BOOTSCREEN
to save space by commenting out the lines (prefix them with//
) - 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. - Change
CUSTOM_MACHINE_NAME
to represent your printer, e.g."Ender 3 Pro"
- If you’re using a BLTouch ABL sensor:
- Uncomment
#define BLTOUCH
#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- You’ll need to customise the offset between Probe and Extruder. In Marlin 1.x, this was done with
X
,Y
andZ_PROBE_OFFSET_FROM_EXTRUDER
. In Marlin 2.x, they’re now combined inNOZZLE_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. - To keep the probe away from the edge of the bed, increase
MIN_PROBE_EDGE
to 20 - You can increase
XY_PROBE_SPEED
to 10000 to speed up probing slightly - Uncomment
#define AUTO_BED_LEVELING_BILINEAR
to enable bilinear ABL - By default, bilinear ABL uses a 3×3 grid. You can change this by editing
GRID_MAX_POINTS_X
underEITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
. Mine is set to 5, for a 5×5 grid - Uncomment
#define LCD_BED_LEVELING
to add bed levelling menu items
- Uncomment
- 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. - 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. - To increase the homing speed, increase
HOMING_FEEDRATE_XY
from (20*60) to (40*60) andHOMING_FEEDRATE_Z
from (4*60) to (8*60). - If you want to use PID to efficiently heat your bed, uncomment
#define PIDTEMPBED
. You’ll need to calibrate this later. - 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
andE0_DRIVER_TYPE
and set them toTMC2208_STANDALONE
. - 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. - To save space, comment out
#define SPEAKER
. This will stop fully disable the speaker. - To save space if you won’t be printing from SD card, comment out
#define SDSUPPORT
. - Save the file and close the file.
Configuration_adv.h
Open the new Marlin/Configuration_adv.h
file in your chosen text editor.
- If you’re using a BLTouch:
- Uncomment
#define BLTOUCH_DELAY
and change from 500 to 200. This reduces the pause after each individual probe. - 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. - Uncomment
BABYSTEP_ZPROBE_OFFSET
and#define BABYSTEP_ZPROBE_GFX_OVERLAY
- Uncomment
- If you want to use Linear Advance to increase your print quality at higher speeds, uncomment
#define LIN_ADVANCE
and setLIN_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. - To save space, comment out
#define ARC_SUPPORT
. This feature is used by other types of CNC machines, but usually not 3D printers. - If you want to display progress and time remaining from another system with the
M73
command, such as OctoPrint, uncommentLCD_SET_PROGRESS_MANUALLY
. If your system will also send theM73 R
parameter to update the time remaining, uncommentUSE_M73_REMAINING_TIME
. - 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. - 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:
Bytes | |
---|---|
Ender 3 Initial firmware size (default config) | 124398 |
Available program memory | 5650 |
MESH_BED_LEVELING required memory | 7738 |
LCD_BED_LEVELING required memory | 1652 |
RESTORE_LEVELING_AFTER_G28 required memory | 16 |
Sum of required additional memory | 3756 |
Reclaimed memory from disabling ARC_SUPPORT (in Configuration_adv.h) | 3410 |
Reclaimed memory from disabling SHOW_CUSTOM_BOOTSCREEN (in Configuration.h) | 764 |
Final memory usage | 129632 (99.7%) |
Conclusion
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.
FAQ
TODO
Appendix
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 name | Size compiled (Bytes) | Comment |
---|---|---|---|
1011 | POWER_LOSS_RECOVERY | + 3010 | Needs SDSUPPORT feature |
1068 | SCROLL_LONG_FILENAMES | + 202 | Disable if you can live with long filenames not scrolling on the display |
1415 | LIN_ADVANCE | + 3262 | Use for better corner quality, needs calibration (see Marlin docs for more infos on Linear Advance). |
1491 | ARC_SUPPORT | + 3410 | Not used by most slicers, disable to save memory |
1688 | SLIM_LCD_MENUS | – 5552 | Enable to slim the LCD menus to save memory |
2766 | NO_VOLUMETRICS | – 612 | Enable 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 name | Size compiled (Bytes) | Comment |
---|---|---|---|
74 | STRING_CONFIG_H_AUTHOR | + 112 | Can be disabled |
89 | SHOW_BOOTSCREEN | + 630 | Can be disabled |
92 | SHOW_CUSTOM_BOOTSCREEN | + 764 | Can be disabled |
95 | CUSTOM_STATUS_SCREEN_IMAGE | + 87 | Can be disabled |
1177 | AUTO_BED_LEVELING_BILINEAR with FIX_MOUNTED_PROBE (Capacitive, Inductive probes…) | + 14408 | The only way to enable this seems by disabling SDSUPPORT |
1177 | AUTO_BED_LEVELING_BILINEAR with BLTOUCH sensor | + 15758 | The only way to enable this seems by disabling SDSUPPORT |
1180 | MESH_BED_LEVELING | + 7738 | Enable for manual mesh bed leveling feature, LCD_BED_LEVELING is another optional feature if you want LCD menu for setup |
1186 | RESTORE_LEVELING_AFTER_G28 | + 16 | Convenience feature, otherwise use M420 S1 after G28 to restore mesh before print (see Marlin docs for more Infos on M420 command). |
1284 | LCD_BED_LEVELING | + 1652 | Convenience for mesh bed leveling with the LCD screen. Use G29 commands otherwise. (see Marlin docs for G29) |
1292 | LEVEL_BED_CORNERS | + 636 | Useful if you like to keep manual bed leveling but do it without moving the nozzle to the corners manually. |
1632 | SDSUPPORT | + 17492 | If you don’t need to print from SD card, disable. You can use Pronterface, Octoprint or other software to print over USB. |
1720 | SPEAKER | 0 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
G29
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 !