This article describes how to customise the Ender 3 Pro by first flashing a bootloader, then how to compile and flash Marlin version 1.1.9 with the latest bug fixes. Plus the inclusion of some additional functionality such as manual mesh bed levelling. This should work on the Ender 3 Pro and the non-pro variant and possibly other similar printers from Creality.
Table of Contents
- Preparing the Raspberry Pi to perform a firmware update on the Ender 3 Pro
- Configuring AVRDude on the RaspberryPi
- Wiring suggestions for the Ender 3 and Raspberry Pi GPIO
- Modifying Marlin 1.1.9 for the Ender 3
- Configuring Arduino IDE for compilation and export
- Utilising Manual Mesh bed levelling on the Ender 3 Pro
Edit: A newer article discussed another option utilising automatic bed levelling on the stock Ender 3 Pro it will require a bed levelling sensor like the BLTouch.
Cautionary Disclaimer; MODIFYING THE BOOTLOADER TO ENABLE FIRMWARE FLASHING REQUIRES THAT YOU DISASSEMBLE YOUR CONTROL BOX AND POTENTIALLY EXPOSE PARTS CARRYING MAINS ELECTRICITY. ENSURE THE POWER IS DISCONNECTED AND USE GOOD JUDGEMENT. UNDER NO CIRCUMSTANCES WILL I BE HELD RESPONSIBLE FOR ANY DAMAGES THAT YOU PERFORM TO YOU, OTHERS AND/OR YOUR PROPERTY, PROCEED WITH THE GREATEST CARE AND AT YOUR OWN RISK.
Preparing the Raspberry Pi to perform a firmware update on the Ender 3 Pro
Hardware requirements
- A Raspberry Pi (I used a Pi3 B+)
- 6 x female-female jumper cables; or:
- Alternatively if like myself at the time you do not happen to have any female-female jumpers laying around but instead have male-female jumpers (x12) and a breadboard with power rails (not at all specific) this would also be a viable option.
- Another alternative if your pi does not have GPIO header installed then you could use 6x female-male jumper cables.
- Or possibly a USB ISP Programmer (namely for ATMEL, ATMega, ATTiny 51, AVR, SMC Boards); this alternative would allow you to skip the requirement for using a Raspberry Pi for flashing a bootloader and firmware. ProgISP would be required (not covered in this article).
- A Ender 3 Pro (or Ender 3)
Software requirements:
Configuring AVRDude on the RaspberryPi
This required software on the Raspberry Pi.
First we will perform a system package update and upgrade where necessary (at your discretion).
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install avrdude -y
AVRDude should be installed and can be confirmed with:
avrdude -v
Next you need to configure AVRDude to communicate with our board; a Raspberry Pi in this instance, start by copying the default AVRDude configuration to your home directory:
cp /etc/avrdude.conf ~/avrdude_gpio.conf
Edit the configuration:
nano ~/avrdude_gpio.conf
Search for “linuxspi
“, you should see something like:
id = "linuxspi";
desc = "Use Linux SPI device in /dev/spidev*";
type = "linuxspi";
reset = 25;
baudrate=4000000;
In this section change the “baudrate
” to that used by the Ender 3 Pro: 115200; it should read as:
baudrate=115200;
Still working in: avrdude_gpio.conf
add the following to the bottom of the file:
# Linux GPIO configuration for avrdude.
# Change the lines below to the GPIO pins connected to the AVR.
programmer
id = "raspberry_pi";
desc = "Use the Linux sysfs interface to GPIO (I2C bitbang)";
type = "linuxgpio";
reset = 17;
sck = 24;
mosi = 23;
miso = 18;
;
Wiring suggestions for the Ender 3 and Raspberry Pi GPIO
Next we configure the physical connection between the Ender 3 Pro and Raspberry Pi. Keep in mind you do not need to use the mains power to flash the bootloader
The GPIO headers we will use are as follows:
Ender 3 Control board Pinout | Raspberry Pi GPIO Pinout |
VCC (+3.3V) | Pin 1 or 17 |
GND | Pin 6, 14, 20 or 32 |
RESET | Pin 11 GPIO 17 |
SCK | Pin 16 GPIO 23 |
MOSI | Pin 16 GPIO 23 |
MISO | Pin 12 GPIO 18 |
Now test that we can communicate with our device using AVR Dude. The Ender 3 Pro (stock) uses a board powered by a Atmega 1284p from the Raspberry Pi run:
sudo avrdude -p atmega1284p -C ~/avrdude_gpio.conf -c raspberry_pi –v
Success will return a message similar to the following message; if you see this then you can safely move on to the next stage: flashing the bootloader.
Avr device initiated and ready to accept instructions
This next stage assumes you are using Windows; although the only real difference will be path names; you need to find and locate your installation directory for the Arduino IDE. Once located find the file optiboot_atmega1284p.hex
Example on Window the path (relative to your username):
C:\Users\<USERNAME>\AppData\Local\Arduino15\packages\Sanguino\hardware\avr\1.0.3\bootloaders\optiboot
Note: At the time of writing the AVR version was at 1.0.3.
Copy and transfer the optiboot_atmega1284p.hex
bootloader file to the Raspberry Pi to flash to our Ender 3 control board.
Flash the Bootloader with avrdude
:
sudo avrdude -p atmega1284p -C ~/avrdude_gpio.conf -c raspberry_pi -v -U flash:w:optiboot_atmega1284p.hex:i
Modifying Marlin 1.1.9 for the Ender 3
The following steps will enable you to compile and export a binary for installation on a Ender 3 Pro.
First you need to download a copy of Marlin 1.1.9 to a location to be worked on.
- Using Git you can:
git clone https://github.com/MarlinFirmware/Marlin.git
- Or download the .zip from the releases page: Marlin 1.1.9
In configuration.h
find and uncomment the following:
#define PROBE_MANUALLY
#define LCD_BED_LEVELING
#define MESH_BED_LEVELING
#define RESTORE_LEVELING_AFTER_G28
In configuration_adv.h
this time find and uncomment the following:
#define ARC_SUPPORT
#define SHOW_BOOTSCREEN
For the curious ARC_SUPPORT is used in CNC milling machines and not typically used in 3D Printing; in the case of our Ender 3 machine we don’t need it and disabling it will save some space needed to successfully compile with the enabling of MESH_BED_LEVELING.
Configuring Arduino IDE for compilation and export
- Under Tools > Board set to Sanguino
- Under Tools > Processor set to ATmega1284 ATmega1284P (16mhz)
- Note: If you do not see the Sanguino option under boards; you will need to add a new board URL Under Preferences -> Additional Boards Manager URLs. The list is a comma separated set of values; to enable the Sanguino option you will want to add the following:
https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json
- Note: If you do not see the Sanguino option under boards; you will need to add a new board URL Under Preferences -> Additional Boards Manager URLs. The list is a comma separated set of values; to enable the Sanguino option you will want to add the following:
- Under Tools > Programmer set to Arduino as ISP
- Under Sketch > Include Library > Manage libraries and add the U8glib Library (U8glib v1.19.1 at time of writing).
Next compilation and export:
- Verify and compile by navigating under Sketch > Verify/Compile (CTRL + R)
- Export the binary by navigating under Sketch > Export compiled Binary (CTRL + ALT + S)
- Navigate to explorer and locate the Binary under the Marlin firmware’s working directory.
- Select the variant of the the file without the bootloader part in the name e.g. Marlin.ino.sanguino.hex.
- Copy and upload the Binary (Marlin.ino.sanguino.hex) to Raspberry Pi via an SFTP client.
Assuming that you have left the compiled firmware with the default filename you can flash the firmware from the Raspberry Pi with:
sudo avrdude -p atmega1284p -c arduino -P /dev/ttyUSB0 -b 115200 -U flash:w:Marlin.ino.sanguino.hex:i
Once firmware has been flashed there will be couple more tasks left to complete before you will be ready to print.
Utilising Manual Mesh bed levelling on the Ender 3 Pro
At this stage I’d suggest performing a manual bed levelling first, this should improve the results from the manual mesh bed levelling which is intended for slight deviations in warped beds and not for poorly calibrated initial bed positions.
- On the Ender 3; click the control knob and under Prepare find Bed levelling and click to start the process.
- Follow the onscreen steps and carefully using a piece of paper to intercept where the head will land. You are aiming to decrease/increase the z axis offset by turning the knob until the print head just catches the papers.
- Click the knob to save each point.
- Once all 9 points are complete whilst still under the Prepare menu scroll to the item Save Settings and click it. This ensures that the bed levelling results are saved to the device.
Admittedly this step may take a little while and gets easier with repetition. The best gauge I’ve found when using a piece of paper is to try and use the piece of paper with just one hand and to grab the sheet from the bottom and push it under the head. You are aiming to get it to a point where you can feel a little resistance from the print head but the paper can still be moved with one hand.
The next step is optional based on the type of bed you have and any modifications such as; added dampeners to the stepper motors or using a different bed to the magnetic variant that comes stock (as of November 2019).
Next set the z offset which moves the nozzle up or down relative to the stored mesh.
- Marlin mesh bed levelling guide
- G29 command (Manual bed levelling)
- M420 command (Bed levelling State)
Like!! I blog quite often and I genuinely thank you for your information. The article has truly peaked my interest.
I’m glad you enjoyed the article and hope you continue to enjoy future content.