Convert Figma logo to code with AI

MarlinFirmware logoMarlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.

16,596
19,373
16,596
798

Top Related Projects

Firmware for Original Prusa i3 3D printer by PrusaResearch

10,029

Klipper is a 3d-printer firmware

5,757

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino

Modular, opensource, high performance G-code interpreter and CNC controller written in Object-Oriented C++

Quick Overview

Marlin is an open-source firmware for 3D printers and CNC machines. It controls the motion of the printer, manages temperature, and handles other essential functions. Marlin is highly configurable and supports a wide range of hardware, making it one of the most popular firmware options for 3D printing enthusiasts and professionals.

Pros

  • Extensive hardware support for various 3D printer models and components
  • Highly customizable with numerous configuration options
  • Active community development and regular updates
  • Robust feature set, including advanced motion planning and thermal management

Cons

  • Steep learning curve for beginners due to its complexity
  • Configuration process can be time-consuming and requires technical knowledge
  • Some features may require additional hardware or modifications
  • Performance can vary depending on the specific hardware configuration

Code Examples

  1. Setting up basic movement:
void setup() {
  // Initialize stepper motors
  stepper.init();
  
  // Set maximum feedrate
  planner.set_max_feedrate_mm_s(X_AXIS, 200);
  planner.set_max_feedrate_mm_s(Y_AXIS, 200);
  planner.set_max_feedrate_mm_s(Z_AXIS, 10);
}
  1. Controlling temperature:
void loop() {
  // Set target temperature for hotend
  thermalManager.setTargetHotend(200, 0);
  
  // Wait for temperature to stabilize
  thermalManager.wait_for_hotend(0);
}
  1. Executing a G-code command:
void process_command() {
  // Execute a G1 move command
  GcodeSuite::G1();
  
  // Execute a M104 set temperature command
  GcodeSuite::M104();
}

Getting Started

To get started with Marlin firmware:

  1. Download the Marlin source code from the official repository.
  2. Copy the Marlin folder to your Arduino sketchbook folder.
  3. Open the Marlin.ino file in the Arduino IDE.
  4. Configure your printer settings in Configuration.h and Configuration_adv.h.
  5. Select your board from the Tools > Board menu.
  6. Compile and upload the firmware to your 3D printer.

For detailed instructions, refer to the Marlin documentation.

Competitor Comparisons

Firmware for Original Prusa i3 3D printer by PrusaResearch

Pros of Prusa-Firmware

  • Optimized specifically for Prusa printers, offering better performance and reliability
  • Includes advanced features tailored for Prusa hardware, such as crash detection and power panic
  • Regular updates and support directly from Prusa, ensuring compatibility with their ecosystem

Cons of Prusa-Firmware

  • Limited compatibility with non-Prusa printers, reducing flexibility for users with diverse hardware
  • Smaller community and fewer third-party contributions compared to Marlin
  • Less customization options for users who want to fine-tune their printer settings

Code Comparison

Prusa-Firmware (simplified bed leveling):

void mesh_bed_leveling_flag() {
  if (mbl.active) {
    SERIAL_PROTOCOLLNPGM("Mesh bed leveling: ON");
  } else {
    SERIAL_PROTOCOLLNPGM("Mesh bed leveling: OFF");
  }
}

Marlin (simplified bed leveling):

void gcode_G29() {
  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
    if (parser.seen('A')) {
      reset_bed_level();
      return;
    }
  #endif
  // ... (additional code for bed leveling)
}

Both firmwares implement bed leveling, but Prusa-Firmware's approach is more streamlined for their specific hardware, while Marlin's implementation is more generalized to accommodate various printer configurations.

10,029

Klipper is a 3d-printer firmware

Pros of Klipper

  • Higher print speeds and improved print quality due to advanced motion planning
  • Better utilization of hardware resources by offloading calculations to the host computer
  • More flexible configuration and easier firmware updates

Cons of Klipper

  • Requires additional hardware (Raspberry Pi or similar) to run the host software
  • Steeper learning curve for initial setup and configuration
  • Less widespread adoption compared to Marlin, potentially leading to fewer community resources

Code Comparison

Marlin (Configuration.h):

#define DEFAULT_AXIS_STEPS_PER_UNIT   { 80, 80, 400, 93 }
#define DEFAULT_MAX_FEEDRATE          { 300, 300, 5, 25 }
#define DEFAULT_MAX_ACCELERATION      { 3000, 3000, 100, 10000 }

Klipper (printer.cfg):

[stepper_x]
step_distance: 0.0125
max_velocity: 300
max_accel: 3000

[stepper_y]
step_distance: 0.0125
max_velocity: 300
max_accel: 3000

Both firmwares allow for customization of printer settings, but Klipper's configuration is more human-readable and easier to modify. Marlin uses C++ preprocessor directives, while Klipper uses a Python-like syntax in its configuration files.

5,757

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino

Pros of grbl

  • Lightweight and efficient, requiring less computational resources
  • Simpler codebase, easier to understand and modify
  • Faster execution and lower latency for CNC applications

Cons of grbl

  • Limited to 3-axis machines, less versatile than Marlin
  • Fewer advanced features and customization options
  • Smaller community and ecosystem compared to Marlin

Code Comparison

Marlin (configuration example):

#define BAUDRATE 250000
#define MOTHERBOARD BOARD_RAMPS_14_EFB
#define X_DRIVER_TYPE  A4988
#define Y_DRIVER_TYPE  A4988
#define Z_DRIVER_TYPE  A4988

grbl (configuration example):

#define BAUD_RATE 115200
#define STEP_PULSE_MICROSECONDS 10
#define STEPPING_INVERT_MASK 0
#define DIRECTION_INVERT_MASK 0
#define STEPPER_IDLE_LOCK_TIME 25

Marlin's configuration is more extensive and detailed, reflecting its broader feature set and compatibility with various hardware configurations. grbl's configuration is more streamlined, focusing on core CNC functionality and performance optimization.

Modular, opensource, high performance G-code interpreter and CNC controller written in Object-Oriented C++

Pros of Smoothieware

  • More modular and flexible architecture
  • Better support for advanced features like network connectivity
  • Easier configuration through a single text file

Cons of Smoothieware

  • Smaller community and less frequent updates
  • Limited compatibility with some 3D printer boards
  • Steeper learning curve for beginners

Code Comparison

Marlin configuration example:

#define BAUDRATE 250000
#define MOTHERBOARD BOARD_RAMPS_14_EFB
#define X_DRIVER_TYPE  A4988
#define Y_DRIVER_TYPE  A4988
#define Z_DRIVER_TYPE  A4988

Smoothieware configuration example:

uart_pinfunctions                 0,15
alpha_step_pin                    2.0
alpha_dir_pin                     0.5
alpha_max_rate                    30000

Both firmwares use different approaches to configuration. Marlin uses C++ preprocessor directives, while Smoothieware uses a YAML-based config file, making it easier to modify without recompiling.

Marlin has a larger user base and more frequent updates, making it more suitable for beginners and hobbyists. Smoothieware offers more advanced features and flexibility, appealing to experienced users and those with custom or complex setups.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

MarlinFirmware's logo

Marlin 3D Printer Firmware

GPL-V3.0 License Contributors Last Release Date CI Status GitHub Sponsors
Follow marlinfw.org on Bluesky Follow MarlinFirmware on Mastodon

Additional documentation can be found at the Marlin Home Page. Please test this firmware and let us know if it misbehaves in any way. Volunteers are standing by!

Marlin 2.1 Bugfix Branch

Not for production use. Use with caution!

Marlin 2.1 continues to support both 32-bit ARM and 8-bit AVR boards while adding support for up to 9 coordinated axes and to up to 8 extruders.

This branch is for patches to the latest 2.1.x release version. Periodically this branch will form the basis for the next minor 2.1.x release.

Download earlier versions of Marlin on the Releases page.

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 Marlin 2.1

To build and upload Marlin you will use one of these tools:

Marlin is optimized to build with the PlatformIO IDE extension for Visual Studio Code. You can still build Marlin with Arduino IDE, and we hope to improve the Arduino build experience, but at this time PlatformIO is the better choice.

8-Bit AVR Boards

We intend to continue supporting 8-bit AVR boards in perpetuity, maintaining a single codebase that can apply to all machines. We want casual hobbyists and tinkerers and owners of older machines to benefit from the community's innovations just as much as those with fancier machines. Plus, those old AVR-based machines are often the best for your testing and feedback!

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!

Supported Platforms

PlatformMCUExample Boards
Arduino AVRATmegaRAMPS, Melzi, RAMBo
Teensy++ 2.0AT90USB1286Printrboard
Arduino DueSAM3X8ERAMPS-FD, RADDS, RAMPS4DUE
ESP32ESP32FYSETC E4, E4d@BOX, MRR
HC32HC32Ender-2 Pro, Voxelab Aquila
LPC1768ARM® Cortex-M3MKS SBASE, Re-ARM, Selena Compact
LPC1769ARM® Cortex-M3Smoothieboard, Azteeg X5 mini, TH3D EZBoard
STM32F103ARM® Cortex-M3Malyan M200, GTM32 Pro, MKS Robin, BTT SKR Mini
STM32F401ARM® Cortex-M4ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6, Artillery Ruby
Pico RP2040Dual Cortex M0+BigTreeTech SKR Pico
STM32F7x6ARM® Cortex-M7The Borg, RemRam V1
STM32G0B1RET6ARM® Cortex-M0+BigTreeTech SKR mini E3 V3.0
STM32H743xIT6ARM® Cortex-M7BigTreeTech SKR V3.0, SKR EZ V3.0, SKR SE BX V2.0/V3.0
SAMD21P20AARM® Cortex-M0+Adafruit Grand Central M4
SAMD51P20AARM® Cortex-M4Adafruit Grand Central M4
Teensy 3.2/3.1MK20DX256VLH7 ARM® Cortex-M4
Teensy 3.5MK64FX512-VMD12 ARM® Cortex-M4
Teensy 3.6MK66FX1MB-VMD18 ARM® Cortex-M4
Teensy 4.0MIMXRT1062-DVL6B ARM® Cortex-M7
Teensy 4.1MIMXRT1062-DVJ6B ARM® Cortex-M7
Linux Nativex86 / ARM / RISC-VRaspberry Pi GPIO
SimulatorWindows, macOS, LinuxDesktop OS
All supported boardsAll platformsAll boards

Marlin Support

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

Contributing Patches

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

  • We use branches named with a "bugfix" or "dev" prefix to fix bugs and integrate new features.
  • Follow the Coding Standards to gain points with the maintainers.
  • Please submit Feature Requests and Bug Reports to the Issue Queue. See above for user support.
  • Whenever you add new features, be sure to add one or more build tests to buildroot/tests. Any tests added to a PR will be run within that PR on GitHub servers as soon as they are pushed. To minimize iteration be sure to run your new tests locally, if possible.
    • Local build tests:
      • All: make tests-config-all-local
      • Single: make tests-config-single-local TEST_TARGET=...
    • Local build tests in Docker:
      • All: make tests-config-all-local-docker
      • Single: make tests-config-all-local-docker TEST_TARGET=...
    • To run all unit test suites:
      • Using PIO: platformio run -t test-marlin
      • Using Make: make unit-test-all-local
      • Using Docker + make: maker unit-test-all-local-docker
    • To run a single unit test suite:
      • Using PIO: platformio run -t marlin_<test-suite-name>
      • Using make: make unit-test-single-local TEST_TARGET=<test-suite-name>
      • Using Docker + make: maker unit-test-single-local-docker TEST_TARGET=<test-suite-name>
  • If your feature can be unit tested, add one or more unit tests. For more information see our documentation on Unit Tests.

Contributors

Marlin 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.

Project Leadership

NameRoleLinkDonate
🇺🇸 Scott LahteineProject Lead[@thinkyhead]💸 Donate
🇺🇸 Roxanne NeufeldAdmin[@Roxy-3D]
🇺🇸 Keith BennettAdmin[@thisiskeithb]💸 Donate
🇺🇸 Jason SmithAdmin[@sjasonsmith]
🇧🇷 Victor OliveiraAdmin[@rhapsodyv]
🇬🇧 Chris PepperAdmin[@p3p]
🇳🇿 Peter EllensAdmin[@ellensp]💸 Donate
🇺🇸 Bob KuhnAdmin[@Bob-the-Kuhn]
🇳🇱 Erik van der ZalmFounder[@ErikZalm]

Star History

Star History Chart

License

Marlin 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.