M2 Technical Guide

M2 system description

The M2 is a 3D printer - it uses multiple stepper motors to move a platform and extruder head, and draws in a strand of feedstock to be melted and "extruded" through a hot nozzle. The specific implementations and some basic notes on the various components will be described below.

Motion

Motors

The M2 uses four stepper motors - two with attached pulleys that drive a belt, which in turn moves the X and Y carriages; one with an integral leadscrew that drives the Z stage; and one with an attached 5.18:1 planetary gearbox (for increased torque) with an attached gear, to grip and move the filament.

All four stepper motors rotate 1.8° per full step (for 200 full steps per full revolution). The stepper motor driver chip on RAMBo divides each full step into 16 "micro"steps; all firmware steps/mm values are actually for microsteps/mm.

The standard steps/mm calculation is: (([full steps per rotation]*[microsteps per full step]) / [distance traveled in a full rotation]) * [gear ratio]. The distance traveled in a full rotation is equal to the circumference of a pulley, or the pitch of a leadscrew. The gear ratio, unless otherwise stated, is 1:1, so can be omitted from the calculation.

The X and Y motors are standard, 1.8°/step stepper motors, that have belt pulleys with a GT2 profile and 18 teeth. A GT2 pulley with 18 teeth will have a circumference of 36mm, so one full revolution of the pulley will drive the mated belt 36mm. So 200 full steps = 3200 microsteps = 1 full revolution = 36mm. The firmware uses values of [micro]steps/mm, so the firmware value is (200 * 16) / 36 = 3200 / 36 = 88.89 steps/mm (88.88888888 repeating - 88.88 and 88.89 are both acceptable, though 88.89 is slightly closer).

The Z motor is a standard, 1.8°/step stepper motor, with an integral, four start 8mm pitch leadscrew with a metric trapezoidal thread. Four start means that there are four individual threads along the length of the leadscrew; 8mm pitch means that the center to center distance of the thread is 8mm (or, in our application, that a nut mounted on the leadscrew will be driven 8mm for one full rotation of the leadscrew). So 200 full steps = 3200 microsteps = 8mm. The firmware uses values of [micro]steps/mm, so the firmware value is 3200 / 8 = 400 steps/mm.

The Extruder motor has a standard, 1.8°/step stepper motor base, with an attached 5.18:1 planetary gearbox. Ignoring losses, the gearbox increases torque and decreases speed by a factor of 5.18:1. As stepper motors do not have a set speed, but instead deal in degrees (°) rotated, the distance the output shaft rotates is actually decreased by a factor of 5.18:1 (compared to the base motor shaft). The standard extruder drive gear, which is the part that actually "bites" into the filament, gripping it and allowing the motor to push the filament down into the extruder, has a diameter of ~10.8mm across the peaks of the teeth. The naive but close approach to calculating extruder steps/mm is to take the outside diameter of the gear, and plug it into the standard formula shown above: 3200 / (10.8 * pi) = 3200 / 33.929 = 94.314. With the 5.18:1 gearbox accounted for, that becomes 94.314 * 5.18 = 488.547 steps/mm. With some calibration and experimentation, we have found that an extruder steps/mm value of 471.5 works well. This implies an effective diameter of the drive gear of ~11.19mm, which most likely comes from the filament itself offsetting the effective circumference.

« Side note: though the original math and process are lost to the aether, I believe the actual original process used the naive approach above, but with a gear ratio of 5:1. This results in a value of 471.57, so may have been the actual original source of that value, and experimentation verified that it worked. »

Linear motion

The M2 uses two different linear motion systems: precision linear rails with ball bearing carriages, driven by belts, for X and Y; and precision ground rods with ball linear bearings, driven by the Z leadscrew, for Z.

The X and Y rails are bolted to the top plate and Z stage, respectively.

The X carriage has the X motor plate on top, with the Extruder Motor Mount mounted on top and through the X motor plate. The X motor plate carries the X endstop trigger, and the X belt clamp (which grips the X belt securely, transferring the motion of the belt to the carriage and thus extruder); the Extruder Motor Mount holds the Extruder motor (which in turn has the hotend mounted to it) and the Extruder harness.

The Y carriage has the steel spider mounting plate mounted on top of it. The spider mounting plate carries the Y belt clamp (which grips the Y belt securely, transferring the motion of the belt to the carriage and thus bed), and the aluminum spider (which then has the rubber corner clamps and HBP on top of that).

The flanged Z ball linear bearings mount to the Z stage, one in the front, one in the back, on the left side. Between the two flanged bearings is mounted the Z leadscrew nut, through which the Z leadscrew threads; with the Z motor attached to the frame, and the two smooth rods and Z leadscrew through the Z stage, turning the Z leadscrew will drive the Z stage up and down.

Coordinate system

The coordinate system of the M2 is defined in terms of motion of the nozzle relative to the bed; X is easy, in that -X is the nozzle moving to the left, and +X is the nozzle moving to the right. Y and Z are counter-intuitive, however - when the bed moves towards the rear of the printer, it's actually -Y; likewise, when it moves towards the front of the printer, it's actually +Y. When the bed moves up, it's -Z (as the nozzle is approaching the bed); when the bed moves down, it's +Z.

The front left corner of the bed, with the nozzle touching, is (0,0,0). The rear right corner of travel (not just the bed size constraint) with the bed all the way down is approximately (210,255,210).

The extruder is the final "axis" - movement commands are the same as the other axes, though the extruder can move an arbitrarily large distance in either direction, with no absolute reference point.

For all axes, if the direction of travel is backwards, it's most likely due to the motor being plugged in wrong to the stepper motor driver. Powering down the printer, unplugging power, and rotating the connector in question 180° should resolve the issue.

Temperature

Heaters

The M2 uses two different styles of (intentional) heaters - a cartridge heater (consisting of nichrome wire wound around a form, inside a ceramic and metal cartridge) in the hotend, and a silicone heater pad (consisting of a circuit cut from a thin sheet of metal, most likely steel) for the bed.

The cartridge heater for the hotend is inserted in the aluminum heater block. The stock M2 cartridge heater has a rating of 40W at 24V, so a resistance of ~14.4Ω. The hotends have a max temperature of 250°C.

The silicone heater for the heated build platform/"bed" has a resistance of ~3Ω, so at 24V provides ~192W of heating power. The moderate insulation provided by the silicone, and the general exposure to the air and conduction to the glass bed (with the aluminum heat spreader between the heater and the glass) combine to limit the max temperature with ideal circumstances to ~125°C, with 110-115°C being a more reasonable limit.

Sensors

The HBP and hotend use the same thermistor - 100kΩ±1% (at 25°C) with a beta value of 4072K±1%, with a 3mm metal case. A thermistor is an resistor that has a change in resistance with a change in temperature (to be precise - all resistors change resistance with temperature, but a thermistor is engineered to have a large, consistent and precise change). The RAMBo uses a circuit to read the resistance of the thermistor and compare that value to a table of resistance-temperatures.

Control

The temperature of the hotend and bed are controlled by the electronics through the use of a MOSFET, which in this case, is used basically as an electronic switch - when voltage is applied to one part of the MOSFET, current is allowed through another part of it; we use a signal from the microcontroller as the control/input, and voltage running to the heaters as the output, of the MOSFET.

The bed is generally run in "bang-bang" mode, due to the slow response of the bed heater - essentially, the bed heater is active (fully on) until it reaches the set point, and then is turned fully off until it drops a slight amount below; it is then turned back on until it reaches or slightly exceeds the setpoint, and the process repeats.

The hotend is generally run with software PID (proportional integral derivative) which is basically a method of calculating how much power to apply to the heater to allow it to "coast" into the setpoint, and once there, apply lower amounts of power to keep it at the setpoint. The varying power is applied with a method called PWM (pulse width modulation) - essentially, the MOSFET is switched on and off rapidly (several hundred to several tens of thousands of times per second), and the proportion (of either length or number) of On time segments to Off time segments controls the average power the hotend heater receives. PWM is covered more in the Fans section below, as direct control of the heater PWM power is dangerous and not easily accessible.

Fans

3D printers have an interesting set of requirements, in that certain areas of the printer need to be kept quite hot (the extruder at 180°C+, bed at 60°C+), others generate heat naturally as a side effect of their function (all of the motors and the electronics), and some need to be kept as cool as possible (the filament drive, extruder drive gear and the black V3 PEEK insulator on the hotend, for the extruder; and the electronics). Certain materials also need to be cooled after they are extruded, to prevent heat build up from causing the printed part to warp (PLA especially). To help with all of these cooling needs, the M2 has three fans - two 40mm fans (one mounted in the electronics case, sucking air in; and one on the extruder, blowing air over the filament drive, extruder drive gear and top of the black V3 PEEK insulator), and one 50mm fan (mounted at an angle to blow onto the part being printed).

The two 40mm fans are wired in series, and connected to the Fan1 header on RAMBo; they can be controlled with the manual Gcode command "M108 S*". The * in that command represents the set PWM point, where the power is approximately (*/255) percent - so S255 is 100% power, S128 is ~50% power, S0 is fully off, etc. The firmware is set by default to ignore values other than S255 or S0, as the two 40mm fans in series may not run at all speeds, and they serve an important function.

The 50mm bed fan is connected to the Fan0 header on RAMBo, and is controlled with the manual Gcode command "M106 S*"; same as with the 40mm fans, the * in that command represents the set PWM point, where the power is approximately (*/255) percent. The 50mm fan actually responds to all values between 0 and 255, though - so S255 will turn it on full power, S0 will turn it off, and values in between will vary. Depending on the individual fan and the local environment, the fan may fail to start or continue running at certain speeds.

Extruder

The extruder consists of all of the parts that are directly responsible for either moving or melting the filament. This includes the extruder motor (with gearbox and drive gear), the filament drive and the hotend. As the most complex assembly, and encountering the most extreme forces and temperatures, the extruder is the most common cause of trouble on many 3D printers.

Extruder motor

As touched on above, the extruder motor is a standard 1.8° stepper motor with a pinion gear that mates with a 5.18:1 planetary gearbox bolted onto the front of the motor base. A drive gear is attached with a setscrew to the output shaft of the gearbox. This drive gear is the part that actually bites into the filament - the filament drive (below) guides the filament in, and holds an idler bearing that the drive gear presses the filament against while extruding.

Filament drive

The filament drive is the printed part that mounts to the face of the extruder motor gearbox, and guides the filament between the idler bearing and drive gear. The filament drive also has a slot (our classic "groove mount") for holding the hotend.

Hotend

The hotend is composed of multiple parts - the brass nozzle and barrel, the aluminum heater block (with cartridge heater and thermistor inserted), and the V3 black PEEK insulator. The V3 PEEK insulator is actually an assembly of the black PEEK insulator, the beige PEEK cap, the PTFE insert, and two steel dowel pins. The brass nozzle is tightened onto the barrel; the aluminum heater block is tightened down against the top flat surface of the nozzle; the barrel is then tightened into the threaded PEEK insulator, until it butts up against the bottom surface of the PTFE insert, inside the PEEK insulator. This interface needs to be very secure, as otherwise molted filament may squeeze between through the gap, causing extrusion trouble and even hotend leakage.

Extrusion

The entire extrusion process consists of heating the hotend up to your extrusion temperature, and then commanding an extrusion move; this will cause the extruder motor to rotate, which will be converted through the gearbox to rotation of the extruder drive gear. As the extruder drive gear turns, it will bite into the filament that's loaded through the top of the filament drive (while simultaneously pulling it through the extruder guide tube and off the filament spool), squeeze it between the idler bearing, and push it down into the "cone of acceptance" which then guides the filament into the bottom filament path; from there it enters into the top section of the PTFE insert, further down into the brass barrel where it melts, and then finally out through the nozzle. The actual location where the filament melts depends on hotend temperature, barrel temperature/cooling, and filament type - ideally the filament should melt as close to the nozzle as possible, as the force required to push the filament increases as the filament softens and goes "plastic". The general melt location, however, is near the top of the barrel, below the PTFE-barrel interface.

As you can see from the above, there are quite a few different locations where extrusion can be hindered. An incomplete list:

The filament can get bound up on the spool, especially if it was allowed to cross over itself as it was beeing spooled.

The diameter of the hole through the filament drive, barrel and PTFE insert in the PEEK insulator, is 2mm - filament over 2mm will get caught somewhere in that path.

The extruder drive gear has sharp teeth to bite into the filament, however, these teeth can instead grind away at the filament if the filament is obstructed elsewhere (hotend clogged/not hot, filament bound on the spool, filament caught in the filament drive due to incorrect diameter, nozzle too close to the bed or previous layers so can't actually extrude, etc.), or if the idler bearing tension is too loose (drive gear cannot get a strong enough purchase, so instead grinds away the small amount of filament it comes into contact with) or too tight (filament isn't flexible enough to squeeze between the drive gear and idler, but the extruder motor is powerful enough to continue driving the drive gear, grinding away at the filament). When this happens you'll often find filament debris/shreds littering the inside of your filament drive, and often stuck in the teeth of the drive gear.

It's also possible for the required extrusion force to be too high for the extruder motor to provide (again, due to idler tension or other filament feeding obstructions), but the filament is also too strong for the drive gear to grind it away; in this situation, you'll often hear the extruder motor "clunk", and/or see the drive gear rotate a bit and then "bounce" back.

The hotend is a press fit into the filament drive, and should have a point where it "snaps" in; if the fit is a bit loose, the hotend installation isn't correct, or the hotend shifts in the filament drive, the hole through the PTFE insert can be misaligned from the bottom filament path hole. If this happens, the filament will get caught on the top surface of the PTFE insert, generally leading to the drive gear grinding away the filament as above.

If the temperature of the PTFE-barrel junction is too high, the filament can start to soften or melt too high in the barrel, which can then lead to the filament leaking into the PTFE-barrel junction, creating a gap; this can cause general extrusion trouble (that zone of melted filament increases the extrusion force) or even filament leaking (where the filament fully leaks through the PTFE-barrel gap, and down through the barrel/PEEK insulator threads). The 40mm fan on the extruder is there partly to defend against this failure mode by cooling the PEEK insulator.

The hotend temperature can be incorrect, either too cool (so the filament isn't warm enough to actually extrude through the nozzle, or would require more force than the extruder motor can provide) or too hot (the temperature of the PTFE-barrel junction will be too high). It's also possible for the thermistor to be giving either an incorrect reading (thermistor has failed open [will read ~359°C], short/closed [will read 0°C], or somewhere in between [reading will not change with temperature, or will be offset]) or a reading not consistent with the actual heater block temperature (thermistor has pulled out of the heater block, or has very poor thermal connection to it) - an outright thermistor failure will prevent printer operation at all (the firmware will not allow motion if the hotend temperature is below 5°C or above 275°C; nor allow extrusion below 170°C), or will contribute to print failures (i.e. the firmware thinks the hotend is at 220°C but it's actually at 180°C, which is too cool for that filament).

The nozzle itself can be obstructed: poor quality filament can have inconsistent/incomplete mixing or contaminants, which can build up in the nozzle over time; if the filament is at all abrasive, it can grind away at the nozzle; if the filament is kept in a particularly dusty location (or left out in a normal area for more than a couple weeks) dust can build up on the surface of the filament, which can then get into the barrel/nozzle and build up, again obstructing the nozzle orifice.

Print surface

The print surface of the M2 is a piece of borosilicate glass, clipped to the top of the aluminum heater spreader (which has the bed heater adhered to the bottom). For both PLA and ABS we recommend using a layer of polyimide tape on top of the glass. Bed temperature for PLA is generally 60-70°C, and for ABS is generally 100-110°C.

Electronics

Power supply unit (PSU)

The PSU that ships with the M2 is a 24V, 18.8A switch-mode power supply: Meanwell SE-450-24 . The PSU ships prewired and tested. Before first plugging it in, the AC voltage input switch should be checked, to verify that it is on the correct setting for the local AC supply - in the United States that's 115V, while many European countries require the switched to be set to 230V.

The output of the power supply is cable containing three circuits running in parallel off the output of the PSU, running to a Molex connector. The pin arrangement, with the screw terminals of the connector up and the wires extending towards the observer, is:
[+24V - + - + -] . The three circuits power different sections of the RAMBo (covered below).

RAMBo

The electronics board that controls the M2 is RAMBo, by Ultimachine.

Stepper Motor Drivers

RAMBo has 5 stepper motor driver chips onboard, and 6 stepper motor headers (one for each X, Y, Extruder0 and Extruder1; two for Z). Each stepper motor driver works by receiving three signals from the RAMBo processor - enable (to turn the stepper motor on or off), direction (to determine if the motor will spin clockwise or counter clockwise), and step (which tells the chip to perform one step). The stepper drivers then put voltage out on the four pins of the stepper motor header, which run to the stepper motor to be controlled.

Stepper motors work by having two coils inside, each of which runs, essentially, to an electromagnetic gear with internal teeth; the motor shaft/rotor has permanent magnet "gears" that match the profile of the electromagnets. The two electromagnetic gears are offset by 1.8° - by turning one coil on, the rotor gears are more attracted to that coil and thus move to be in alignment with it. This is a full step. Microstepping (which is handled by the stepper motor driver chips) is achieved by activating both coils with a proportion of the total allowed current - if coil A has 75% of the current and coil B the other 25%, the rotor will be stuck between the two full steps, at 75% of a full step, towards coil A.

The above explanation is at the same time both overly-complex and over-simplified; see http://en.wikipedia.org/wiki/Stepper_motor or similar for better.

The stepper motor drivers on RAMBo also have firmware control over the set current, as the voltage reference comes from a digital potentiometer.

MOSFETS for Fan and Heater Control

RAMBo has 5 or 6 (depending on the board revision) MOSFET outputs. These are separated into two separate circuits - the Heat2-Bed MOSFET is protected by the large blue 15A automotive/ATC fuse, and is powered by the rightmost PSU circuit. The other MOSFETs are all protected by a 5A SMD fuse in a small beige holder on RAMBo, and powered by the center PSU circuit.

All of the MOSFETs function similarly - there's nothing (beyond fuse rating) that determines whether a MOSFET can run a fan or a hotend, though convention and the board label should be followed for consistency.

Thermistors

RAMBo has 4 thermistor inputs. Each thermistor input consists of a small circuit that uses a voltage divider network to measure the resistance of the thermistor attached. As a thermistor's resistance varies significantly and (mostly) linearly with temperature, some simple math can determine the thermistor temperature from the resistance.

Endstops

RAMBo has 6 endstop inputs, each consisting of +5V, Ground and a signal pin. We use the three MIN endstops - X-MIN, Y-MIN and Z-MIN. X and Y have Normally Open switches between their signal pin and Ground; Z has the same switch, but with an LED added between the extra +5V pin and the switch/Ground. In all three cases, the signal pin is put High (+5V); when the switch closes, it connects the signal pin to Ground, so it now reads Low. The firmware takes this signal and uses it in the motion control.

SD Reader

The SD reader is a smaller carrier board that breaks out the pins of a SD card, as well as providing some level-shifting. The RAMBo and firmware communicate with the SD card itself through the SPI protocol.

Processors

RAMBo has two microprocessors: an Atmega32u2 which primarily handles the USB-serial conversion, and an Atmega2560 which does all the heavy lifting of running the firmware and peripherals.

Firmware

The stock firmware for M2 and RAMBo is Marlin, specifically an older, but well tested, version. This section will cover the basics of understanding and configuring the firmware.

Basic Structure

The basic structure of the firmware is one main Marlin.pde (or .ino) file, that loads ("includes") all of the other files. The main Marlin file contains all of the acceptable Gcode commands. Most configuration values are in the files configuration.h and configuration_adv.h . Pin definitions (which the firmware uses to abstract the specific pin number from the main functions, so that the firmware can be run on many different electronics configurations with only a simple change in a file) are in pins.h . Thermistor tables (which are used by the firmware to quickly and accurately convert the resistance of the thermistor to a temperature) are in thermistortables.h . Most of the other files are named to reflect their general function, but won't be of major concern.

Pin definitions

All pin definitions (save the 40mm fans, which are addressed below) are in pins.h . Depending on the specific firmware version, the section for RAMBo will either be labeled RAMBo or Ardurap (the prototype name for RAMBo).

Thermistors

Thermistor tables are in thermistortables.h . We use table 1 (100k thermistor, EPCOS compatible) for all thermistors. These tables provide a quick way for the firmware to take the thermistor resistance (or to be more precise, the ADC value of a reading the thermistor resistance) and look up the corresponding temperature.

EEPROM

The Atmega2560 has 4KB of EEPROM (electrically erasable programmable read only memory) in which the firmware can store settings. The Gcode commands M500, M501, M502 and M503 are used to control the storage and reading of EEPROM settings:

There are three different statuses for settings - either in EEPROM, in the firmware, or temporarily set (with, for instance, M92). EEPROM settings are loaded when the firmware resets; temporary settings are lost when the printe resets, unless written into EEPROM; firmware settings are the default EEPROM settings the firmware was compiled with, and an always be recalled.

M500 stores the current settings in EEPROM

M501 will read out the currently stored settings in EEPROM and applies them, but does not write to EEPROM again (which doesn't matter, as they're what's written anyway)

M502 will read out the default EEPROM values compiled in the firmware and apply them temporarily; sending M500 will set them in EEPROM, effectively reseting the firmware to its "factory state"

M503 will print out the current settings in use; if there's been no modification, these will be identical to the EEPROM settings.

Configuration.h and Configuration_adv.h

Configuration.h contains most of the settings you'll want to modify during calibration and experimentation.

baudrate is the serial communication speed; 115200 works and is well supported and quite stable, though 250000 is generally not a problem.

TEMP_RESIDENCY_TIME time the firmware will wait once the set temperature is within the TEMP_HYSTERESIS window of the setpoint - if you send "M109 S210" the firmware will then heat up to 210°C; at 207°C it will start a 10 second countdown, after which the next command in the buffer will execute.

MINTEMP and MAXTEMP settings are for thermistor or heater failures - MINTEMP values of 5°C will throw an error if a thermistor reads 0°C (the most common value for a failed thermistor); MAXTEMP values of 275°C will throw an error if the temperature is above 275°C, which is approaching the thermistor temperature limit and well past the stock V3B hotend limit.

PID settings are what control the heating profile of the hotend. PID_MAX is the maximum power that will be applied to the heater. DEFAULT_ Kp Ki and Kd are the default PID values for our hotend. See PID below.

PREVENT_DANGEROUS_EXTRUDE will prevent the extruder from running if the hotend temperature is below 170°C or the commanded move is longer than (X_MAX_LENGTH+Y_MAX_LENGTH). The temperature restriction can be temporarily disabled by sending the command "M302".

min_ and max_software_endstops will prevent moves that go lower than HOME_POS (set to [0,0,0] below these values) or higher than the MAX_LENGTHs defined below.

HOMING_FEEDRATE is an array of values of the homing feedrates of the four axes, written in (n*60) format, as the values need to be in mm/min, but for short moves it's easier to think in mm/s. So the actual homing speeds are 3000mm/min for X and Y, and 900mm/min for Z. The extruder cannot Home.

DEFAULT_AXIS_STEPS_PER_UNIT is an array of the default steps/mm values for the axes. The default values were calculated and experimentally verified/tweaked.

DEFAULT_MAX_FEEDRATE is an array of the default max feedrate (speed) of the axes, in mm/s.

DEFAULT_MAX_ACCELERATION is the default max acceleration value for the axes in mm/s/s.

DEFAULT_ACCELERATION is the default acceleration value used for all moves on all axes, unless limited by MAX_ACCELERATION or commanded lower.

DEFAULT_*JERK are the largest speed changes that can occur without acceleration from current speed to new - if you are going from 0mm/s to 20mm/s in X or Y, the change will be done without acceleration. Likewise from 80mm/s to 100mm/s. 80mm/s to 110mm/s will use acceleration, however.

MICROSTEP16 is the microstepping setting in the firmware, for RAMBo. Acceptable values for most versions of RAMBo are MICROSTEP(1|2|4|16). The firmware does not automatically adjust the steps/mm value if you change the MICROSTEP value, so you'll need to manually change the steps/mm values to (n/16|n/8|n/4|n/1) respectively (using the default steps/mm values).

*_CURRENT are the stepper motor current settings. These values set the digital potentiometer that acts as a sense resistor for the stepper motor drivers.

EEPROM_SETTINGS allows the storage of settings in EEPROM.

SDSUPPORT allows the use of the SD card.

Configuration_adv.h contains some settings that may be interesting to play with.

EXTRUDERS the actual location to define a second extruder.

ENDSTOPS_ONLY_FOR_HOMING will disable the endstops if defined - this means that if pressed while printing, the endstop will not "read". Commenting this out will cause the printer to stop moving in that direction is an endstop is pressed.

*_HOME_RETRACT_MM is the distance the defined axis will move out from the endstop when it presses it while homing, and then move back slowly and press it again.

DEFAULT_STEPPER_DEACTIVE_TIME is the default time that the motors will be disabled after, if left idle.

dropsegments is the minimum number of [micro]steps to be considered a discrete "move"; if smaller, it will be joined to the next movement.

Gcode

Gcode is the communication language/protocol used by the firmware and software to communicate. http://reprap.org/wiki/G-code has a general list of Reprap style gcode, though looking through the Marlin main file you actually use is best, as there are implementation differences.

G0/G1

G0/G1 is the basic movement command that makes up the bulk of most prints. G0 is treated the same as G1 (in Marlin; officially, G0 moves as fast as possible in the firmware, but Marlin doesn't support that). A full G1 command looks like this:

"G1 F3600 X14.28 Y99.43 Z1.75 E3.58"

This command will move from the current location, to (14.28,99.43,1.75) while moving the extruder to 3.58mm (of filament extruded), at a speed of 3600mm/min. These values are all "sticky" - if not defined, the previous value will be used. So from that location:

"G1 X20.52 Y82.87 E3.98"

That command will then move from the previous location, to the new location of (20.52, 82.87,1.75) while moving the extruder .4mm (so extruding .4mm of filament), at a speed of 3600mm/min.

Placing the Fn value before the axes will cause the entire move to be performed at that speed; placing the Fn value after the axes will cause the entire move to start at the previous speed while accelerating (up or down) to the new speed.

G4

G4 is a dwell or wait command. "G4 S10" will wait 10 seconds before continuing; "G4 P800" will wait 800 milliseconds (0.8 seconds) before continuing.

G28

G28 will home all axes in X Y Z order. Specifying only one or two axes will only home that axis - so "G28 X" will only home X. Once the axis has hit the endstop (and retracted and hit again), the firmware will call that point 0 for that axis.

G90/G91

Switch between using absolute (G90) and relative (G91) coordinates. In Absolute, "G1 X10" will move the X axis to 10mm. In Relative, "G1 X10" will move the X axis +10mm from its current location.

G92

"G92 Xa Yb Zc Ed" will set the current position of the given axis to the given number (a b c or d). Most frequently used to "zero" the extruder by sending "G92 E0". Can be used to "trick" the firmware - for instance, after starting a print and letting it home, you can manually shift the print 10mm to the right by sending "G28 X" to home X again, then telling it that it's actually at X-10: "G92 X-10".

M104/M109

"M104 Sn" will set the current hotend (or only hotend on a single extruder machine) to n°C. "M109 Sn" will do the same, but will block all other motion and commands until the set point n has been reached.

M140/M190

"M140 Sn" will set the bed to n°C. "M190 Sn" will do the same, but will block all other motion and commands until the set point n has been reached.

M105

Read the current hotend and bed temperatures and setpoints, as well as hotend power.

M106

As covered in Fans above, "M106 S255" will turn the 50mm bed fan on full power. S0 will turn it off. S values between 0-255 will apply (n/255)% power, though values below S240 may not enable the fan.

M108

As covered in Fans above, "M108 S255" will turn the 40mm electronics case and extruder fans on full power. S0 will turn them off. Turning the fans off is strongly recommended against while heating or printing.

M84

Disable steppers. Sending "M84 Sn" will set the stepper deactivate time to n seconds - so "M84 S60" will cause the motors to disable after one minute of inactivity, S300 10 minutes, etc. S0 will disable the inactivity timer completely.

M92

"M92 Xa Yb Zc Ed" will temporarily change the steps/mm values of the given axis to the given value (a b c d). "M92 En" is useful during calibration, so you can experiment with different E steps/mm values while "walking in" your calibration. "M92" will read the current values. "M500" will write these value to EEPROM.

M114

Read the current position of the axes.

M119

Read the current status of the endstops.

M201

"M201 Xa Yb Zc Ed" will temporarily change the max acceleration of the given axis to the given value (a b c d). Units are in mm/s/s. "M201" will read the current values. "M500" will write these values to EEPROM.

M203

"M203 Xa Yb Zc Ed" will temporarily change the max feedrate of the given axis to the given value (a b c d). Units are in mm/s. "M203" will read the current values. "M500" will write these values to EEPROM.

M204

"M204 Sn" will temporarily set the default acceleration to n mm/s/s. "M204" will read the current value. "M500" will write this value to EEPROM.

M206

"M206 Xn Yn Zn" can be used to set an offset from the endstop for the coordinate origin. On the M2 Rev E, this is used for setting the nozzle to bed gap. The current setting can be checked by sending an M503 while the printer is connected. This appears as a line like this:
M206 X:0.0 Y:0.0 Z:8.53
On the M2 Rev E there is a built in safety margin so the nozzle doesn't crash into the bed. The M206 setting is combined with this offset. A larger number on Z will set the bed starting position higher.

M220

"M220 Sn" will set the speed multiplier to (n)% of what is commanded, up to the max feedrates. So "M220 S50" will cause all moves to go at half speed; S200 will cause all moves to go at double speed; S100 will cause all moves to go at normal speed; S1 will cause all moves to go at 1% speed.

M221

"M221 Sn" will set the extrusion multiplier to (n)% of what is commanded. So "M221 S50" will extrude half of the commanded filament; S200 will extrude double the commanded filament; S100 will extrude the commanded amount of filament; S1 will extrude 1% of the commanded filament.

Useful for dialing in slicer extrusion multipliers.

M303

PID autotune. "M303" will autotune to 150°C; "M303 Sn" will autotune to n°C. Covered more in PID below.

M500/M501/M502/M503

Covered in EEPROM above.

M999

Recover (unlock action restriction) from an error.