Upgrading RAMPS 1.4 to Marlin Firmware (Prusa Mendel)
This post hopes to serve as a brief tutorial for RepRappers on how to upgrade the Sprinter firmware to Marlin on their RAMPS v1.4 Arduino Mega 2560 boards. It will show some specific changes required for the Prusa Mendel variant. With fundamental knowledge of your own unique build you could use this as an outline on upgrading the firmware for another model that uses RAMPS or even some other electronics. Hope it helps and I encourage you to leave feedback in the comments if this helped you out, if you have any questions or suggestions, or just to say hi.
1. Download the following software before beginning the upgrade:
- Printrun - consists of printcore, pronsole and pronterface, and a small collection of helpful scripts; put in your applications folder.
- Arduino IDE - open-source Arduino environment makes it easy to write code and upload it to the i/o board; put in your applications folder.
- Marlin Firmware - a RepRap firmware mashup of Sprinter and grbl; the major advantage over Sprinter being Look Ahead (which keeps the prints as quick as possible); it is likely that if you purchased pre-assembled RAMPS electronics before 2012 it came preinstalled with Sprinter; download the ZIP file and decompress in a known folder.
NOTE: This update was completed using Mac OSX 10.8 but the instructions should be comprehensive enough for someone to follow along in a Windows environment.
1b. If this is the first time running your printer it might be a good idea to check all of your hardware is operational. I have found this piece of code (firmware) handy for testing everything quickly and easily. It will move your X, Y, Z, and E axes back and forth and heat the printbed and hot-end. WARNING: If you do not want your printer to heat up yet, disconnect the printbed and hot end from your board. Follow step 2 to upload the firmware to your Arduino Mega 2560.
2. Open Arduino IDE. Plug in your RAMPS board via USB. For me a good indicator of the connection is a blue LED on the SD card add-on. If you don't have this addition, no worries.
Now you must connect your board to the software. Choose from the menu bar Tools>Serial Port>USB. The name will look similar to dev.tty.USB. Next, choose Tools>Board>Arduino Mega 2560 or Mega ADK.
3. You must first edit your Marlin firmware code to match your hardware set up. In the Arduino IDE choose File>Open... Navigate to your Marlin folder you saved earlier and open Marlin.pde (or Marlin.ino). Along the top of the window you will see many different tabs, you will only need to edit the configuration.h and perhaps the configuration_adv.h (for advanced users) tabs.
Go to the configuration.h tab. Here are the major changes you will need to make in order to get your RAMPS v1.4 Prusa Mendel working.
First define your motherboard, look for
#define MOTHERBOARD 7
and change the value to 33 for RAMPS 1.3 (don't worry, it works for v1.4 too)
Next, choose your thermistors for your hot-end(s) and print bed; I have 100k thermistors for both so I have:
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 1
Under PID Settings I commented out
#define PIDTEMP (add // before the line)
to disable PID temp and enable bang-bang (To be honest, I am still not sure what this did, but it corrected my thermistors from reading about 20 degrees too high).
#define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0))
to a value of 0.128. This was the value in Sprinter. I might try changing back in the next print to see what happens.
For my pre-configured hot-end I used
Mendel Parts V9 on 12V settings
for the hot-end I bought from MixShop.com.
The mechanical endstops are defaulted to ON in this build of Marlin. To change the default to off change
const bool X_ENDSTOPS_INVERTING = false
to true for X, Y, and Z.
To set the directions correctly I have the following settings, your settings may be different depending on your build. You can invert them easily by changing true/false.
#define INVERT_X_DIR false
#define INVERT_Y_DIR false
#define INVERT_Z_DIR true
#define INVERT_E0_DIR false
#define INVERT_E1_DIR false
#define INVERT_E2_DIR false
To calibrate your machine, you will adjust the values in
I will have a following post showing the calibration of a Prusa Mendel. For now if you leave them as is it should be fine. My X and Y were pretty close and my Z was off quite a bit (probably because I have 5/16" not M8 threaded rods).
Save your updates and you are ready to upgrade your Arduino firmware.
4. Now that your Marlin firmware is ready for your Prusa Mendel; compile the code by choosing the verify button (checkmark) and provided you didn't make any mistakes, it should compile with no errors.
It is now time to update the firmware, the process takes about 10-20 seconds . Choose the update button (arrow) to upgrade. Some LEDs on your board will blink during the process. When the process is complete, you can exit Arduino IDE.
5. Now to test your new firmware. Open Printrun (pronterface) and ensure the port (dev/tty.USB) and baud rate (250000) are set. Click connect and the connection with the printer will establish. Check the Monitor Printer box if you would like to see the temperatures plotted in real time.
You can test each of the axes by first trying small movements in each direction and then moving up. Make sure not to go too far! Try extruding a small amount and retracting. You can turn on the hot-end and printbed (start with low temperatures) and monitor everything is operating as desired.
In my next 3D Printing post I will discuss the pre-calibration (before printing) of the X, Y, Z, and E axes and how to set software endstops for the maximum ends of your axes.