This page is dedicating to upgrading/updating your marlin firmware for your 3D printer.
Here we will also show what settings to use for Scalar XL 3D printers, but the main idea stay the same for any other printers. Be advised however that the philosophy can be slightly different for Delta 3D printers and that you might look for another type of guide if you own a Delta 3D printer.
Also the described marlin firmware is from 2015 August 24th so if you want to update to a newer version be advised that some modifications might be needed that are not covered on this guide.
First things to downloads first:
You will need to download and install a few tools first:
You will need to wire the PT100 on the AUX2 inputs instead of AUX1 input
Once downloaded, unzip it anywhere on your hard drive
The Arduino IDE;
After having installed it, execute it.
After a few seconds the main window will open with an empty sketch
Configure the IDE to get the line numbers:
In order to make it easier for you to find the proper location on each feature inside the firmware, you might be interested to enable the line numbers on the IDE.
it’s very easy, in the menu bar, just go to File>preferences
Then select « Display Line numbers » check box and click « ok »
now the line numbers should be visible on the left of the editor.
Special Note: The lines numbers are valid for firmware version 1.0.0. For other firmware versions the lines might change a little bit and some parameter names might even slightly change.
Load the firmware
In order to load the firmware, in the menu select « File>Open… »
Browse into the folder of the firmware you have extracted, the main folder content should look like this
Inside « Marlin » folder the most important files that you will need to use are « Configuration.h »
and « Marlin.ino »
From the Arduino IDE you will need to open « Marlin.ino » that is the firmware main project.
Once opened the ide should look like this
It’s really useful for you to increase the size of the window in order to better see the line of codes later on.
To expand the window size click on the increase size on the top right corner of the application.
Configure the Ide for Arduino mega 2560 microcontroler
Now you will need to setup your ide in order to properly select the output platform.
for this you will need to go into your menu « Tools>Board » and select « Arduino/Genuino mega or Mega 2560 »
And then select the proper Processor « Atmega2560(Mega 2560) »
Now connector to your 3D printer USB port and make sure that the arduino is properly detected by your pc.
From this you are set to go to the next step.
Dig into the firmware mysteries!
On the top of the IDE, in the green part, you should find many tabs called « Marlin », « Conditionals.h », « Configuration.h » etc…
Select the one called « Configuration.h »
Now in the text editor you will see appearing a lot of text.
This file mainly contains all the configuration parameters for your printer.
the lines in color are active while the lines in grey are comments.
A few words about comments
Comments are lines starting with « // ». they are often greyed.
Also a comment can be added at the end or middle of a line. In that case the beginning of the line will be colored and the remaining part past « // » will be greyed. The greyed part is also considered a comment.
Comments are very useful in order to give a lot of relevant information about the specific meaning of each settings.
A word about parameters
Parameters are often defined following a « #define » keyword.
Once uncommented the parameter following the #define will be active/enabled.
Let’s start configuration
Customizing your printer welcome screen massage
At the very beginning of the « configuration.h » file you will see parameter CUSTOM_MACHINE_NAME followed by some name into brackets
Here you can setup a custom text with a limited of 13 characters if your lcd language is set to English or french. (Other languages may display more of less characters.)
in order to tell the firmware which thermistor we are using we need to select the proper thermistor table for both hot ends and heatbed.
These tables can be selected near line 146.
In this example you see 5 parameters related to temperature sensors.
The 4 first ones are linked to hot ends.
The last one is used for heat bed only.
For scalar XL depending if you are using AllInOne hot end or E3DV6 you will need to use a different thermistor table for TEMP_SENSOR_0.
Use « 5 » for E3D V6 or AluHotEnd hot ends
Use « 13 » for Allinone
About the heatbed it mainly depends on what thermistor you are using, for Scalar XL and Scalar M 3D printers we are using 100K NTC beta 3950 1% thermistors so we are using table « 11 »
Setup the hotend PID
The PID, also known as « proportional–integral–derivative » controller, is used to control the heating element temperature.
For more information on this topic please check the wikipedia page:
It’s better to use PID mode for heating element that are compatible with this mode of heating such as Hot ends and 220V heat beds driven by SSR.
Avoid using PID mode for standard 12V 200W heat-beds because the power supply might not handle it very well.
PID control is great if you want a stable reliable temperature control.
If you just need a more simple way to drive the heating elements, then use Bangbang mode and disable this « #define PIDTEMP » parameter.
Special mode for PID mode:
In this mode when the temperature is low, the BangBang mode will be used.
Once the temperature is close to the target temperature (this can be configured in the settings) the PID mode will be used.
This mean that the hot-end will be very fast to reach a temperature close to the target temperature, but it will slow down at the very end in order to avoid possible temperature overshots.
Bang Max Parameter
This parameter is located around line 195.
40W heater cartridge:
If you have a hot-end with a 40 watt heater cartridge, you can lower down a little bit the BANG_MAX value.
Here is an example used for the AllInOne hot-end.
Setting up the PID constants:
Near line 210 you will reach a section where you will be able to define the PID constants.
On this example you can see that many PID values are commented and only 1 set of values is left uncommented.
Check what hotend you have and uncomment the 3 set of values corresponding to your hot-end.
For E3D hot-ends, as they are using 20W heater cartridge, you will need to previously set BANG_MAX to 255.
For AllInOne hotend, you will need to lower it down to 250 in order to avoid big overshot.
Setting up PID for heat-bed
Near line 268 you should find the parameters to enable/use pid function for heat-bed.
Note that depending on the type of heat-bed you are using, BANGBANG mode might be more suited. Indeed, if the heat-bed (often 12V heat-beds) is directly linked to the power supply, using PID mode might crash trigger some safety on the power supply side.
However if you are using a 220V driven by SSR (solid state relay), PID mode is something you can consider.
PID for Scalar XL 700W/220V heat-bed
To enable PID on heat-bed , just uncomment line 268 : #define PIDTEMBED
then select which heatbed you are using, in our case here we are using 700W 220V silicone heater mounted on a 3mm 435x320mm aluminum sheet.
If you are unsure that those settings are good for you, just pick the one closer to what you have and you will need to perform PID auto tune (see the procedure here: http://reprap.org/wiki/PID_Tuning )
Near line 307, just below PIDTEMPBED block, you should find settings related to extrusion safeties.
#define PREVENT_DANGEROUS_EXTRUDE parameter will allow extrusion only when hot end is hot enough using EXTRUDE_MINTEMP parameter at line 311.
If you hot end is below this temperature, extruder won’t move at all.
#define PREVENT_LENGHTY_EXTRUDE will prevent extrusion if a single gcode command is asking for a very long extrusion (more than 200mm).
A mechanism is available to detect if the heating elements are heating properly during all the print duration.
If the firmware detects any abnormal drop of temperature for a certain amount of time, an error message will appear on the LCD (THERMAL RUNAWAY), the print will stop and all heating elements will power off.
This protection is available for both hot end and heat-bed and you can enable 1 or both independently.
Auto bed leveling:
Near line 476 you have a whole section dedicated to Auto bed leveling (ABL).
This section is responsible for managing the G29 gcode.
On scalar 3D printers, it’s also responsible for using the induction probe.
At line 476 you can enable/disable this feature.
line 477 #define Z_PROBE_REPEATABILITY_TEST is used in order to double each measurement using slower speed the second time to increase measurement precision.
Block near line 498 are the coordinates of each probing points when using Grid mode.
Just a little bit below, near line 525, you will find the offsets used by the firmware to determine the induction probe location from the nozzle tip.
You will also find a few parameters that you can adjust if you want to tweak how fast the auto bed leveling mechanism is going.
Note: if you decrease too much those values you might encounter some troubles or even crash the nozzle into the heat-bed while moving to the next probing location.
Setup Steps/mm for each axis based on your mechanics
Depending if you are using Belts, threaded rods, trapezoidal lead-screws, etc… you might need to adjust the amounts of steps required in order to move 1mm or your printer won’t move the proper distance.
parameter DEFAULT_AXIS_STEPS_PER_UNIT is handling this notion for all axis (X, Y, Z, Extruder)
use prusa calculator if you need help in determining the proper values:
All parameters with ACCELERATION really depends on you mechanics ability to move fast, accelerate fast and decelerate fast.
Enabling EEPROM support and setting preheat presets:
line 649 #define EEPROM_SETTINGS is used in order to enable EEPROM support.
EEPROM is the internal memory of the arduino board. it’s a non volatile memory used to keep the important adjustable settings into memory for later use.
Most of the settings available from the LCD display are stored inside the EEPROM of the arduino.
Blocks near lines 659 are pre-heat presets for PLA and ABS. here you can setup your own. the default ones are shown on this example.
Configuring MQ2 smoke sensor:
The section dedicated to the MQ2 smoke sensor is located at the very bottom of the configuration.h file.
There line 863 #define MQ2_GAZ_DETECTOR will, if left commented, disable the smoke detection module. If un-commented, it will enable the smoke detection module.
When enabled, the next settings can be active.
line 869 #define MQ2_PIN is for advanced users if you want to use a spacial arduino IO pin.
By default we are using pin 57 (A3/D57 from AUX1 on Ramps 1.4) because it’s capable to be used in both Analog and digital mode. You can use any other IO pin but make sure it’s compatible with the sensing mode you are using.
line 872 MQ2_ALARM_TRIGGER_KEVEL_PPM is used when the sensing mode is used in ANALOG mode, meaning we are using the ANALOG output of the MQ2 sensor.
To enable ANALOG mode, you need to un-comment line 870 : USE_ANALOG_MODE
In this mode the analog output voltage will vary depending on the sensor detection.
In ANALOG mode, the blue trim on the sensor cannot be used, so in order to adjust the sensitivity of the sensor, the firmware is using a table that convert the output voltage of the sensor into PPM. When this PPM value is reached the alarm will trigger.
If you want more information about what value to use for your specific MQ2 module (each module is slightly different), enable parameter « MQ2_VERBOSE » at line 867, connect your printer to any host software and read the console output. A lot of values should be listed when you apply some smoke or gas to the probe.
In order to prevent false alarm, the firmware is taking several measurements in order to make sure the sensor output is stable above the trigger level.
Parameter MQ2_CONFIRM_COUNT is used for that purpose. Feel free to increase or decrease the confirm count to your liking. Increasing this value too much will reduce the reactivity of the alarm but will ensure that a real threat is detected.
Selecting alarm warnings:
A few warning levels are possible for this module.
An error is logged into the serial output console, so you can catch it using 3rd party hosts software
An error message can be written on the LCD display (make sure you have one if you are using this option
LCD buzzer can warn the user performing non stop beeps
LCD blinking can also warn the user about something abnormal
Each of these warning levels (except the first one) can be enabled/disabled at will and can be combined.
Uploading the Sketch to your Arduino:
Before uploading your sketch it’s a good idea to first check that the code and settings have a proper syntax.
On the top left corner of the Arduino IDE, you will find a round button with a « check » mark on it.
Push it and the compilation will begin. At the bottom right side of the IDE a progress bar will appear and a message on the left side will tell you that the compilation is in progress
Once done the following message at the bottom of the IDE should appear
Uploading the firmware to the arduino
If everything is ok and no error message appear, you can now upload this version of the firmware to the arduino.
To do this you will need to click on the button located right next to the « verify » button, the one with an arrow going from the left to the right.
The ide will compile again the code and will then upload the firmware to the Arduino.
The process is similar but will take longer.
Note that the progress bar might get stuck for a while but the upload process will still be running. On your arduino board a flashing led will appear, meaning that everything is in progress.
Once done an explicit message at the bottom of the IDE will appear, and the flash led will stop.
At the end your arduino will reboot and your new firmware and settings will be available on your arduino.
If you already have the EEPROM enabled on your 3D printer (it’s the case for Scalar 3D printer users), all settings stored in the EEPROM will still be active.
You will need to restore firmware settings (From the LCD,: « Control>restore Failsafe« ) in the following cases
if you changed the PID values from the firmware
if you changed the steps/mm settings from the firmware
if you have enabled/disabled PID function
More generally, If you have changed any other settings that is available from the LCD display.
Before doing that, make sure you have saved/written down somewhere your « ZOffset » parameter, as it will also be overwritten by the restore fail-safe operation.