Guides

Guide: How to Flash a Bootloader on Melzi Boards

If you want to add new features on your 3D Printer, such as Auto Bed Leveling or Power Loss Resume, you will probably need to flash new firmware on the electronics board. The problem is that in order to do so, the board must already have a bootloader pre-installed. Melzi boards, often used in budget 3D printers like the CR-10, Ender-3 and Maker Select are almost exclusively distributed without them. Since this is necessary to upload firmware via USB, we will look at one of the easiest ways to do it.

Most importantly, we will need a device that can interact with and write code to our boards. We can use anything from an AVR programmer to a Raspberry Pi, but to keep things simple and cheap, an Arduino Uno and a few breadboard jumper wires will get the job done.

The best part… a bootloader is permanent. Once it has been burned on your board, you will never have to do it again. From that point, firmware can be flashed over USB as many times as needed. When you are finished, the Arduino is no longer required and can be re-purposed for other fun projects instead.

Melzi Board Breadboard Wires

Purchased Parts List

Complete Kit

Uno Bootloader Kit - $19.99

Individual Parts

Arduino Uno R3 - $8.39
Breadboard Jumper Wires - $4.29

Getting Started

Before we dive in, we will first need to download the Arduino IDE software. The Arduino IDE is a basic programming tool that can write code to various electronic devices. There are builds available for Windows, Mac and Linux, so just grab the one that works for your computer and run through the setup process.

Arduino IDE Downloads

Cheap Arduino Uno clones also require that the CH340G drivers be installed, allowing your computer to recognize the board. These can be found on the manufacturer’s website for a variety of operating systems.

CH340G Driver Downloads

Lastly, we need to grab a 3rd party package called Sanguino, which adds support to the Arduino IDE for these particular boards. Download the ZIP file from the following page, and extract it to the hardware folder in the Arduino directory. For Windows, this is located at Documents > Arduino > hardware. If the hardware folder doesn’t exist, go ahead and create it, then extract the ZIP file as shown in the image below.

Sanguino Downloads

If the Arduino IDE is already open, restart the program and check that the Sanguino package is now loaded. To confirm, click the Tools menu -> Board and scroll down to the bottom of the list, where it should have Sanguino as the last option. If the Sanguino package is for some reason missing from the Arduino IDE, double check the paths to ensure it was installed in the correct location.

Making an Arduino ISP

The Arduino IDE makes it simple to turn our Arduino Uno into an ISP (serial programmer) device, which can write a bootloader to the Melzi board. We just need to configure a few quick options in the software, upload the code and voila… we have created a working Arduino ISP to use.

With the Arduino IDE opened on your computer, go to the File menu -> Examples -> ArduinoISP -> ArduinoISP. This will open a new sketch window containing the ISP code, which is what we will write to our Arduino Uno board. We will just set the the board, COM port and programmer before uploading it.

Board: To configure the board, go to the Tools menu -> Board -> Arduino/Genuino Uno.

Port: To configure the port, go to the Tools menu -> Port and see what ports currently active. Plug the Arduino Uno board into the computer via USB cable and check the list again, which should now have a new COM port listed. This is your Arduino Uno board and you can go ahead and select it.

Programmer: To configure the programmer, go to the Tools menu -> Programmer -> AVRISP mkII.

At this point, we are ready to go ahead and write the code to our Arduino Uno board. Go to the Sketch menu -> Upload (or press Control + U) to initiate the process, which should take around 10 seconds to complete. The upload progress is shown at the bottom of the screen and will confirm when it’s done.

Wiring the Boards

Now that our Arduino Uno is a working programmer (ISP), we can just connect it up to the Melzi board and burn a bootloader to it. Before moving forward, make absolutely sure to power off and disconnect the electronics while we install the jumper wires, otherwise there is a risk of causing damage to the components.

We will need (5) female to female wires and (1) female to male wire. If you purchased an assorted pack of breadboard jumper wires, these often come attached together so just tear off a strip with the amount that you need. It doesn’t matter what colors are used but they will make it easier to to tell the wires apart, ensuring they are placed on the correct pins.

Using the diagram above as reference, locate the 6 pins on both the Melzi board and the Arduino Uno. We will connect 5 of these using (1) female/female jumper wire each so they are the same across boards. The one exception is the RESET pin, indicated by a yellow wire in the diagram.

For the RESET pin, we need to instead use the female/male jumper wire, connecting the female end to the Melzi board and the male end to Digital Pin 10 on the Arduino Uno. This is located in the black connector on the side of the board, with the number 10 written next to it.

It’s important to double and triple check the wiring at this point, making sure the connectors are well seated and have been placed on the right pins. Board orientation can make things a bit confusing here, especially if the Melzi is left inside of the case.

I mistakenly switched two jumper wires the first time, missed it once again when taking a second look and still didn’t notice until I was about to power up. It’s better to be safe than sorry, so do whatever you need to confirm everything is correct.

Flashing the Bootloader

With the hard part out of the way, we are now ready to flash the bootloader on our Melzi board. Go ahead and plug the Arduino Uno into the computer using a USB cable, which should be enough to power both boards. If this is not the case, you can also plug the Melzi board in to USB as well, but keep track of the COM ports assigned to each device.

Open up the Arduino IDE software once more, this time making several adjustments to reflect our new configuration. The Melzi board is our target device, while the Arduino Uno uploads the data to it. Tweak the software settings to match the following…

Board: go to the Tools menu -> Board -> Sanguino.

Processor: go to the Tools menu -> Processor -> ATmega1284 or ATmega1284P (16 MHz).

Port: go to the Tools menu -> Port and set the COM port for the Arduino Uno.

Programmer: go to the Tools menu -> Programmer -> Arduino as ISP.

With everything set, all we have left to do is burn the bootloader to our Melzi board. Go to the Tools menu -> Burn Bootloader and wait for it to complete. This should only take a few seconds to do, and will report once it has finished at the bottom.

If it was a success, you can power down the electronics and remove the jumper wires. Keep in mind that the existing firmware has been erased, so turning on the 3D printer will result in a blank blue screen for now. This is completely normal so don’t panic, you are ready to flash new firmware!

24 thoughts on “Guide: How to Flash a Bootloader on Melzi Boards

  1. Thanks for the write-up. I am completely unfamiliar with all things Arduino, and this will be the perfect first step for me since I’m already into 3d printing. So once you have the bootloader flashed, is the Arduino no longer necessary? I could use it for other projects afterwards?

    1. That is correct. Actually one of the reasons I went with the Uno, it is extremely cheap and once the bootloader is flashed, you can use the Arduino for something else. The bootloader only has to be burned on the 3D Printer board once, it is there to stay after that. That is a very good question though, will look at mentioning that in the guide since I know a lot of people wonder the same thing.

    1. Hey Paul,

      I haven’t used it yet but I am considering it for a future project soon. It definitely looks like a very promising solution and a couple of my machines are sitting unused, where I just need to decide which one will be subjected to my experiments.

      I’ve taken a step back from the Maker Select lately since it is pretty much completely upgraded, but joining the team at Gulfcoast Robotics a few months ago, we have some new products in development for it right now. I think my next goal on the Maker Select will be to add auto bed leveling since I just did it for the Ender-3, but firmware is a big consideration and circling back to it, Klipper may not be a bad choice in that regard. Let me know if you end up trying it out!

  2. Thanks, I would love to have bed leveling on the Maker Select. I can be a beta tester if you like. I really don’t want to put a lot of money in the Maker Select as I’m also seriously considering a Voron 2 build.

  3. Its mentioned early that a Raspberry Pi could be used for this. I already have one for use with OctoPi. Would be nice to re-use it to flash the boot loader then put it back to OctoPi use. Is it reasonable to use a Pi instead of Arduino?

    1. I have only used an Arduino Uno and a USBasp programmer, so unfortunately I am not familiar with the exact steps required when using a Raspberry Pi. With that said, there are definitely some guides out there that cover it, and using it temporarily to flash the bootloader and then moving it back to OctoPi is a perfectly good option. I opted to use the Arduino Uno because it was very simple to do, but I can’t imagine the Raspberry Pi would add much complexity to the overall process.

  4. I have tried a few firmware options -Marlin and Repetier but having a hard time with the config. Is there a baseline config for the MKV2 (non-plus) or guide?

    Thank you for the bootloader guide

  5. I’m using the Windows app version of the Arduino IDE (ver 1.8.15.0) and when I upload I get this message:

    Sketch uses 4402 bytes (13%) of program storage space. Maximum is 32256 bytes.
    Global variables use 482 bytes (23%) of dynamic memory, leaving 1566 bytes for local variables. Maximum is 2048 bytes.

    which is different from what you posted. Is this correct? This is my first time using an Arduino so I don’t have any experience with them. I’ve always used RPi’s in the past.

    1. hiya .
      i get the same message .
      havent tried yet to burn the bootloader , as its my first time having to deal with arduino and this kind of stuff , and i dont want to brake my ender 3.
      how did u got over it ?

      1. That isn’t an error message or anything to be concerned about, it just tells you how much memory it will be using on the board. If they have made changes to the sketch it could use more/less memory than mine did, but nothing to be alarmed about. As long as you are following the same steps and everything is wired up as pictured, it should work out perfectly fine. It’s pretty rare to brick these boards and even in the off chance that you do, they can be fixed with the Arduino board.

  6. Thank you for this guide.

    I got stuck at some point. After some googling and experimentation, I found that I needed to add a 10uF capacitor between Reset and GND on the Uno per the guide here:

    https://www.arduino.cc/en/Tutorial/ArduinoISP

    Without that I couldn’t upload the bootloader. I’m not sure why others don’t have that problem (may boil down to Uno revision or which exact flags avrdude is using).

      1. Also, I was using a Mac in case that helps. Seems some PC folks didn’t have to use a capacitor.

        Another thing that failed was using a UsbTinyISP to program it. That device didn’t have enough memory to push the new firmware. Threw an obscure CRC mismatch error.

  7. Thank you. Used this and it worked out well.

    I did have problems with my Mac, apparently in some cases it sends a reset signal immediately after loading the connection, before it’s ready. Borrowed a PC and it worked the first time.

    1. Hey Burton,

      No problem, glad to hear that you got it sorted out and everything worked well. I will definitely have to remember that about using a Mac in case anyone else runs in to that issue. Not the first time I’ve heard of some weird issues when using a Mac with 3D Printers though.

  8. What needs to be unplugged from the Melzi board prior to burning the bootloader? I know power, but do all the stepper motors and thermisters need to be unplugged also?

    1. Hi Jeff,

      You don’t necessarily need anything plugged in to the Melzi board other than the Arduino Uno. It won’t hurt to leave it connected to the other components though, I just left everything wired to the 3D Printer exactly as it normally is. When you connect the Arduino Uno to the computer over USB, that should provide power to both boards to complete the Bootloader burning process.

  9. I’ve been trying to do this on my Macbook for my Ender3, and I’m having error messages. When I try to upload, I get a message that says, “sorry–this program has been built without plugin support” under the heading, “Error compiling for board Sanguino(1284P Boards).”

    I’ve read elsewhere that this is a problem with Macs, and that you can simply delete files from the folder Libraries/Arduino15. However, I don’t seem to have that folder. Any solutions?

    Thank you in advance for any assistance.

    1. Hi Matt,

      Unfortunately I am a Windows guy and can’t comment on Mac problems, but several other visitors have left comments reporting similar issues. Someone mentioned they just borrowed a Windows PC to get this done and it worked flawlessly, which would probably be the easiest route if you have access.

      Otherwise, check out the comment from Dominic (posted Dec 10th, 2018) where he mentioned he needed to place a 10uF capacitor between RESET and GROUND on the Uno board. This seems to be specific to the Mac though, where I haven’t heard of anyone on Windows running in to that problem.

  10. Hi – I was pulling my hair out trying to flash the Melzi – Just found your mention of a 10uf cap – so I added to my Arduino Uno -then it all flashed great.
    But even with the bootloader installed I still cannot flash via the main USB port
    [Sync errors with whatever baud rate I tried]

  11. For anyone who is asking if NANO works… It does. I flashed a bootloader on my melzi 2.0 with an NANO LAFVIN. You need to be carefull with the wiring. It is not like the picture in this post (because in the post its an Arduino UNO). But if you make a good wiring it works like a charm.

    Thank yor the tutorial! It helped me a lot after hours of trying.

    Regards.

  12. Anyone have good config.h file for Merlin on the Maker Select v2? I’m looking to make this upgrade but don’t know if I have all the correct settings.

Leave a Reply

Your email address will not be published. Required fields are marked *