User Tools

Site Tools


projects:3dprinting:anycubic_i3_mega_getting_and_adapting_firmware

Downloading and adapting the (Marlin based) firmware for the ANTCLABS BLTouch

This page will describe using and configuring the firmware from the following repository:

That repository is adapted from the official Marlin repository and is recommended by many people.

If someone needs a more hands on video, showing the process of downloading, adapting and compiling source files, the following video at youtube is recommended.

Although this page is specifically geared towards the following hardware:

  • ANYCUBIC I3 MEGA with Trigorilla1.1 board (8-bit, Mega2560 based)
  • ANTCLABS BLTouch added
  • DRV8825 stepper drivers (Instead of the original A4988 drivers.)

the steps to take in order to create the correct firmware for other hardware and/or other changes are basically very similar.

Adapting and compiling firmware

Many 3d printers use firmware which is created from source files hosted on github. Most of the ready made firmware files on the internet are targeted for original hardware without any modification and cannot be used if something is changed. Modifications are done directly in the source code and thus require small changes to the firmware. It is best to adapt the configuration (for Marlin in the so-called Configuration.h file) and compile yourself.

The process to compile a firmware from sources manually, is not very difficult and can be easily done within the Arduino IDE.

Download and install Arduino IDE

If not done yet, start with downloading and installing Arduino IDE. Follow the official instructions from arduino how to install, given on their webpage.

Get MNieddu91 repository

Clone or download the repository https://github.com/MNieddu91/Marlin-AI3M-BLTouch.git into the directory 01.anycubic_MNieddu91:

git clone https://github.com/MNieddu91/Marlin-AI3M-BLTouch.git 01.anycubic_MNieddu91

Open Marlin.ino

Within Arduino IDE, navigate into the cloned Marlin folder and open Marlin.ino

All files should be in separate tabs within Arduino.

Configure Microcontroller and board type

In the IDE, under Tools → Board select Genuino Mega 2560 and ATmega2560

Customization

In the Arduino IDE, go to the Configuration.h file tab (default in: Marlin/Configuration.h)

At the section Stepper Drivers, for optimize timing, change all DRIVER_TYPE into:

DRV8825

(originally this was TMC2208_STANDALONE)

The steps per unit setting also needs to be adjusted to the DRV8825:

#define DEFAULT_AXIS_STEPS_PER_UNIT { 160, 160, 800, 185.20 } // 1/32 Step settings

(originally this was { 80, 80, 400, 92.6 } // 1/16 Step settings)

Change the direction of the stepper (// @section machine) in the following:

#define INVERT_X_DIR true // set to true for DRV8825
#define INVERT_Y_DIR false // set to false for DRV8825
#define INVERT_Z_DIR false // set to false for DRV8825

Change the extruder direction (// @section extruder) in the following:

#define INVERT_E0_DIR false // set to false for DRV8825
#define INVERT_E1_DIR false // set to false for DRV8825

Flashing firmware

Once compiled, the firmware can be flashed directly from within the Arduino IDE.

Alternatively, the firmware can be compiled in Arduino into a hex file (Using Sketch → Export compiled binary) and then be flashed with Ultimaker CURA using the Marlin.ino.hex file in your Marlin directory. For this, please follow the screenshots below showing the process to upload the new firmware to the anycubic i3 MEGA. When done, restart the printer.

  1. Cura settings → Printer → Manage printers



  2. Printers preferences



  3. Upgrade Firmware

Test and calibration procedure

This test and calibration procedure is based on the github description of davidramiro.

Typically these are:

In order to perform a test and calibration procedure, it is necessary to send custom commands (Like “M503”) directly to the printer. For this you will need a serial terminal application. As of February 2020, none of the most common applications, like gtkterm, minicom, coolterm or even screen seem to work with a non-standard bautrate of 250000. Also, setting the baudrate to 250000 does not seem to work with stty.

Sending with echo directly to ttyUSB0, and using “tail -F /dev/ttyUSBx” to see the result, after setting the baudrate with python (see below), works not as expected either: Commands need to be issued twice in order to get a full reply from the printer.

So far, the only serial terminal application which can handle the non-standard 250000 baudrate, is the one included in the Arduino IDE. And only then when using a workaround.1)

A workaround is the following:

Power cycle the printer and make sure the printer is connected to the PC. Then start the Arduino IDE, configure the correct serial port (Per default this is /dev/ttyUSB0).

From within the Arduino IDE, open the Serial Monitor. You will likely see garbled text:

1. Observe garbled text with
a baudrate of 250000 (or
alternatively no text at all.)
2. Change the baudrate to 230400 3. Set the baudrate back to 250000

4. After setting the baudrate back to 250000 close the Serial Monitor (But keep the Arduino IDE open). Then set the non-standard baudrate of the serial port via the command line with the python script as shown here and use the given command to set the baudrate to 250000 (In this case for ttyUSB0):

./mysetbaud.py <>/dev/ttyUSB0 250000

5. Reopen the Serial Monitor in the Arduino IDE. Now it you should see normal text:

Output OK, reveals an EEPROM version mismatch…

Extruder intake

After following the extruder intake calibration procedure it was observed that instead of 100mm the intake was only 95mm, So this resulted into the following DEFAULT_AXIS_STEPS_PER_UNIT in Configuration.h:

//Old value: #define DEFAULT_AXIS_STEPS_PER_UNIT   { 160, 160, 800, 185.20 }
#define DEFAULT_AXIS_STEPS_PER_UNIT   { 160, 160, 800, 194.95 }

Probe offset

From the BLTouch calibration description, the following changes in Configuration.h where done:

//#define Y_PROBE_OFFSET_FROM_EXTRUDER -23  // Y offset: -front +behind [the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER -24  // Y offset: -front +behind [the nozzle]

Because the Ultrabase plate is held onto place with Kapton sticky tape, the boundaries need to be reduced where the probe can reach. This prevents that probing is done onto the sticky tape.

  // Set the boundaries for probing (where the probe can reach).
  //  #define LEFT_PROBE_BED_POSITION 10
  //  #define RIGHT_PROBE_BED_POSITION 190
  //  #define FRONT_PROBE_BED_POSITION 10
  //  #define BACK_PROBE_BED_POSITION 202
  #define LEFT_PROBE_BED_POSITION 24
  #define RIGHT_PROBE_BED_POSITION 190
  #define FRONT_PROBE_BED_POSITION 40
  #define BACK_PROBE_BED_POSITION 190

Although the board is the newer Trigorilla 1.1 version, the BLTouch is connected to the original pins D2/D11. Therefore it is not required to change the TRIGORILLA_VERSION setting in the source file. This is perfectly explained on the following page.

After the Z_PROBE_OFFSET_FROM_EXTRUDER was determined, the following was modifed:

//#define Z_PROBE_OFFSET_FROM_EXTRUDER 0   // Z offset: -below +above  [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4   // Z offset: -below +above  [the nozzle]

And recompiled and flashed onto the controller. Then finally two commands where issued to make these settings effective:

M502 (Load setting from firmware)
M500 (save settings in EEPROM)

This will as well solve the “EEPROM version mismatch” warning.

1)
Without experimenting further, maybe the root cause has to do with the “auto reset on serial connection”, as explained here: the https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection/
projects/3dprinting/anycubic_i3_mega_getting_and_adapting_firmware.txt · Last modified: 2020/03/08 21:40 by admin