Today I am going to talk about Marlin 2.0 firmware and how to properly configure it for your printer. We will start with some basic knowledge about our hardware, and, after that, I will explain in full details what we need to change in the stock firmware to match our printer configuration. I will also introduce some features that you can find in Marlin 2.0 which are very handy.
- 1 Why should you change your firmware to Marlin?
- 2 What is Marlin 2.0 firmware?
- 3 Marlin configuration prerequisites
- 4 Marlin firmware settings
- 5 Define extruder direction
- 5.1 Define correct Z steps for the leadscrew
- 5.2 Select the correct drivers
- 5.3 Define the bed dimensions
- 5.4 Maintain the knob controller behavior
- 5.5 Set the correct display for Tarantula Pro Marlin
- 5.6 Define correct pins for display Marlin
- 6 Marlin Configuration_adv.h
- 7 Flash marlin on the board
- 8 Test new Marlin Configuration
- 9 Marlin 2.0 handy features
Why should you change your firmware to Marlin?
If you have a Tevo Tarantula Pro, most probably you already have Marlin 1.9, which is good! But I don’t personally like how it was customized. It lacks some basics features as:
- Filament change – Filament change g-code doesn’t work on the standard Tevo firmware for some strange reason.
- Nozzle auto park – When pausing a print, the nozzle remains above the printed part and finally damaging it.
- Lacks some menu voices – There are lots of features unavailable on the standard firmware.
and many more…
Other than those reasons, customizing your firmware makes you learn many things about your machine, and, in this way, you can always swap hardware without any configuration issues. And Marlin firmware is in constant evolution so, you will always have the latest version if you want.
What is Marlin 2.0 firmware?
Marlin is an open-source project born in the early days of the RepRap project, it gained popularity fast, but also its implementation increased rapidly with time. Now it’s used in most 3D commercial printers and, there is a reason behind this.
There are lots of people working on this firmware, which means that certainly, you will find a version for any printer or at least a very similar one.
- Full-featured G-code with over 150 commands.
- Marlin has some g-code support which is useful to tune, test, and run your printer.
- Support for Cartesian, Delta, SCARA, and Core/H-Bot kinematics.
- Marlin works on almost every type of printer and not only, but it supports CNC cutters as well!
- LCD Controller UI with more than 30 language translations.
This feature is underestimated, supporting as many languages as possible, not everybody knows English that well, so for a beginner, having their printer in their native language is important to understand some 3D printing expressions.
- Bed Leveling Compensation — with or without a bed probe.
Marlin has some features which help a lot with bed leveling, especially with warped beds, as you can set the z offset in 9 points meaning you can level a warped bed.
- Support for Filament Runout/Width Sensors
This is one of the new features that we can find on most recent 3D printers. This functionality is very handy to avoid failed prints.
Sources: Marlin Project
Marlin configuration prerequisites
I hope that you are fully convinced now that using the latest version of Marlin has some benefits, now let’s go through the prerequisites :
The first thing we need to know is some hardware information such as:
- Motherboard model: – the motherboard model is our very starting point, based on the manufacturer and model some pins may change, so knowing precisely what are you using is mandatory! Usually, it is written above so it’s not hard to tell what motherboard you use.
- Know your power setup: – it’s very important to know if you use a 12V system or a 24V system.
- Driver model and number: you need to know what drivers are you using to correctly configure them. Driver configuration is important as it manages all the moves that the printer makes.
- Know any additional upgrade or hardware change: There are some other things you can configure in Marlin such as the hotend thermistor, leveling probe, and much other stuff. I will go through these configurations so you will have them correctly set up.
After we learn more about the hardware configuration we will need some software to edit the firmware files, compile our project, and then flash it on the mainboard. For this purpose, I will use ArduinoIde which does all these 3 tasks and manages very easily all the work we need to do!
So go to the official website and download the latest stable version of ArduinoIde.
And the last thing we need is Marlin firmware! I will use a simplified version called EasyConfig by Jim Brown. This version of marlin is much easier to use and already works great for the original Tarantula, so this means that half of the works is already done. Also, this version is constantly maintained and integrates the new feature of the original Marlin firmware.
You can download the EasyConfig project right here on GitHub.
For those who know some version control, I strongly advise cloning the project to your computer so you can update it easily afterward.
After you installed ArduinoIde you just need to extract the Zip file containing Marlin (MarlinTarantula-EasyConfig-2.0.x) and open the /Marlin folder, where you will find Configuration.h and Configuration_Adv.h.These will be the main 2 files we are going to edit today. If you have Windows just click on the Configuration.h file and it will open the project, instead, if you have a mac OS X just open Marlin.ino.
Once we have our project opened we need to set some basic settings for the compiler(ArduinoIde) to make it work properly for our board
To do that go to ArduinoIde->Tools
we will need to change:
“Arduino Mega or Mega 2560”
For this you will need to plug-in the printer to your computer, after doing this you will see a new voice appearing in the port menu. This will be your default port, and you will need to use only this one.
Next, we will need to install an external library that will compile our display settings.Go to ArduinoIde menu ->Sketch->Include Library->Manage libraries and search for U8g2
Download this library and add it to the project by doing ->Sketch->Include Library->U8g2
This is fundamental, without this library we can’t compile our firmware
And for this step, we are done, but before we start editing anything, try hitting the compile button to see if everything works. If it’s fine and should be, then we can proceed!
Marlin firmware settings
I strongly advise you to use the search function inside ArduinoIde to make this task easier.
Just search for the line of code that I will paste under each section.
We will start with Configuration h. and will slowly go through each important line of code.
Marlin printer name
#define PRINTER_NAME "TEVO Tarantula (EasyConfig)"
This line of code defines the standard printer name(it will appear when the printer is idle on the bottom of the screen as “printer-name” is ready!)
Change the value between the ” ” quotes.
#define PRINTER_NAME "3DprintGuides"
Marlin change X direction
This defines the direction of the X-axis for homing, the Tarantula Pro homes in the opposite direction so we need to invert the direction. To do so you need to uncomment this line of code.
We will do this by deleting the // in front of the line
You will notice that this line will change the appearance when uncommented.
Define the correct motherboard
#define MOTHERBOARD BOARD_MKS_GEN_13
This is rather important because it will determine where all the pins are and other important stuff. If you don’t know what mainboard you have, I recommend taking a look as it should be written on top, and, it’s pretty visible.
If you have the Stock Tevo Tarantula Pro, then most probably, you will have an MKS Gen L V1.0.
To change this setting, we will need to comment on this line of code and uncomment the one with your correct board type.
//#define MOTHERBOARD BOARD_MKS_GEN_13 #define MOTHERBOARD BOARD_MKS_GEN_L
#define E0_STEPS 100
I guess you all know what are Esteps, for those who do not know those are the steps the motor does to correctly extrude the right amount of plastic.
The 100 value will not work for sure, and after some testing and calibrations, I’ve found out that a value of 467.9 works great for me. Start with this value and try to do an E-steps calibration to have a more precise value.
#define E0_STEPS 467.90
Define extruder direction
This needs to be uncommented to change the extruder motor direction because the default direction will simply eject your filament
Define correct Z steps for the leadscrew
#define Z_STEPS 1600 // Stock lead screw
The stock leadscrew has a much lower pitch than the ones used on the Tarantula Pro model, after some testing and calibrations I’ve found that the correct value for me is 399.3. Start with this number and after that calibrate the Z-axis by printing a calibration cube and doing the correct math!
#define Z_STEPS 399.3
Select the correct drivers
//#define X_DRIVER_TYPE A4988 //#define Y_DRIVER_TYPE A4988 //#define Z_DRIVER_TYPE A4988
You will see that all the lines of code in this section are commented, this way the firmware knows that you have the stock drivers. Don’t uncomment this section if you have the stock drivers.
If you have replaced the drivers with better ones, uncomment the code that has the upgraded axis.Above you will see all the default values of the most common stepper drivers. In my case, I’ve put some TMC2208 on my X Y, and Z-axis so my code would look like this:
#define X_DRIVER_TYPE TMC2208_STANDALONE #define Y_DRIVER_TYPE TMC2208_STANDALONE #define Z_DRIVER_TYPE TMC2208_STANDALONE
If you don’t have your drivers working in UART(external cables) then you have to select the _STANDALONE version inside the code.
Define the bed dimensions
// The size of the print bed #define X_BED_SIZE 200 #if ENABLED(LARGE_BED) #define Y_BED_SIZE 280 #else #define Y_BED_SIZE 200 #endif
The real dimensions of the Tarantula Pro bed is 240 X 240 mm ,but i don’t want to push it to the limits so I used 238 to have 1mm on both sides
We will define the X_BED_SIZE with the value 238
For the Y_BED_SIZE we know that LARGE_BED is not enabled(there was an option for it at the beggining of the file.)
After the #else statement we will define the Y_BED_SIZE to 238
// The size of the print bed #define X_BED_SIZE 238 #if ENABLED(LARGE_BED) #define Y_BED_SIZE 280 #else #define Y_BED_SIZE 238 #endif
Maintain the knob controller behavior
//#define REVERSE_SELECT_DIRECTION //#define REVERSE_MENU_DIRECTION
This will maintain the actual behavior of the knob, but if you preferred it inversed don’t uncomment this line.
#define REVERSE_MENU_DIRECTION #define REVERSE_SELECT_DIRECTION
Set the correct display for Tarantula Pro Marlin
This step is a little bit complicated but not hard at all!
#if DISABLED(FULL_GRAPHIC_SMART) #define REPRAP_DISCOUNT_SMART_CONTROLLER #endif
We don’t have the FULL_GRAPHIC_SMART enabled so the default display will be the REPRAP_DISCOUNT_SMART_CONTROLLER, but it’s not correct in our case.
so comment the #define REPRAP_DISCOUNT_SMART_CONTROLLER line of code
#if DISABLED(FULL_GRAPHIC_SMART) //#define REPRAP_DISCOUNT_SMART_CONTROLLER #endif
You will find this piece of code twice, comment it on both places
on line number 2294, and line number 2438.
Now scroll down and search for MINIPANEL
You will need to uncomment this to enable our current display.
Step to set the correct display for Homers RS
If you have the new Homers RS
The only thing you need to do is to change 2 lines of code:
#define SERIAL_PORT 0 //#define SERIAL_PORT_2 -1
and change the values like this:
#define SERIAL_PORT -1 // is the USB port #define SERIAL_PORT_2 0 // is the serial port for the TFT
and make sure that the firmware on your TFT 3.2 is sett to 115200 and Marlin
And you’re done!
Continuation with The Tevo Tarantula Pro
After defining the correct display there is one last step to do:
Define correct pins for display Marlin
We will need to change some pins settings, this means that we need to go to the Marlin folder and after that, navigate to src/pins/ramps and open pins_RAMPS.h (If you have problems opening it with ArduinoIde try with and text Editor, it should work with no problem).
Inside pins_RAMPS.h search for the line of code :
After you find this line of code, search for the next #elif statement(#elif ENABLED(ZONESTAR_LCD)) and cancel everything in between these 2 statements.
The next step is to set the correct pins, for this I will simply provide the correct values to paste them in the same place we’ve canceled the old ones.
Paste these values:
#define MISO_PIN 50 // system defined - only needed if using onboard SD card #define MOSI_PIN 51 // system defined #define SCK_PIN 52 // system defined #define SDSS 53 // only needed if using onboard SD card #define BEEPER_PIN 37 #define BTN_EN1 31 #define BTN_EN2 33 #define BTN_ENC 35 #define KILL_PIN 41 // optional #define SD_DETECT_PIN 49 // only needed if using onboard SD card #define DOGLCD_CS 25 #define DOGLCD_A0 27
Is important to paste these values right below the #elif ENABLED(MINIPANEL) line and above #elif ENABLED(ZONESTAR_LCD).
After this, we finished doing most of the important parts!
Now we will pass to
Here we don’t need to change lots of settings but are pretty important as we need to define some extra things for the stepper drivers and the extruder fan.
To start ,open Configuration_Adv.h tab and search for:
Fan auto-start when heating
#define E0_AUTO_FAN_PIN -1
This setting is important because without this pin configuration the nozzle fan will not turn on automatically when it hits 50°C .
The correct configuration is :
#define E0_AUTO_FAN_PIN 7
You can change the default temperature that triggers the cooling fan right under by changing:
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
Stepper driver advanced configuration
When you find this line of code go right under that line and paste this code:
#define R_SENSE 0.11 // R_sense resistor
Change the voltage settings of the stepper drivers in spreadCycle mode:
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V
The Tarantula Pro works with a 24V power source so we need to change it to:
#define CHOPPER_TIMING CHOPPER_DEFAULT_24V
And this is it!
Flash marlin on the board
Now try to compile Marlin by pushing the verify button in ArduinoIde and be patient as it may take a while if everything goes well and you don’t see any errors it’s great! Plugin your printer and push upload and you are ready to test the new configuration!
Test new Marlin Configuration
The first thing you want to check is that the axis directions are correct, try homing one axis at a time. You only need to pay extra attention to the x-axis as we inverted its orientation. After you home the X, Y and Z, move your hotend higher and do a preheat.
When to the nozzle is hot try to extrude some plastic and check if the extruder motors pushes the filament in and not out, as we inverted this motor direction too.If you didn’t encounter problems till now, this means you are good to goo. I recommend doing a PID tune as the first step and an E-steps calibration.
Marlin 2.0 handy features
Marlin E3D V6 setting
#define HOTEND_E3DV6 // Genuine E3D v6 hotend.
If you uncomment this line Marlin will automatically set the correct thermistor settings.
Center the bed more accurately
#define NOZZLE_X -7 #define NOZZLE_Y 10
If you have problems with big prints because your bed in not properly centered then you need to use these settings to center it. If my settings don’t work for you then use this guide.
Marlin define PID settings
#define hot_Kp 25.74 #define hot_Ki 5.07 #define hot_Kd 32.68
Once you know the correct Pid settings you can insert them in marlin to have them stored.
Define standard preheating settings in Marlin
#define Hot_PLA 210 #define Bed_PLA 50
You can define the preheating temperature for PLA and ABS.You can also enable the PETG voice in the menu by uncommenting this line of code:
Activate bed corners leveling in Marlin
This function helps you level the bed more easily.