This page is instructions for compiling your own firmware. If you're just trying to use a ready-to-go printer, go to the calibration page instead.
I will cover a lot of topics in this area that are related but some of them are not necessary to get started. You can return here later to expand your knowledge.
I’m only covering the “Marlin” firmware variant here. There are others but that’s what I use. It’s among the better firmwares available now.
Setting up the software
RepRap printers use a small board with a CPU on them made by Atmel. They are programmed using an open source development environment called “Arduino” using the “C” programming language. You don’t really have to know any C to get started, or even really anything about programming, because the software is all written. However, you do need to use the programming environment and edit a few values during calibration unless your supplier set up the firmware with the correct values to start with.
I assume you have basic skills - you can run Windows apps, can deal with ZIP files, aren't afraid to muck around in driver settings and such.
What you do next depends on which electronics you're using.
- RAMPS with Arduino Mega 2560
This is the most common way to go these days (late 2013) - price drops have made it price competitive with the others and you don't have to do any fiddling around with weird setups to get advanced stuff working. There is no special setup for the Arduino 2560, it's fully supported and has plenty of memory for any feature you want. You can use the latest Arduino release - 1.0.5 or whatever is new now.
- Sanguinololu WITHOUT LCD
Sanguino based RepRap electronics require you to use a 3rd party set of configuration files plugged into the Arduino software. I recommend sticking with the 0023 release for this, NOT the latest 1.x or higher releases.
- Sanguinololu WITH LCD
If you are using Sanguinololu and want to use an LCD panel, this gets more complicated. The standard 644 chip does not have enough program space to hold the LCD driver code. You need to use an ATMega1284P chip which is almost exactly the same as the 644 chip but has more memory. To use it you'll need to use Arduino versions 0022 or 0023
Go to this page on getting the Arduino environment set up and other things you may have to do, then come back here and proceed.
A lot of stuff in the RepRap community runs on Python. Download this file, then install each of the four things in order. The stuff is compiled for those specific version so don't go grabbing more recent versions unless you know what you're doing.
Pronterface is a simple app that gives you control over your printer, allowing you to move the motors, control temperature and print things. It's a good app to use to calibrate things. Download the "printrun" software here: https://github.com/kliment/Printrun using the "download ZIP" link in the lower right. Unzip the file somewhere like "c:\reprap\". Go to this directory and run "Pronterface.py" - if you've installed the python stuff above it will run and come up with a control panel. You don't need this until later, close it.
Get the firmware
Your electronics provider may have a location to download the firmware from. If not or if you just want to get the latest stuff, Marlin is hosted at https://github.com/ErikZalm/Marlin/ - go there and click the “ZIP” button at the top of the page.
Unzip that in a good location like C:\reprap\firmware
Start the Arduino IDE. Select the correct board in Tools/Board – for RAMPS people, Arduino Mega 2560. For Sanguinololu, Sanguino 644p or 1284p 16 MHz. Select the correct COM port in Tools/Serial port – if you have more than one and don’t know which, close the Tools menu, unplug the board, then look again and see which port just went away. Close the Tools menu again, plug it back in and select the COM port that just re-appeared.
Use File/Open to open the “Marlin.pde” file in the location you saved the firmware. If you are running Arduino 1.x it will ask to convert the project. Go ahead and do that. That opens up all the files in the project.
All the configuration happens in “configuration.h”. Here are some that I have compiled up already, if you find your configuration here you can use these:
- configuration.h for Sanguinololu/i3
- Sanguinololu electronics, no HPB, 20 tooth GT2 timing belts, M5 x 0.8mm z drive, JHead hotend, Wade's extruder, 200 step / 16x microstep motors, hall Z stop, mechanical x/y stops
If you need to modify configuration.h, read on. Things you will be interested in:
- BAUDRATE – probably 250000 though that’s up to you.
- MOTHERBOARD – there’s a list, change the #DEFINE MOTHERBOARD value to whatever you’re using. Probably 62 for Sanguinololu users.
- TEMP_SENSOR_0 and TEMP_SENSOR_BED – set to 1, I think everyone is using the EPCOS 100k thermistor.
- HEATER_x_MINTEMP – Heater 0 and bed (if you have a heated print bed) leave set to 5, set the others to 0. If you don't have a heated print bed, set that to 0 as well.
- X_ENDSTOPS_INVERTING – Leave these alone at first, switch them if the motors run backwards (or just flip the connector around on the motor).
- DISABLE_Z true – I really recommend this. There’s no reason to keep the Z motors powered up most of the time.
- INVERT_x_DIR – you’ll need to tweak these if your motors are running backward on any axis
- DEFAULT_AXIS_STEPS_PER_UNIT – This is the big one. See below for calculating these values
When it's done uploading, start Pronterface to test. You’ll almost certainly have to go back to configuration.h several times to get the motors running in the right direction and other things, so don't close Arduino just yet.
Testing your electronics and wiring
Start pronterface. Select the correct serial port and baud rate (probably 250000). Hit "Connect". The right hand panel should read "Printer is now online" - and possibly a ton of other stuff. If not double check your com port and speed.
Turn on power to the printer. We're going to do one axis at a time. Be ready to flip off the power if the motors start doing something unfortunate. It doesn't hurt the motors if they bang against the far end but it's irritating.
Warning: Do not plug motors in and out of your electronics with 12V power applied. You can burn out a motor driver doing that.
Start off by hitting "Home X" in the upper left of the bullseye. The X carriage should start to move towards the endstop (on the left) and stop, reverse twice and stop.
- If some other motor moves instead, then you have the motors plugged in to the wrong port. Shut down and change the wiring.
- If the motor only moves a little (possibly to the right) then stops every time you hit Home, your endstop could be wired wrong or is stuck - try holding down the endstop switch and hit home again - if it now moves then you might have wired to the "Normally Closed" side of the switch - power down and fix this.
- If the motor moves in the wrong direction, you need to either change the configuration.h file or (easier) power off, flip the motor connector around, and try again.
- If the motor crashes past the endstop and doesn't stop, it's possible your endstop isn't plugged in to the wrong endstop position, or it's wired wrong (like, wires to NC and NO instead of COM and NO). Stop and double check your wiring.
Once the X axis is working correctly, do the same with the Y.
Now do the same with Z except start with the Z endstop a few inches off the bed. You don't want to crash the head into the glass and break it. Once you have it stopping properly with the Z axis you can leave it until calibration and levelling.
These values tell the printer how many pulses it needs to send to the stepper motors to get them to move a millimeter. The best way to determine this is to calculate the values.
WE ALWAYS WORK IN MILLIMETERS. It’s theoretically possible to work in any unit you want, but the entire world is uploading objects in metric. Set your printer up in furlongs if you want but you’ll be fighting the rest of the world constantly.
First, determine how many step pulses will make your motor turn one revolution. Most people use 1.8 degree per step motors which means 200 steps per revolution. HOWEVER most people are also setting their motor controllers to 1/16 microstepping, which means that they have to pulse the controller 16 times to get the motor to move one full step. That means that you have 200*16 = 3200 steps per revolution.
Now you have to calculate how far your axis moves for one revolution. For our example, let’s do the X/Y axis with GT2 belt using 20 tooth pulleys. The GT2 belt that we use has a 2mm pitch per tooth, so one revolution is 20 * 2 = 40mm.
Now divide it out. 3200/40 = 80 steps per millimeter. That’s what you would use for X and Y axes for that setup.
On the Z axis, we probably have the same 3200 steps per revolution, but that revolution makes us go one thread on the rod. Assuming you’re using M5 x 0.8 thread per mm rod, one revolution will move the Z axis 0.8mm, so our value is 3200/0.8 = 4000 steps per millimeter
For the extruder, you can’t really just calculate the value. You need to have the extruder unmounted. Put a value like maybe 700 in there and compile and upload the firmware. Start Pronterface, load filament into the extruder and advance it by hand until it is just flush with the extruder surface. Tell it in Pronterface to extrude 100mm of filament. Measure how much actually comes out, then multiply your made-up value by the difference. For example, if you put in 700, and actually got 77 mm of filament instead of 100, then change the value to 700 * (100/77) = 909.1. Feed that back into the configuration, upload and test again. You should be on the money now.
Finally, do a sanity check in Pronterface. Home the axes and put a ruler down on the bed near the printhead, then hit +100mm on X, make sure it moves 100mm. Move the ruler and check the Y in the same way. Then hit +10 on Z and see if it moves kinda about 10mm (you can measure more accurately if you have a dial indicator)
When you get your printer running, print a calibration test object from Thingiverse. A good first one is the Better Nickel Calibration Test, http://www.thingiverse.com/thing:11261 - print it, see if a nickel fits perfectly in there.