DerAndere1 / Marlin

Optimized firmware for RepRap 3D printers based on the Arduino platform. The branch Marlin2ForPipetBot is optimized firmware for cartesian robots (lab robots, also known as liquid handling robots or pipetting robots)
https://derandere.gitlab.io/pipetbot-a8
GNU General Public License v3.0
53 stars 20 forks source link
3d-printing arduino avr control controller firmware g-code motion-control reprap robot robotics

Marlin2ForPipetBot 3D Printer and Lab Robot CNC Firmware

Additional documentation can be found in the repository DerAndere1/Marlin at https://github.com, the Wiki or on the PipetBot-A8 project homepage that is part of the authors homepage. For multi-axis CNC machines and lab robots (liquid handling robots, "pipetting robots"). Please test this firmware and let us know if it misbehaves in any way. Volunteers are standing by!

Marlin2ForPipetBot supports up to nine non-extruder axes plus extruders (e.g. XYZABCUVW+E or XYZABCW+E or XYZCUVW+E or XYZABC+E or XYZUVW+E). In addition, support for a laser and a spindle is provided.

G-code

The G-code syntax of Marlin2ForPipetBot closely resembles that of LinuxCNC (the successor of NIST RS274NGC interpreter - version 3). Here is a list of G-codes that deviated in official MarlinFirmware/Marlin and that are brought more in line with LinuxCNC syntax:

New G-codes:

G1 (Linear Move)

Usage

Example syntax for movement (G-code G1) with 9 axes plus extruder (default axis names: XYZABCUVW+E):

G1 [Xx.xxxx] [Yy.yyyy] [Zz.zzzz] [Aa.aaaa] [Bb.bbbb] [Cc.cccc] [Uu.uuuu] [Vv.vvvv] [Ww.wwww] [Ee.eeee] [Ff.ffff]

Parameters:

X, Y, Z

Position in the cartesian coordinate system consisting of primary linear axes X, Y and Z. Unit: mm (after G-code G21) or imperial inch (after G-code G20)

A, B, C

Angular position in the pseudo-cartesian coordinate system consisting of rotational axes A, B, and C that are parallel to axes X, Y and Z, respectively. Unit: degrees

U, V, W

Position in the cartesian coordinate system consisting of secondary linear axes U, V and W that are parallel to axes X, Y and Z. Unit: mm (after G-code G21) or imperial inch (after G-code G20)

E

Distance the E stepper should move. Unit: mm (after G-code G21) or imperial inch (after G-code G20)

F

Feedrate as defined by LinuxCNC:

To change the feed rate interpretation, the option ARTICULATED_ROBOT_ARM can be defined. With that option enabled, feed reference are all axes. This means that in all cases all axes are moved in coordinated linear motion so that the time (in minutes) required for the move is T = sqrt((dA)^2 + (dB)^2 + (dC)^2 + (dU)^2 + (dV)^2 + (dW)^2) / F plus any time for acceleration or deceleration.

G10 (Set offsets)

Set offsets. See the following references:

G43 (Tool Length Offset)

Enable simple tool length compensation. See the following references:

Notes

Currently, no H word is supported. The tool offsets (set by G10) for the current tool are applied.

G43.4 (Tool centerpoint control)

Enable tool centerpoint control. See the following references:

Notes

Currently, no H word is supported. The tool offsets (set by G10) for the current tool are applied.

G49 (Cancel tool length compensation)

Disable tool length compensation (G43) and disable tool centerpoint control (G43.4). Enter direct joint control mode (default). See the following references:

M665 (PENTA_AXIS configuration)

Configure PENTA_AXIS_TRT and PENTA_AXIS_HT geometry values.

Usage

M665 [X<MRZP-offset>] [Y<MRZP-offset>] [Z<MRZP-offset>] [S<segments-per-second>] [I<rotational-joint-offset>] [J<rotational-joint-offset>] [K<rotational-joint-offset>]

Parameters

Z<MRZP-offset>

Set the machine rotary zero point (MRZP) Z offset.

See DEFAULT_MRZP_OFFSET_Z and see the definition of the pivot point (Pz) in reference https://linuxcnc.org/docs/html/motion/5-axis-kinematics.html

X<MRZP-offset>

Set the machine rotary zero point (MRZP) X offset. For 5 axis CNC machines with a tilting rotary table (PENTA_AXIS_TRT) this is the distance along the X axis from machine zero point to the center of rotation when all axes are in neutral (zero) position. The center of rotation is usually the center of the top surface of the table.

See DEFAULT_MRZP_OFFSET_X and see the definition of the pivot point (Px) in reference https://linuxcnc.org/docs/html/motion/5-axis-kinematics.html

Y<MRZP-offset>

Set the machine rotary zero point (MRZP) Y offset. For 5 axis CNC machines with a tilting rotary table (PENTA_AXIS_TRT) this is the distance along the Y axis from machine zero point to the center of rotation when all axes are in neutral (zero) position. The center of rotation is usually the center of the top surface of the table.

See the definition of the pivot point (Py) in reference https://linuxcnc.org/docs/html/motion/5-axis-kinematics.html

I<rotational-joint-offset>

Set the rotational joint X offset. For a 5 axis CNC machine with a tilting rotary table (PENTA_AXIS_TRT) with XYZBC axes this is the distance along the X axis from the vertical centerline of the joint of the rotary table to the horizontal centerline of the joint that tilts the table. Measured when all rotational axes are in neutral (zero) position so that the table is oriented horizontally.

See DEFAULT_ROTATIONAL_JOINT_OFFSET_X. Also, see definition of Dx in sections "5.3. Transformations for a xyzbc-trt machine with rotary axis offsets" and "7. Custom Kinematics Components" in this reference:

J<rotational-joint-offset>

Set the rotational joint Y offset. For a 5 axis CNC machine with a tilting rotary table (PENTA_AXIS_TRT) with XYZAC axes this is the distance along the Y axis from the vertical centerline of the joint of the rotary table to the horizontal centerline of the joint that tilts the table. Measured when all rotational axes are in neutral (zero) position so that the table is oriented horizontally.

See DEFAULT_ROTATIONAL_JOINT_OFFSET_Y. Also, see definition of Dy in sections "5.3. Transformations for a xyzbc-trt machine with rotary axis offsets" and "7. Custom Kinematics Components" in this reference:

K<rotational-joint-offset>

Set the rotational joint Z offset. For a 5 axis CNC machine with a tilting rotary table (PENTA_AXIS_TRT) this is the distance along the Z axis from the surface at the top of the table to the horizontal centerline of the joint that tilts the table. Measured when all rotational axes are in neutral (zero) position so that the table is oriented horizontally.

See DEFAULT_ROTATIONAL_JOINT_OFFSET_Z. Also, see definition of Dz in sections "5.3. Transformations for a xyzbc-trt machine with rotary axis offsets" and "7. Custom Kinematics Components" in this reference:

M211 (Software Endstops)

Set whether printing should abort or moves should be clamped in the event of any software endstop being triggered. This provides a fast way to abort a print in the event of mechanical failure such as loose couplings, lost steps, diverted axes, binding, etc., which lead to axes being very far out of position.

Notes

Usage

M211 S<flag> H<flag>

Parameters

S<flag>

Whether (1) or not (0) to enable software endstops.

H<flag>

Whether to abort machining on software endstops hit (1) or whether to clamp moves to the software endstops (0). Requires ABORT_ON_SOFTWARE_ENDSTOP

Configuration

Configuration is done by editing the file Marlin/Configuration.h. E.g. change

//#define I_DRIVER_TYPE A4988

to:

#define I_DRIVER_TYPE A4988

The following is a list of options in Marlin2ForPipetBot that are relevant for machines with more than three axes or that deviate from those of MarlinFirmware/Marlin:

X_DRIVER_TYPE

X_DRIVER_TYPE, Y_DRIVER_TYPE, Z_DRIVER_TYPE, I_DRIVER_TYPE, J_DRIVER_TYPE, K_DRIVER_TYPE, U_DRIVER_TYPE, V_DRIVER_TYPE, W_DRIVER_TYPE: These settings allow Marlin to tune stepper driver timing and enable advanced options for stepper drivers that support them. You may also override timing options in Configuration_adv.h.

Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.

Each driver is associated with an axis (internal axis identifiers: X, Y, Z, I, J, K, U, V, W) or an extruder (E0 to E7). Each axis gets its own stepper control and endstops depending on the following settings: [[I, [J, [K...]]]_STEP_PIN, [I, [J, [K...]]]_ENABLE_PIN, [I, [J, [K...]]]_DIR_PIN, [I, [J, [K...]]]_STOP_PIN, USE_[I, [J, [K...]]][MIN || MAX]_PLUG, [I, [J, [K...]]]_ENABLE_ON, DISABLE_[I, [J, [K...]]], [I, [J, [K...]]]_MIN_POS, [I, [J, [K...]]]_MAX_POS, [I, [J, [K...]]]_HOME_DIR, possibly DEFAULT_[I, [J, [K...]]]JERK, and definition of the respective values of DEFAULT_AXIS_STEPS_PER_UNIT, DEFAULT_MAX_FEEDRATE, DEFAULT_MAX_ACCELERATION, HOMING_FEEDRATE_MM_M, AXIS_RELATIVE_MODES, MICROSTEP_MODES, HOMING_BUMP_MM, HOMING_BUMP_DIVISOR, and possibly also values of MAX_FEEDRATE_EDIT_VALUES, MAX_ACCEL_EDIT_VALUES, MAX_JERK_EDIT_VALUES, MANUAL_FEEDRATE, SENSORLESS_BACKOFF_MM, HOMING_BACKOFF_POST_MM, BACKLASH_DISTANCE_MM. NOZZLE_TO_PROBE_OFFSETS has to be extended with elemets of value 0 until the number of elements is equal to the value of NUM_AXES.

Allowed values: [A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01, TB6560, TB6600, TMC2100, TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE, TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE, TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE]

AXIS4_ROTATES

AXIS4_ROTATES, AXIS5_ROTATES, AXIS6_ROTATES, AXIS7_ROTATES, AXIS8_ROTATES, AXIS9_ROTATES: If enabled, the corresponding axis is a rotational axis for which positions are specified in angular degrees. For moves involving only rotational axes, feedrate is interpreted in angular degrees.

AXIS4_NAME

AXIS4_NAME, AXIS5_NAME, AXIS6_NAME, AXIS7_NAME, AXIS8_NAME, AXIS9_NAME: Axis codes for additional axes: This defines the axis code that is used in G-code commands to reference a specific axis. Conventional axis names are as follows:

Regardless of the settings, firmware-internal axis names are I (AXIS4), J (AXIS5), K (AXIS6), U (AXIS7), V (AXIS8), W (AXIS9).

Allowed values: ['A', 'B', 'C', 'U', 'V', 'W']

ARTICULATED_ROBOT_ARM

When enabled, feed rate (the F-word in G1 G-code commands) is interpreted with all axes as the feed reference. For compatibility with Marlin <= 2.0.9.3, grblHAL/grblHAL-core, Duet3D/RepRap-Firmware, synthetos/g2core and for compatibility with articulated robots (robot arms) for which inverse kinematics are not yet implemented in Marlin. For a detailed description of feedrate, see first section.

FOAMCUTTER_XYUV

Define FOAMCUTTER_XYUV kinematics for a hot wire cutter with parallel horizontal axes X, U where the hights of the two wire ends are controlled by parallel axes Y, V. Currently only works with *_DRIVER_TYPE defined for 5 axes (X, Y, Z, I and J). A dummy pin number can be assigned to pins for the unused Z axis. Leave FOAMCUTTER_XYUV disabled for default behaviour (stepper velocities are calculated using multidimensional linear interpolation over all axes). Host software and CAM software for 4 axis foam cutters can be found at https://rckeith.co.uk/file-downloads/ and https://www.jedicut.com/en/download/ .

PENTA_AXIS_TRT

Define PENTA_AXIS_TRT kinematics for a 5 axis CNC machine in tilting-rotating-table configuration to add support for tool center point control (see section G43.4 tool center point control). These machines have 3 mutually orthogonal prismatic ("linear") joints aligned with axes XYZ plus a rotary table (C axis) mounted on a tilting table (A or B axis). Two different machine geometries of this type are supported:

PENTA_AXIS_HT

Define PENTA_AXIS_HT kinematics for a 5 axis CNC machine in head-table configuration to add support for tool center point control (see section G43.4 tool center point control). These machines have 3 mutually orthogonal prismatic ("linear") joints aligned with axes XYZ plus a swivel head (A or B axis) and a horizontal rotary table (C axis). There are two possible machine geometries:

DEFAULT_MRZP_OFFSET_Z

Machine rotary zero point (MRZP) Z offset.

See the definition of the pivot point (Pz) in this reference:

DEFAULT_MRZP_OFFSET_X

Machine rotary zero point (MRZP) X offset. For 5 axis CNC machines with a tilting rotary table (PENTA_AXIS_TRT) this is the distance along the X axis from machine zero point to the center of rotation when all axes are in neutral (zero) position. The center of rotation is usually the center of the top surface of the table.

See the definition of the pivot point (Px) in this reference:

DEFAULT_MRZP_OFFSET_Y

Machine rotary zero point (MRZP) Y offset. For 5 axis CNC machines with a tilting rotary table (PENTA_AXIS_TRT) this is the distance along the Y axis from machine zero point to the center of rotation when all axes are in neutral (zero) position. The center of rotation is usually the center of the top surface of the table.

See the definition of the pivot point (Pz) in this reference:

DEFAULT_ROTATIONAL_JOINT_OFFSET_X

For a 5 axis CNC machine with a tilting rotary table (PENTA_AXIS_TRT) with XYZBC axes this is the distance along the X axis from the vertical centerline of the joint of the rotary table to the horizontal centerline of the joint that tilts the table. Measured when all rotational axes are in neutral (zero) position so that the table is oriented horizontally.

See definition of Dx in this reference:

DEFAULT_ROTATIONAL_JOINT_OFFSET_Y

For a 5 axis CNC machine with a tilting rotary table (PENTA_AXIS_TRT) with XYZAC axes this is the distance along the Y axis from the vertical centerline of the joint of the rotary table to the horizontal centerline of the joint that tilts the table. Measured when all rotational axes are in neutral (zero) position so that the table is oriented horizontally.

See definition of Dy in this reference:

DEFAULT_ROTATIONAL_JOINT_OFFSET_Z

For a 5 axis CNC machine with a tilting rotary table (PENTA_AXIS_TRT) this is the distance along the Z axis from the surface at the top of the table to the horizontal centerline of the joint that tilts the table. Measured when all rotational axes are in neutral (zero) position so that the table is oriented horizontally.

See definition of Dz in this reference:

TOOLS

Number of tools, including extruders. Tool indices, starting with 0, must be assigned in the following order: extruders (requires EXTRUDERS > 0), laser (requires LASER_FEATURE), anf finally tools for a spindle (requires SPINDLE_FEATURE). Offsets of each tool from tool 0 must be defined with HOTEND_OFFSET_X, HOTEND_OFFSET_Y and HOTEND_OFFSET_Z.

ABORT_ON_SOFTWARE_ENDSTOPS

Abort printing when any software endstop is triggered. This feature is enabled with 'M211 H1' or from the LCD menu. Software endstops must be activated for this option to work.

SAFE_BED_LEVELING_START_X

SAFE_BED_LEVELING_START_X, SAFE_BED_LEVELING_START_Y, SAFE_BED_LEVELING_START_Z, SAFE_BED_LEVELING_START_I, SAFE_BED_LEVELING_START_J, SAFE_BED_LEVELING_START_K, SAFE_BED_LEVELING_START_U, SAFE_BED_LEVELING_START_V, SAFE_BED_LEVELING_START_W: Safe bed leveling start coordinates. If enabled, the respective axis is moved to the specified position at the beginning of the bed leveling procedure. Required for multi-axis machines (I_DRIVER_TYPE ... defined). Values must be chosen so that the bed is oriented horizontally and so that the Z-probe is oriented vertically. Note: If inverse kinematics for your machine are not implemented, bed leveling produces wrong results for all moves where the bed is not oriented horizontally or where the tool head is not oriented vertically. In these cases, bed leveling must be disabled.

LCD_SHOW_SECONDARY_AXES

Show the position of secondary axes I[J[K]] instead of icons on an DOGM LCD (e.g. REPRAP_FULL_GRAPHICS_DISPLAY).

QUICK_HOME_SECONDARY_AXES

If all axes are homed, first raise Z, then move all axes except Z simultaneously to their home position. Once the first axis reaches its home position, the axes will be homed individually in sequence XYZIJKUVW. Requires QUICK_HOME.

CLASSIC_JERK

For multi-axis machines it is highly recommended to enable CLASSIC_JERK.

HOTEND_OFFSET_X

HOTEND_OFFSET_X, HOTEND_OFFSET_Y and HOTEND_OFFSET_Z: Arrays with offsets for each tool. With PENTA_AXIS_TRT or PENTA_AXIS_HT enabled, the machine is by default in joint control mode (tool length compensation and tool centerpoint control disabled). Use G10 to set hotend offsets (tool offsets). Use G43 to enable tool length compensation (apply hotend offsets / tool offsets). Use G43.4 to enable tool centerpoint control. Use G49 to cancel tool length compensation and tool centerpoint control.

Marlin2ForPipetBot Branch

Not for production use. Use with caution!

Marlin2forPipetBot is a branch of the Marlin fork by DerAndere (based on https://github.com/MarlinFirmware/Marlin/tree/3e9fb34892e85bc4069acf5baddbf12d6cd47789).

This branch is for patches to the latest Marlin2ForPipetBot release version.

Example Configurations

Before you can build Marlin for your machine you'll need a configuration for your specific hardware. Upon request, your vendor will be happy to provide you with the complete source code and configurations for your machine, but you'll need to get updated configuration files if you want to install a newer version of Marlin. Fortunately, Marlin users have contributed dozens of tested configurations to get you started. Visit the MarlinFirmware/Configurations repository to find the right configuration for your hardware.

Building Marlin2ForPipetBot

To build Marlin2ForPipetBot you'll need PlatformIO. The Marlin team has posted detailed instructions on Building Marlin with PlatformIO. Marlin2ForPipetBot is preconfigured for the Anet-V1.0 board of the PipetBot-A8. When using the default build environment (default_env = melzi_optiboot), upload of the compiled Marlin2ForPipetBot firmware to the board via USB using the optiboot bootloader requires burning of the optiboot bootloader onto the board as described in the SkyNet3D/anet-board documentation.

The different branches in the git repository https://github.com/DerAndere1/Marlin reflect different stages of development:

Hardware Abstraction Layer (HAL)

Marlin includes an abstraction layer to provide a common API for all the platforms it targets. This allows Marlin code to address the details of motion and user interface tasks at the lowest and highest levels with no system overhead, tying all events directly to the hardware clock.

Every new HAL opens up a world of hardware. At this time we need HALs for RP2040 and the Duet3D family of boards. A HAL that wraps an RTOS is an interesting concept that could be explored. Did you know that Marlin includes a Simulator that can run on Windows, macOS, and Linux? Join the Discord to help move these sub-projects forward!

8-Bit AVR Boards

A core tenet of this project is to keep supporting 8-bit AVR boards while also maintaining a single codebase that applies equally to all machines. We want casual hobbyists to benefit from the community's innovations as much as possible just as much as those with fancier machines. Plus, those old AVR-based machines are often the best for your testing and feedback!

Supported Platforms

Platform MCU Example Boards
Arduino AVR ATmega RAMPS, Melzi, RAMBo
Teensy++ 2.0 AT90USB1286 Printrboard
Arduino Due SAM3X8E RAMPS-FD, RADDS, RAMPS4DUE
ESP32 ESP32 FYSETC E4, E4d@BOX, MRR
LPC1768 ARM® Cortex-M3 MKS SBASE, Re-ARM, Selena Compact
LPC1769 ARM® Cortex-M3 Smoothieboard, Azteeg X5 mini, TH3D EZBoard
STM32F103 ARM® Cortex-M3 Malyan M200, GTM32 Pro, MKS Robin, BTT SKR Mini
STM32F401 ARM® Cortex-M4 ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6, Artillery Ruby
STM32F7x6 ARM® Cortex-M7 The Borg, RemRam V1
STM32G0B1RET6 ARM® Cortex-M0+ BigTreeTech SKR mini E3 V3.0
STM32H743xIT6 ARM® Cortex-M7 BigTreeTech SKR V3.0, SKR EZ V3.0, SKR SE BX V2.0/V3.0
SAMD51P20A ARM® Cortex-M4 Adafruit Grand Central M4
Teensy 3.5 ARM® Cortex-M4
Teensy 3.6 ARM® Cortex-M4
Teensy 4.0 ARM® Cortex-M7
Teensy 4.1 ARM® Cortex-M7
Linux Native x86/ARM/etc. Raspberry Pi
All supported boards All platforms All boards

Marlin Support

The Issue Queue is reserved for Bug Reports and Feature Requests. To get help with configuration and troubleshooting, please use the following resources:

Contributors

You can contribute patches by submitting a Pull Request to the (bugfix-2.1.x) branch.

Credits

Marlin2ForPipetBot is constantly improving thanks to a huge number of contributors from all over the world bringing their specialties and talents. Huge thanks are due to all the contributors who regularly patch up bugs, help direct traffic, and basically keep Marlin from falling apart. Marlin's continued existence would not be possible without them.

Marlin Firmware original logo design by Ahmet Cem TURAN @ahmetcemturan.

Marlin2ForPipetBot (https://github.com/DerAndere1/Marlin)

Copyright 2024 DerAndere

Marlin2ForPipetBot is modified by:

Marlin2ForPipetBot is based on:

MarlinFirmware/Marlin Marlin 3D Printer Firmware (https://github.com/MarlinFirmware/Marlin)

Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]

Contributions

Author Contact Contribution
DerAndere @DerAndere1 main developer of multi-axis support, idea, initial implementation, added features AXIS4_NAME, I_DRIVER_TYPE ... W_DRIVER_TYPE, PENTA_AXIS_HT, PENTA_AXIS_TRT, TOOLS, EVENT_GCODE_TOOLCHANGE_T0, EVENT_GCODE_TOOLCHANGE_T1, SAFE_BED_LEVELING_POSITION_X, AXIS4_ROTATES, FOAMCUTTER_XYUV, ARTICULATED_ROBOT_ARM, QUICK_HOME_ALL_NON_Z_AXES, LCD_SHOW_SECONDARY_AXES, added commands G10, G43, G43.4, G49, bugfixes
Gabriel Beraldo @GabrielBeraldo hardware debugging, bugfixes yielding first working prototype (make additional axes move, fix EEPROM)
Olivier Briand @hobiseven testing, added experimental compatibility with different configurations, code review, FOAMCUTTER_XYUV feed rate interpretation mode
Wolverine @MohammadSDGHN added experimental compatibility with different configurations (BigTreeTech SKR Pro 1.1, Trinamic TMC drivers, StealthChop, sensorless homing)
bilsef @bilsef testing, code review, bugfixes (fix movement of additional axes, fix types.h, fix EEPROM)
FNeo31 @FNeo31 added experimental drilling cyles (G81, G82, G83)
HendrikJan-5D @HendrikJan-5D testing bed leveling and Trinamic TMC, bugfixes yielding first working 9 axis printer prototype
Paloky @paloky Initial extension of multi-axis support from 6 to 8 axes
Keith @rcKeith Testing of FOAMCUTTER_XYUV and LCD_SHOW_SECONDARY_AXES
Phillipp Webb @Domush Added commands G10 L2, G10 L20
Scott Lahteine @thinkyhead code review, refactoring
MarlinFirmware @MarlinFirmware Marlin 3D Printer firmware

License

Marlin2ForPipetBot is published under the GPL license because we believe in open development. The GPL comes with both rights and obligations. Whether you use Marlin firmware as the driver for your open or closed-source product, you must keep Marlin open, and you must provide your compatible Marlin source code to end users upon request. The most straightforward way to comply with the Marlin license is to make a fork of Marlin on Github, perform your modifications, and direct users to your modified fork.

While we can't prevent the use of this code in products (3D printers, CNC, etc.) that are closed source or crippled by a patent, we would prefer that you choose another firmware or, better yet, make your own.