Introduction: Using an Arduino to Flash the Melzi Board (Wanhao I3) and Upgrade Firmware
I purchased an e3d hotend and due to it using a different thermistor, the stock firmware that came with the Wanhao i3 (v2.0/2.1) won't be able to read the thermistor temperature correctly. I had a spare Arduino laying around and found out I could use it to flash the Melzi board which is normally done with a standalone AVR programmer.
Step 1: Preparing the Board
- Disconnect the printer power supply from the back.
- Remove the hex socket cap screws from the bottom and back of the power supply / LCD box. Don’t remove the middle four on the bottom as these hold the PSU in place.
- Remove the back of the box and slide the bottom of the box toward the back, and place the two pieces somewhere convenient close by. It gets a bit annoying because things aren’t modular with this printer.
- You can unscrew the four hex socket cap screws that keep the Melzi board in the box to have more freedom. Be sure to remove any SD card or USB cable you’ve still got connected. You can probably skip this part but I find it easier to manage with it outside the box.
- Ensure the auto-reset jumper at the bottom of the board is on (or if you’ve chucked it out like I have, that the two pins are electrically connected somehow) and the power jumper up the other end of the board is set to USB
- Remove the SD card and USB cable if you’ve haven’t already, and disconnect the LCD cable near the auto-reset jumper from the board. Apparently the LCD messes with the SPI interface somehow.
Step 2: Preparing the Arduino
I’ve used an Arduino Duemilanove but you can use an Uno (I am not sure about Nano and other types). Arduino gives you a little more info about this process here. Whatever device you are using, this is called the ISP programmer.
1.Install Arduino 1.6.9 (I use this only because the firmware was confirmed working with this, you can probably use the latest but not certain), and install the Sanugino package. This can be done by copying the contents of the zip to /ARDUINO_INSTALL_DIRECTORY/hardware.
2. Connect the ISP programmer/Arudino to your computer. Open device manager -> ports to see what COM port it is if you are unsure.
3. In the Arduino IDE, Tools -> Board -> Select your Arduino board and select the COM port corresponding to your device, Tools -> port
4. Open the ArduinoISP example from File -> Examples ->ArduinoISP -> ArduinoISP and upload it to your Arduino by clicking the upload button.
5. Now we need to burn the bootloader to the Melzi. This will require either 6-pin headers or some sort of make-shift situation like I have done (wires + solder + Arduino headers). However you do this, connect the pins on the Arduino to the Melzi board ISP pins on the bottom of the board. As per the schematic, ensure the following pin connections:
Arduino 10 -> Melzi RES
Arduino 11-> Melzi MOSI
Arduino 12 -> Melzi MISO
Arduino 13 -> Melzi SCK
Arduino 5V -> Melzi 5V
Arduino GND -> Melzi GND
6. Once the connect is made, ensure both the Arudino and Melzi are powered by USB.
7. Go to Tools -> Programmer -> Arduino as ISP.
8. Go to Tools -> Port -> select the port corresponding to the Melzi board, not our Arduino.
9. Change the processor board to Sanugino using Tools -> Board and set processor to The Sanguino ATmega1284p (16MHz) using Tools -> Processor.
10. Click Tools -> Burn Bootloader. This should take about one minute or so and will notify you if successful. Errors will occur if steps 7 – 9 aren’t followed.
11. Remove the headers from the the SPI pins on the Melzi board. You won’t need the Arduino anymore so you can disconnect this too.
Step 3: The Firmware
I have used a nice version of the repetier software modified by Max Bian on the Wanhao google group:
1. Download the firmware and extract it somewhere and open the .ino file in the Arudino IDE. You can use whatever firmware you like. I will be referring to this one though.
2. Open it with the Ardunino IDE and do these few modifications if you wish:
a. This ensures the thermistor of the e3d can be used correctly if you want to use the the e3d v6 hotend – In the configuration.h and change “#define EXT0_TEMPSENSOR_TYPE 97” to “#define EXT0_TEMPSENSOR_TYPE 8”.
b. This ensures the rotary encoder on the box is nice and smooth - In the configuration.h file, change “#define UI_ENCODER_SPEED 1” to “#define UI_ENCODER_SPEED 2” and “#define UI_KEY_BOUNCETIME 10” to “#define UI_KEY_BOUNCETIME 20”.
c. This removes all those stupid beep sounds - In the ui.cpp find and replace “BEEP_SHORT “ with “//BEEP_SHORT”.
3. Save all these modifications. Ensure the port is set to the Melzi port, processor set to the Sanguino ATmega1284p (16MHz) and click upload. This will take about a minute.
4. If you get the error “avrdude: stk500_getsync(): not in sync: resp=0x00” you haven’t burned the bootloader correctly so go back and try again.
5. Once completed, remove the USB cable from the Melzi board, remove the auto-reset jumper if you are used to that and change the power jumper back to VREG, attached the LCD screen back again.
6. Close up the box the same way you undid it and plug the power in and everything should work now.
You’ll see some nice changes in the menus and startup screen, but other than that, everything should be similar. A really great feature is the babystep-Z adjustment in quick settings which can be done at the start of the print if the bed is level but too close to the nozzle.