Sửa chữa Robot dân dụng
Sửa chữa Robot đồ chơi công nghệ

How config Motherboard on Marlin 1.1

Posted at: Wenesday - 31/10/2018 16:38 - post name: SuperG
How config Motherboard on Marlin 1.1

How config Motherboard on Marlin 1.1

Firmware is a program which resides on the printer’s motherboard. The firmware is the link between software and hardware, it interprets commands from the G code file and controls the motion accordingly. The firmware configuration is unique to your printer. It knows the properties of the 3D printer, like the dimensions or heating settings. It plays a major role in the quality of the print.
Motherboard

In this example we will use one of the most common motherboards in the RepRap DIY 3D printer world. That is the Arduino Mega 2560 and the RAMPS 1.4 Shield that goes over it. Marlin firmware is compatible with a lot of motherboards and the following explanations apply with a little variation.

http://arduino.cc/en/Main/arduinoBoardMega2560#.UyumXoXDIlo

http://reprap.org/wiki/RAMPS_1.4

Firmware

Get the Marlin firmware: and click on the Download Zip button. Unzip the folder on your computer.

Arduino IDE

You will need a software to communicate with the board of your 3D printer to install the firmware. This is the Arduino IDE. It is an integrated development environment to program for the Arduino microcontroller. It is standard in many projects such as 3D printers.

Choose the version specific to your operating system to download.

Install Arduino IDE and start the application.

Motherboard

#define MOTHERBOARD BOARD_RAMPS_14_EFB

The most important setting is Marlin is the motherboard. The firmware needs to know what board it will be running on so it can assign the right functions to all pins and take advantage of the full capabilities of the board. Setting this incorrectly will lead to unpredictable results.

Using boards.h as a reference, replace BOARD_RAMPS_14_EFB with your board’s ID. The boards.h file has the most up-to-date listing of supported boards, so check it first if you don’t see yours listed here.

Motherboard Core Pins Board name
BOARD_3DRAG Arduino pins_3DRAG.h 3DRAG RAMPS v1.4
BOARD_AZTEEG_X3 Arduino pins_AZTEEG_X3.h Azteeg X3 RAMPS v1.4
BOARD_AZTEEG_X3_PRO Arduino pins_AZTEEG_X3_PRO.h Azteeg X3 PRO RAMPS v1.4
BOARD_BAM_DICE Arduino pins_RAMPS_14.h 2PrintBeta BAM&DICE
BOARD_BAM_DICE_DUE Arduino pins_BAM_DICE_DUE.h 2PrintBeta BAM&DICE Due
BOARD_BQ_ZUM_MEGA_3D Arduino pins_BQ_ZUM_MEGA_3D.h bq ZUM Mega 3D
BOARD_CHEAPTRONIC Arduino pins_CHEAPTRONIC.h Cheaptronic v1.0
BOARD_CHEAPTRONIC_V2 Arduino pins_CHEAPTRONIC_V2.h Cheaptronic v2.0
BOARD_CNCONTROLS_11 Arduino pins_CNCONTROLS_11.h Cartesio CN Controls V11
BOARD_CNCONTROLS_12 Arduino pins_CNCONTROLS_12.h Cartesio CN Controls V12
BOARD_EINSY_RAMBO Arduino pins_EINSY_RAMBO.h UltiMachine Einsy RAMBo
BOARD_EINSY_RETRO Arduino pins_EINSY_RETRO.h UltiMachine Einsy Retro
BOARD_ELEFU_3 Arduino pins_ELEFU_3.h Elefu RA
BOARD_FELIX2 Arduino pins_FELIX2.h FELIXprinters v2.0/3.0
BOARD_K8200 Arduino pins_K8200.h Velleman K8200 RAMPS v1.3
BOARD_K8400 Arduino pins_K8400.h Velleman K8400 RAMPS v1.4
BOARD_LEAPFROG Arduino pins_LEAPFROG.h Leapfrog Driver board
BOARD_MAKEBOARD_MINI Arduino pins_MAKEBOARD_MINI.h MicroMake MakeBoard Mini v2.1.2
BOARD_MEGACONTROLLER Arduino pins_MEGACONTROLLER.h Mega Controller
BOARD_MEGATRONICS Arduino pins_MEGATRONICS.h MegaTronics
BOARD_MEGATRONICS_2 Arduino pins_MEGATRONICS_2.h MegaTronics v2.0
BOARD_MEGATRONICS_3 Arduino pins_MEGATRONICS_3.h MegaTronics v3.0
BOARD_MEGATRONICS_31 Arduino pins_MEGATRONICS_31.h MegaTronics v3.1
BOARD_MINIRAMBO Arduino pins_MINIRAMBO.h Mini RAMBo
BOARD_MKS_BASE Arduino pins_MKS_BASE.h MKS BASE 1.0
BOARD_MKS_BASE_15 Arduino pins_MKS_BASE_15.h MKS BASE 1.5 with A4982 stepper drivers
BOARD_MKS_BASE_HEROIC Arduino pins_MKS_BASE_HEROIC.h MKS BASE 1.4 with Heroic HR4982 stepper drivers
BOARD_MKS_GEN_13 Arduino pins_MKS_GEN_13.h MKS GEN v1.3 and v1.4
BOARD_MKS_GEN_L Arduino pins_MKS_GEN_L.h MKS Gen L
BOARD_RAMBO Arduino pins_RAMBO.h RAMBo
BOARD_RAMPS_13_EEB Arduino pins_RAMPS_13.h RAMPS v1.3 (Extruder, Extruder, Bed)
BOARD_RAMPS_13_EEF Arduino pins_RAMPS_13.h RAMPS v1.3 (Extruder, Extruder, Fan)
BOARD_RAMPS_13_EFB Arduino pins_RAMPS_13.h RAMPS v1.3 (Extruder, Fan, Bed)
BOARD_RAMPS_13_EFF Arduino pins_RAMPS_13.h RAMPS v1.3 (Extruder, Fan, Fan)
BOARD_RAMPS_13_SF Arduino pins_RAMPS_13.h RAMPS v1.3 (Spindle, Controller Fan)
BOARD_RAMPS_14_EEB Arduino pins_RAMPS_14.h RAMPS v1.4 (Extruder, Extruder, Bed)
BOARD_RAMPS_14_EEF Arduino pins_RAMPS_14.h RAMPS v1.4 (Extruder, Extruder, Fan)
BOARD_RAMPS_14_EFB Arduino pins_RAMPS_14.h RAMPS v1.4 (Extruder, Fan, Bed)
BOARD_RAMPS_14_EFF Arduino pins_RAMPS_14.h RAMPS v1.4 (Extruder, Fan, Fan)
BOARD_RAMPS_14_SF Arduino pins_RAMPS_14.h RAMPS v1.4 (Spindle, Controller Fan)
BOARD_RAMPS_OLD Arduino pins_RAMPS_OLD.h RAMPS v1.0, v1.1, v1.2
BOARD_RAMPS_PLUS_EEB Arduino pins_RAMPS_PLUS.h 3DYMY RAMPS Plus (Extruder, Extruder, Bed)
BOARD_RAMPS_PLUS_EEF Arduino pins_RAMPS_PLUS.h 3DYMY RAMPS Plus (Extruder, Extruder, Fan)
BOARD_RAMPS_PLUS_EFB Arduino pins_RAMPS_PLUS.h 3DYMY RAMPS Plus (Extruder, Fan, Bed)
BOARD_RAMPS_PLUS_EFF Arduino pins_RAMPS_PLUS.h 3DYMY RAMPS Plus (Extruder, Fan, Fan)
BOARD_RAMPS_PLUS_SF Arduino pins_RAMPS_PLUS.h 3DYMY RAMPS Plus (Spindle, Controller Fan)
BOARD_RIGIDBOARD Arduino pins_RIGIDBOARD.h RIGIDBOARD RAMPS v1.4
BOARD_RIGIDBOARD_V2 Arduino pins_RIGIDBOARD_V2.h RIGIDBOARD v2
BOARD_RUMBA Arduino pins_RUMBA.h RUMBA
BOARD_SAINSMART_2IN1 Arduino pins_SAINSMART_2IN1.h Sainsmart 2-in-1
BOARD_SCOOVO_X9H Arduino pins_SCOOVO_X9H.h abee Scoovo X9H
BOARD_SILVER_GATE Arduino pins_SILVER_GATE.h Silvergate v1.0
BOARD_TRIGORILLA Arduino pins_TRIGORILLA.h Anycubic TriGorilla 1.3
BOARD_ULTIMAIN_2 Arduino pins_ULTIMAIN_2.h Ultiboard v2.0
BOARD_ULTIMAKER Arduino pins_ULTIMAKER.h Ultimaker
BOARD_ULTIMAKER_OLD Arduino pins_ULTIMAKER_OLD.h Ultimaker "old electronics"
BOARD_ZRIB_V20 Arduino pins_BOARD_ZRIB_V20.h zrib V2.0 (Chinese RAMPS replica)
BOARD_BRAINWAVE Brainwave pins_BRAINWAVE.h Brainwave 1.0
BOARD_BRAINWAVE_PRO Brainwave pins_BRAINWAVE_PRO.h Brainwave Pro
BOARD_GEN7_12 Gen7 pins_GEN7_12.h Gen7 v1.1, v1.2
BOARD_GEN7_13 Gen7 pins_GEN7_13.h Gen7 v1.3
BOARD_GEN7_14 Gen7 pins_GEN7_14.h Gen7 v1.4
BOARD_GEN7_CUSTOM Gen7 pins_GEN7_CUSTOM.h Gen7 "Alfons3"
BOARD_MINITRONICS Minitronics pins_MINITRONICS.h Minitronics v1.0/1.1
BOARD_ANET_10 Sanguino pins_ANET_10.h Anet V1.0 by SkyNet3D
BOARD_AZTEEG_X1 Sanguino pins_AZTEEG_X1.h Azteeg X1
BOARD_GEN3_MONOLITHIC Sanguino pins_GEN3_MONOLITHIC.h Gen3 Monolithic Electronics
BOARD_GEN3_PLUS Sanguino pins_GEN3_PLUS.h Gen3+
BOARD_GEN6 Sanguino pins_GEN6.h Gen6
BOARD_GEN6_DELUXE Sanguino pins_GEN6_DELUXE.h Gen6 Deluxe
BOARD_MELZI Sanguino pins_MELZI.h Melzi
BOARD_MELZI_CREALITY Sanguino pins_MELZI_CREALITY.h Melzi for Creality
BOARD_MELZI_MAKR3D Sanguino pins_MELZI_MAKR3D.h Melzi "MaKr3d"
BOARD_MELZI_MALYAN Sanguino pins_MELZI_MALYAN.h Melzi for Malyan
BOARD_MELZI_TRONXY Sanguino pins_MELZI_TRONXY.h Melzi for Tronxy
BOARD_OMCA_A Sanguino pins_OMCA.h Open Motion controller
BOARD_SANGUINOLOLU_11 Sanguino pins_SANGUINOLOLU_11.h Sanguinololu
BOARD_SANGUINOLOLU_12 Sanguino pins_SANGUINOLOLU_12.h Sanguinololu v1.2
BOARD_STB_11 Sanguino pins_STB_11.h STB V1.1
BOARD_OMCA SanguinoA pins_OMCA_A.h Open Motion controller "Alpha"
BOARD_SETHI Sethi 3D pins_SETHI.h Sethi 3D_1
BOARD_5DPRINT Teensy++ 2.0 pins_5DPRINT.h Makibox 5DPD8
BOARD_PRINTRBOARD Teensy++ 2.0 pins_PRINTRBOARD.h Printrboard
BOARD_PRINTRBOARD_REVF Teensy++ 2.0 pins_PRINTRBOARD_REVF.h Printrboard RevF
BOARD_SAV_MKI Teensy++ 2.0 pins_SAV_MKI.h SAV MkI
BOARD_TEENSY2 Teensy++ 2.0 pins_TEENSY2.h Teensy++ 2.0
BOARD_TEENSYLU Teensy++ 2.0 pins_TEENSYLU.h Teensylu 0.7

Link here: http://marlinfw.org/docs/configuration/configuration.html

First programming rule: comments

Sometimes we need help and comments to understand the intent of the programmer, but we don’t want the computer to get confused by these human comments so we use separators. In Arduino IDE the separator between computer language and comments is a double slash //, it works for every line. The compiler will not look after this separator. This is the only programming rule that we need to understand to configure the firmware properly. Sometimes we will activate some options by removing the comments and some other times we will comment-out options to deactivate them. Not to say that you might find useful information in the comments close to the parameter you need to edit.

Ramps 1.4 option

Before the attacking the configuration, if you use a RAMPS 1.4 or 1.3, you have first to edit one line in the pins.h file.

Search for the following text : “#define RAMPS_V_1_3” and remove the comments character “//” at the beginning of the line to activate it.

Save the file.

Configuration

Open the file Configuration.h in the Marlin folder.

 

General Settings

Set the communication speed:

Using the Arduino IDE to edit the configuration.h file, search for #define BAUDRATE (ctrl+F)

Set the communication speed in baud to:

 

#define BAUDRATE 250000

 

You can keep the other speed in comments, just remember this: //#define BAUDRATE 115200

This defines the communication speed between the electronic board and the computer. There are two speeds commonly used by 3D printing software, the 250000 and 115200 baud rate. If one doesn’t work with your hardware or software, try the other one.

Select the motherboard

Above the line: #define MOTHERBOARD you will see a list of different motherboards. You just have to find your configuration among the list and use the appropriate number. For example a RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed) will be configured:

 

#define MOTHERBOARD 33

 

*It doesn’t matter if you don’t use a fan or heat bed for now.

 

Defines the number of extruders

If you use more than one extruders you can write it there. However we will not go into details about multiple extruders in this post.

 

#define EXTRUDERS 1

Thermal Settings

Temperature sensor choice

Among the list (in configuration.h), choose the thermistor number that you use for each of the hot ends and for the heat bed. If you pick the wrong number, you may have an inaccurate temperature reading but you can still do temperature control and be able to print correctly.

 

#define TEMP_SENSOR_0 1

#define TEMP_SENSOR_1 0

#define TEMP_SENSOR_2 0

#define TEMP_SENSOR_BED 1

 

TEMP_SENSOR_0 is used by the first hot end and TEMP_SENSOR_BED is connected to the heat bed. If you don’t use a sensor, use 0 to disable it.

 

Minimum temperature

Use a minimum temperature different than 0 to check if the thermistor is working. This security will prevent the controller from heating the hot end at max power indefinitely. This is important. It should already be set by default

 

#define HEATER_0_MINTEMP 5

#define HEATER_1_MINTEMP 5

#define HEATER_2_MINTEMP 5

#define BED_MINTEMP 5

*units are in °Celcius

Maximum temperature

Depending on your hardware material your hot end will have a specific maximum temperature resistance. This security will prevent the temperature from going over it. For example a J-Head extruder may use a PTFE tube to guide the filament in the hot zone which can be damaged over 240°C. Notice the controller can overshoot the target temperature by a couple of °C, it is better to keep a security margin here.

 

#define HEATER_0_MAXTEMP 230

#define HEATER_1_MAXTEMP 230

#define HEATER_2_MAXTEMP 230

#define BED_MAXTEMP 120

PID temperature controller.

This is an advanced option which needs to be tuned later. For now you can use the default options.

Prevent dangerous extrusion:

These settings are set by default.

For a security reason you may want to prevent the extrusion if the temperature of the hot end is under the melting point of the material. You don’t want to push the extruder over solid material and risk breaking it.

 

#define PREVENT_DANGEROUS_EXTRUDE

 

*Note that you can override this protection by sending a M302 command with the host software.

If there is a mistake in the code like a dot position for example, you would want to prevent a very long extrusion command.

 

#define PREVENT_LENGTHY_EXTRUDE

 

Here you can set the values for the minimum temperature:

 

#define EXTRUDE_MINTEMP 170

Mechanical settings

End Stops

End stops are switches that trigger before an axis reaches its limit. In other words: It will prevent the printer from trying to move out of its own frame. End stops are also used by the printer as a reference position. It will move each axis in a specific direction until it reaches an end stop, this is the home of the printer.

Pull-ups resistances

It is a good practice to use a pull-up or pull-down circuit for a basic switch. To keep it simple the pull-ups resistance are needed if you directly connect a mechanical endswitch between the signal and ground pins.

Fortunately there is already a pull-up resistor integrated in Arduino that can be activated by the software.

http://en.wikipedia.org/wiki/Pull-up_resistor

http://arduino.cc/en/Tutorial/DigitalPins#.UyusMYXDIlp

#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pull-up resistors

 

The Marlin firmware allows one to configure each limit switch individually. You can use multiple end stop types on the same printer.

 

#ifndef ENDSTOPPULLUPS

  #define ENDSTOPPULLUP_XMAX

   #define ENDSTOPPULLUP_YMAX

//  #define ENDSTOPPULLUP_ZMAX

   #define ENDSTOPPULLUP_XMIN

   #define ENDSTOPPULLUP_YMIN

 //  #define ENDSTOPPULLUP_ZMIN

#endif

Invert endswitch logic

Some limit switches are normally closed (NC) and turn off when triggered and some are normally open (NO) and turn on when triggered. Ideally the limit switches would be normally on and turn current off when triggered. The printer would interpret the same signal if the end stop is hit as if the end stop is broken or disconnected.

 

NO = true

NC = false

 

const bool X_MIN_ENDSTOP_INVERTING = false;

const bool Y_MIN_ENDSTOP_INVERTING = false;

const bool Z_MIN_ENDSTOP_INVERTING = false;

const bool X_MAX_ENDSTOP_INVERTING = false;

const bool Y_MAX_ENDSTOP_INVERTING = false;

const bool Z_MAX_ENDSTOP_INVERTING = false;

Use three or six end stops?

Under normal circumstance the printer would always know its position according to the home reference position and never move out of its maximum envelope. In this case three endstops would be enough. While running it is possible the 3D printer loses its position because of a collision or skipped steps. In this case the printer can eventually move out of its normal envelope and cause damage. Using end stops at each end of each axis would prevent such situations.

Uncomment the following lines to disable all max or all min end stops.

 

//#define DISABLE_MAX_ENDSTOPS

//#define DISABLE_MIN_ENDSTOPS

Invert stepper motor direction

There is only way to know if the stepper motor direction is correct and it is to try it. I would wait until the configuration is completed, compiled and sent to the controller before you try. You can come back here after.

  1. Position the printer axis at the center of each axis.

  2. Keep your finger close to the stop button.

  3. Send a command to move the X axis a little amount like +1 or +10 mm

  4. If the printer moves in the other direction, you will have to reverse the axis direction.

  5. Repeat for each X Y Z axis

To inspect the extruder you would need to heat the hot end to the extrusion temperature, otherwise you can temporarily disable the EXTRUDE_MINTEMP protection. Be sure to perform the test without the filament loaded. Send extrusion command of 10 mm and check the motor rotation direction.

You can invert the stepper motor direction if it was wired the wrong way. It doesn’t make a difference if you invert the stepper motor wiring or if you invert it in the code. *Remember to power off the printer before unplugging or replugging the stepper motors.

 

#define INVERT_X_DIR false

#define INVERT_Y_DIR true

#define INVERT_Z_DIR true

#define INVERT_E0_DIR true

#define INVERT_E1_DIR true

#define INVERT_E2_DIR false

Set home direction

Here we set the home direction when the home button is pressed. It tells the printer which direction it should go to reach the end stop and get its reference position.

 

#define X_HOME_DIR -1

#define Y_HOME_DIR -1

#define Z_HOME_DIR 1

 

The Z axis is the one which will get the printing surface very close to the nozzle. It needs to be very precise and very quick to trigger otherwise there will be a collision between the nozzle and the surface. I prefer to send the print surface to home in the max direction and come back closer when the printer knows where to stop.

Allow the printer to go beyond the end stops limits

If you use optical end stops for instance you can position the end stops at the center of the moving area. You can tell the printer to move over the end stop signal. I never use it. If you placed end stops at the end of each axis, then keep these options set to true.

 

Don’t go over the minimum limit:

 

#define min_software_endstops true

 

Don’t go beyond the maximum limit

 

#define max_software_endstops true

Printer area

Here we can tell the firmware what the limits are of the travel zones. The travel distance is not calibrated yet and the practical distance will be different than the calculated distance. For now it is better to reduce the travel distance a bit and come back later when it is calibrated.

 

#define X_MAX_POS 190

#define X_MIN_POS 0

#define Y_MAX_POS 190

#define Y_MIN_POS 0

#define Z_MAX_POS 190

#define Z_MIN_POS 0

Movement settings

Define the number of axis

It is the total number of axis (3) plus the number of extruders (1).

 

#define NUM_AXIS 4

 

Homing feed rate

This is the moving speed of the axis when homing in [mm/min]. Oftentimes in Marlin, speed or acceleration are expressed in [mm/s] or [mm/s2] but the feed is expressed in [mm/min].

 

#define HOMING_FEEDRATE {50*60, 50*60, 4*60}

Axis steps per unit

The stepper motor receives step by step moving command from the controller. The controller needs to know the steps/mm ratio to send the appropriate steps to reach the required distance. How many steps are needed to move an axis by 1 mm?

 

Belts and pulley (usually xy axis):

steps_per_mm = (motor_steps_per_rev * driver_microstep) /
(belt_pitch * pulley_number_of_teeth)

lead screw (z axis)
steps_per_mm = (motor_steps_per_rev * driver_microstep) / thread_pitch

 

Direct drive extruder:

e_steps_per_mm = (motor_steps_per_rev * driver_microstep) /
(hob_effective_diameter * pi)

 See the example of bowden extruder

Extruder with gear reduction:

e_steps_per_mm = (motor_steps_per_rev * driver_microstep) *
(big_gear_teeth / small_gear_teeth) / (hob_effective_diameter * pi)

DEFAULT_AXIS_STEPS_PER_UNIT   {X,Y,Z,E1}

#define DEFAULT_AXIS_STEPS_PER_UNIT   {80,80,200.0*8/3,760}

Send the firmware to the 3D Printer

In Arduino IDE, save the modification done to Configuration.h

Verify the code

If everything is fine, Arduino should say “Done compiling” otherwise you will get one or more error messages. If this happens, there is usually a mention about the line of the error. Check your code for a comments error //, dots or other special characters that may have been mistyped.

Once it is compiled properly you can connect the Arduino board to the computer with the USB cable.

Select the proper port, Tools menu / Serial Port / <port number>

Upload the compiled code to the Arduino

Now your printer is ready to move. It’s alive!!!

Just one more thing. You need to try the stepper motor direction as mentioned above. You will need to use a host software connected to the 3D printer. The instructions to use this software will be explained in another post, for now I will stick to the basic guidelines. You can find more info on Pronterface here: http://reprap.org/wiki/Pronterface

You can also use Repetier which has an awesome G code viewer: http://www.repetier.com/documentation/repetier-host/gcode-editor/

To test the motor direction, connect the printer to the computer with the USB cable.

  1. Position the printer axis manually at the center of each axis.

  2. Power up the printer

  3. Open a host software like Pronterface or Repetier

  4. Click to connect the host to the printer

  5. Keep your finger close to the stop button of the motherboard (just in case).

  6. Send a command to move X axis a little amount like +1 or +10 mm

  7. If the printer moves in the other direction, you will have to reverse the axis direction.

  8. Repeat for each X Y Z axis

To inspect the extruder you will need to heat the hot end to the extrusion temperature, otherwise you can disable the protection by sending the M302 command. Be sure to perform the test without the filament loaded. Send the extrusion command of 10 mm and check the motor rotation direction.

 

You can invert the stepper motor direction if it was wired the wrong way, it doesn’t make a difference if you invert the stepper motor wiring or if you invert it in the code. *Remember to power off the printer before unplugging or replugging the stepper motors.

 

#define INVERT_X_DIR false

#define INVERT_Y_DIR true

#define INVERT_Z_DIR true

#define INVERT_E0_DIR true

#define INVERT_E1_DIR true

#define INVERT_E2_DIR false

Article reviews
Total number of articles is: 0 in 0 rating
You click on a star to rate article
 

About us

About us We provide 3D printers for retail and wholesale, We produced and assembled at Hanoi, Vietnam with many type: Cube, Delta, Mendel, scara, robot arm, custom by client...  - Repair 3D printers - Provide 3D printing materials...

1 1 1