# Tutorial - The RepRap 3D Printer, Part II: Get those motors moving!

On Part I of this tutorial, we covered the structure construction, motors installation, electronics assembly and wiring. Now it's time to give life to the printer. I'll cover the following steps in this post:

• Software toolchain
• Playing with motor movements
• Check for skipped motor steps
• Bed leveling and axes home position
• Axes calibration

These steps are absolutely necessary if you want to get smooth and accurate prints. If you are new to 3D printing, it will be fun to see your motors moving for the first time.

## Firmware

• BAUDRATE: set to 115200 (default is 250000)
• MOTHERBOARD: 33 for typical RAMPS v1.4 (default is 7=Ultimaker)
• TEMP_SENSOR_0: set to 1 (default is -1)
• TEMP_SENSOR_1: set to 0 (default is -1)
• TEMP_SENSOR_2: set to 0 (default is 0)
• TEMP_SENSOR_BED: set to 1 (default is 0)

Next, locate the following variables to set the endstop (limitswitch) logic. Set all values to false:

Finally, locate the following variables and set all to false (we'll set axes directions by choosing the orientation of the motor connector):

We'll set a few parameters later in the calibration step. To upload the firmware, connect the printer to the computer through USB, go to Tools -> Board -> Arduino Mega 2560 and then choose the correct serial port on Tools -> Serial Port. Click the Upload button and that's it.

## Software Toolchain

Now, for the next steps we need to make the motors move, and for that we only need one specific software, but I'll just go ahead and introduce the complete toolchain:

• CAD software: for designing your 3D models. There are many options, here is a quite thorough list, including very simple, free and open source software and also expensive and close software. I have used Inventor Fusion, which is free for Mac, and OpenScad, also free plus multi-platform and open source. I recommend OpenScad if your background is closer to software developing than design. If you don't like to code, I would recommend Sketchup, which is also free and multi-platform.
• Slicing software: for converting your 3D models into movements of the machine. These movements will make your 3D model a reality. The movements of the printer are coded in a language called G-Code, an industry standard. The slicer software basically converts STL files (a somewhat standard format for 3D models that are 3D printed) into G-CODE files. Again, there are many choices. The most popular ones are Cura and Slic3r. I use Slic3r and it has given me very nice results once I got the right parameters for my printer.
• Printer control software: for sending the gcode to the printer, and also freely move motors (e.g. for calibration) and set temperatures. Here is the list. My choice is PronterFace (a.k.a. Printrun) which is Python-based.

In what follows of these tutorials, I'll assume the software used is as I have chosen.

## Moving Motors Smoothly

Install Pronterface, the instructions depend on the operating system of your choice, you can find them here. The Pronterface user interface looks like this:

Pronterface UI (Mac)

Usage is pretty straight forward. For now we will only use that sort of dial on the left with the axes names on it. Connect your printer through USB, choose the serial port, leave the default 115200 baudrate and click Connect. If the connection is successful, the dial will change to brighter colors:

Pronterface dial when connected to printer.

The dial has numbers on each of the concentric circles it's made of. Those numbers indicate the amount of millimeters to move. The home button for each axis is used to move the axis to the zero or "home" position, which is marked by the limitswitch.

### Motor direction and Homing

Make sure the power supply is properly connected and turned on. With your hand, gently move the X axis to a center position (just one that does not press the limitswitch is fine), click on the X Home button, the X axis shoud move towards the its limitswitch. If it moves to the opposite direction, cut power immediately! This is solved simply by inverting the motor connector. If the problem is solved or if the axis moved to the right direction in the first place, it should stop when the limitswitch is pressed. If not, cut the power and check your limitswitch connections. Repeat these steps for the Y and Z axes.

### Adjust current to avoid skipped steps

Now, move the X axis 100mm on the positive direction and listen to the motor sound very carefully. You should hear a smooth movement sound until it stops. If you hear the motor sound is interrupted for a fraction of a second and then continue, then your motor is skipping steps. You might also see how the movement is interrupted too. The solution is to adjust the current flowing through the motor by turning the small potentiometer on the corresponding Pololu stepper controller board (I'm assuming we are using RAMPS as electronics from now on):

Pololu A4988 Stepper Motor Driver

With a multimeter, measure voltaje between points A (ground) and B (current ref. measurement point). Turn the potentiometer until the measured voltaje reads 0.4V. This means 1A will flow through the motor's coils, according to the product page. This method is a starting point for all five motors that worked fine for me, but on this thread of the RepRap Forum there are other suggestions you may want to try. Go ahead and set the potentiometer to this value on all five motor drivers, then try moving each of the axes again. If any motor is still skipping steps, increase the current by turning the corresponding potentiometer very slightly, then check for missed steps again. Don't increase current too much, it will make your motors too hot and wear them down too fast. If you hear loud and high pitched noise from your motors when moving, it means the current is set too high.

## Bed leveling and axes home position

For X and Y axes it is easy: just move the limitswitch as closer to the edge as possible. For Z axis, we need to level the bed and adjust the limitswitch position. As you know, the bed is held by four screws and springs. Tightening and loosening these screws will allow us to level the bed.

First, send the X and Y axes to the home position, then the Z axis. If the hot end touches the bed, move the limit switch upwards, make the axis go up until the limitswitch is released, and press the Z home button again. Repeat this process until the distance between the hot end and the bed at the Z home position is approximately the thickness of a sheet of paper (try putting one between the hot end and bed to check). Now move the nozzle to the remaining vertices of the bed and tighten/loosen the bed leveling screws until the distance between the hot end and bed is the same on all the bed vertex.

## Axes Calibration

You'll need a caliper for this step. Follow these steps:

• Send the X axis to the home position,
• With the caliper, measure the distance from the edge of the cart (moving platform that holds the extruder) to a fixed point on the printer,
• Press the zero button on your caliper,
• Move the axis 100mm,
• Measure again with the caliper and write down the reading you got.

Locate the following line of code:

The above array contains the steps per unit (millimeter in my case) in {X,Y,Z,E} format (E for Extruder). We need to calculate a new value for the X axis using the measurement obtained previously. The new value is calculated as follows:

Input the new value for the X axis and upload the firmware again. Repeat this process at least three times, or until the measured value is as close to 100mm as possible. Repeat this for Y and Z axes.

For the extruder the process is similar and is described here.

## Are we there yet?

We are almost there! At this point, we could just start printing, we just need to know the tools.

The next post will be Part III and final of this tutorial. I'll cover the following:

• Slicing: this is a critical task. The slicing software needs to be well configured for your printer. Print quality depends very much on this.
• Improve belt tensioning, by replacing a part of the printer with our first printed part!
• Print!