Introduction: LEGO 3d Printer

This LEGO printer is based on the Prusa I3 rework printer. The printer started as a A4-plotter with stepper motors from an old HP printer. After upgrading the stepper motors to Nema 17 motors I decided to build a X, Y and Z axis machine. This evolved in this printer.

LEGO and Nema 17 stepper motors are a perfect match. A default LEGO brick of 4 by 2 studs is 32 x 16 x 9.6 mm. Nema stepper motors have m3 holes at a distance of 31 mm. Attaching the Nema 17 stepper with LEGO technic, using a felt damper/isolator and m3 x 15 bolts, gives a solid base (image 4). See this Lego Dimension Guide for more lego math.

This is my first instrucable and it will not be a guide for creating this exact printer. I will give enough details to create such a printer. All information used to build this printer comes from the internet.

Warning: This printer is not a toy. Don't leave the printer while printing. The temperature of the heat bed can reach 110 degrees celcius. And the temperature of the printhead starts with 170 degrees celcius.

Step 1: Bill of Material

The printer is not a 100% LEGO printer. I don't have any LEGO Mindstorms products. Another reason is that LEGO motors are servo motors and 3d printers use stepper motors. Last reason is the software used to control the printer. I'm using Marlin for the Atmega 2560 and Pronterface on my laptop to control the printer.

Besides a lot of LEGO you'll need the following items from the Prusa I3 bill of material. The length of the rods depends of the size of the printer you are building. It's cheaper to buy pieces of 100cm than the default prusa i3 pieces.

Mechanical Parts and rods
- Smooth rod 8mm (3 x 100 cm)
- Threaded rod m5 (1 x of 100 cm)
- LM8UU linear bearing (11 x)
- Ball bearing 608 (2x)
- Flexible coupling 5x5 (2x)
- Nema 17 stepper (4x)
- GT2 Pulley (2x)
- GT2 Belt (200 cm)

Heated bed
- Y-carrier frame (1x, or use LEGO)
- Heatbed (1x)
- Glass Plate (1x)
- Binder clip (4x)
- Thermistor 100K (1x)

Electronics
- Ramps (1x)
- Atmega 2560 (1x)
- Stepstick (4x)
- Endstop (3x)
- Power supply (1x)
- Ramps wiring kit (1x)
- Extruder with Nema stepper (1x)

Screws, nuts and washers depend on the build. Use m3 x 15 bolts for connecting the steppers to the LEGO.

Step 2: Y Axis With Motor and Belt

Most 3d printer start with building the entire frame. This printer starts with a base of 34 x 64 studs (19.2 x 51.2 cm). This is build in the middle of several base plates with a total size of 56 x 64 studs.

After building the base we determine the distance between the smooth rods for the Y axis. The Y-carriage places the LM8UU Bearing with a distance of 170mm. This gives 21.25 studs. The 1/4 stud is solved by an adjustable smooth roth connection (second image). The added fence gives the needed distance. Use 4 handle bricks for placing the smooth rods (third image). Total height of the holders is 4 bricks (the Y-carriage moves above the stepper motor). The rods are 50 cm each and are attached with loom bands (last 2 pictures).

The Motor is placed using technic bricks at the back of the machine. The pulley is attached to the motor. The bearing holder at the other side is adjustable. Use loom bands to tighten the toothed belt at the bearing side (4th image). Attach these looms after connecting the toothed belt to the LEGO-carriage.

The toothed belt is connected to a LEGO-carriage. The 2 blue connectors (5th image) fit in the LEGO technic piece below the metal y-carriage (first image).

Step 3: Z Axis With Motor and Threaded Rod

After completing the Y-axis it's time to start building the frame. The printer is 44 blocks high (42 cm). Build a sturdy L-frame of 36 blocks high. This determines how high you can print. But do not build too high. The higher the more unstable the frame. Use LEGO technic bricks (or modified bricks) each 5th brick and use plates for getting a rigid frame (second image). Connect both sides at the top of the frame.

At these websites are some examples of a wooden frame and an acrylic frame.

The 8 mm smooth (50 cm) rod can be placed in a 1x1 stud empty space (8 mm is the exact LEGO 1 x 1 block size). The rod is located at the 36th stud from the front. This isn't the middle of the base because of the extruder dimensions.

The Nema steppers are attached with 2x4 and 2x8 plates having holes. Build 3 plates high and use m3 x 15 mm bolts. At this point the center of the Nema stepper is 1/2 stud off the 8 mm smooth rod (X and Y axis). This is because of the stepper is placed in the middle of a 2 x 2 opening and the smooth rod is on top of a stud. Therefore the motor is moved half a brick (the X axis). This places the threaded rod exactly opposite the smooth rod (third image).

The smooth rods are attached at the top of the frame. The 5 mm threaded rods (50 cm each) are attached to the stepper motors (5th image). They will be tied to the X-axis.

Step 4: X Axis With Motor

This is the most difficult part of the build. The X-axis is moved up and down by the Z-axis and the stepper moves the extruder over the X-axis.

The original Prusa X axis consists of a separate left and right side connected by two rods. I've made one large X-axis, using long technic bricks, for stability. The second image shows the compete X-axis with motor, extruder-carriage and belt. Start with building the right side, then build the left side with the stepper motor. Connect both sides without blocking the extruder-carriage bearings.

The LM8UU bearings are 24 mm long, exactly 3 studs. The bearings are placed between 2 new type technical connectors (gives 8mm distance, 3th image). Use loom bands or tie wraps to keep them in place.

Image 4 (frameside) and 5 show the right side of the X-axis. The 8 mm smooth rods (50 cm each) for the X-axis adapt between the two blue bricks and between the blue and white bricks (5th image). The 2 long red technical bricks are connected to the left side of the X-axis.

The stepper motor for the X-axis is placed at the left side. This is almost a copy of the right side. The difference is the 2 long technical bricks for attaching the motor (8th image).

The 5 mm Z-axis threaded rods are attached to the gray and black 1 x 8 technical brick (8th image). I've used 5 mm "metal hollow wall anchors ". These are placed between 4 long technical pins. The outer diameter of the anchors is 8mm. Use additional loom bands or tire wraps for the connection.

Step 5: X Axis With Motor (Rework)

Like the real Prusa has a rework variant. I have created a new X-axis. Although the first version worked, I created a better version with the new Lego Technic.

In my first version of the X-axis, the smooth rods are resting on the studs of a brick. Now the smooth rods of the X-axis are resting on new Technic bricks, resulting in a better X-axis. Because the rods are attached (loom bands) to the technic beams, there is no need to connect te left and right side of the X axis.

Step 6: Extruder-carriage and Belt

With a working x, y and z axis I decided to buy a complete 3d extruder.

The Geeetech assembled MK8 extruder has a default 0.3 mm nozzle size and uses 1.75 mm filament. It comes with a stepper motor. I've chosen this extruder because of it's size. It has the size of a Nema stepper and is flat at the bottom.

The extruder-carriage uses the same LM8UU bearings as the other axes. The fourth image shows the actual built without extruder. The last 3 images show details of the extruder-carriage. Starting with the blue belt holder. This one uses the same connection technique as the Y-axis. This one is smaller because it has to fit between the carriage and the X-axis.

Use tie wraps to attach the bearings (5th image).

Step 7: End Stops

End stops are switches that trigger when an axis reaches its limit. They will prevent the printer from trying to move out of its own frame. End stops are also used by the printer as a reference (home) position. Before printing, each axis is moved in a specific direction until it reaches an end stop. This is the home of the printer.

There are 3 end stops. one for each axis. There is no need to use 6 end stops (2 for each axis). The print size is in the configuration.h file of the Marlin software.

Max printsize:
#define X_MAX_POS 195
#define X_MIN_POS 0
#define Y_MAX_POS 215
#define Y_MIN_POS 0
#define Z_MAX_POS 200
#define Z_MIN_POS 0

This buid has optical endstops and I've used flags to mark the end of an axis (it should be easier to use mechanical endstops). All endstops are connected to technical bricks with m3 x 15 mm bolts and nuts (third image).

When using optical endstops make sure the flag don't move while printing.

Step 8: Electronics

See reprap.org, Building a Prusa i3 3D Printer and/or botbuilder Prusa I3 building guide for connecting all electronics.

Microstepping

The Nema steppers have 200-steps-per-revolution. The number of steps-per-revolution can be increased by microstepping. This has to be set for each stepper and can be done by placing jumpers on the Ramps board (3 blue jumpers on the first picture). Place the microstepping jumpers before placing the stepsticks on the Ramps board. If you have the A4988 then the 3 jumpers give a microstepping of 16. The drv8825 can give a microstepping up to 32.

Step size of A4988

j1 j2 j3
no no no fullstep
yes no no halfstep
no yes no 1/4step
yes yes no 1/8step
yes yes yes 1/16step

Step size of Drv8825

j1 j2 j3
no no no full step
yes no no half step
no yes no 1/4 step
yes yes no 1/4 step
no no yes 1/16 step
yes no yes 1/32 step
no yes yes 1/32step
yes yes yes 1/32step

Endstops

Up to 6 endstops can be used. The minimum number of endstops is 3, one for each axis. Use the X1, Y1 and Z1 connectors if you have 3 endstops. Each endstop has 3 wires, connect them (from top to bottom) as follows:

- signal
- ground
- vcc

Nema steppers

The steppers have 4 wires. Connect the wires to the ramps board. The connection pins are numbered 1A, 1B, 2A, 2B (from left to right). Take a look at the datasheet of the stepper. This will give the following wiring:

- Black 1A
- Green 1B
- Blue 2A
- Red 2B

After connecting all electronics it's time for testing the steppers, endstops, heating bed and the extruder.

Before uploading the Marlin software to the printer, the configuration.h needs to be altered. After uploading it should be possible to print. My first print had some problems with the amount of filament but everything worked. The main problem was the difference in filament settings and extruder nozzle. This was caused by the Pronterface settings. The expected filament was 3 mm2 and the actual size is 1.75 mm2. This resulted in feeding too few filament. Next error was the default nozzle size is 0.5 mm with a layer height of 0.4 mm. The actual nozzle is 0.3 mm.


Version and header

#define STRING_VERSION "1.0.2"
#define STRING_URL "reprap.org"
#define STRING_VERSION_CONFIG_H __DATE__ "20150530" __TIME__ // build date and time
#define STRING_CONFIG_H_AUTHOR "(Gosse, LegoPrinter)" // Who made the changes.
#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup

Ramps

This printer uses a Rams 1.4 board with a single extruder.

#define MOTHERBOARD BOARD_RAMPS_13_EFB
#define EXTRUDERS 1

Thermistors and temperature

The 2 thermistors for the heat bed and the extruder are 100k NTC giving type 1 thermistors:

// 0 is not used
// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
// 3 is Mendel-parts thermistor (4.7k pullup)
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 1

Maximum temperature settings. These values depend on the heat bed and extruder. The maximum temperature for the Geeetech MK8 is 280 degrees celcius.

#define HEATER_0_MAXTEMP 275
#define HEATER_1_MAXTEMP 275
#define HEATER_2_MAXTEMP 275
#define BED_MAXTEMP 150

End stops and size

Location of the end stops. 1 is at the maximum position and -1 is at the minimum position. Homing with the following settings results in: a Y axis (heat bed) at the front side, the X axis on the left and the Z axis at the lowest position. This extruder position is the home of my printer:

#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1

Max printsize (depends of the build):

#define X_MAX_POS 195
#define X_MIN_POS 0
#define Y_MAX_POS 215
#define Y_MIN_POS 0
#define Z_MAX_POS 200
#define Z_MIN_POS 0

Steps, speed and acceleration:

Homing feedrate is in mm/min instead of mm/sec.

#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {20*60, 20*60, 1*60, 0} // set the homing speeds (mm/min)

Nema 17 stepper: 360 / 1.8 degrees = 200 steps per rotation
drv8825 microstepping = 32 (max)
a4988 microstepping = 16 (nax)

X and Y axis steps per unit:

steps_per_mm = (motor_steps_per_rev * driver_microstep) / (belt_pitch * pulley_number_of_teeth)
= (200 steps * 32) / (2 mm * 20) = 160 steps/mm

Z axis steps per unit:

5 mm threaded rod pitch = 0.8 (coarse) or 0.5 (fine)
steps_per_mm = (motor_steps_per_rev * driver_microstep) / thread_pitch
= (200 * 32) / 0.8 = 8000

Extruder steps per unit:

steps_per_mm = (motor_steps_per_rev * driver_microstep) / (hob_effective_diameter * pi)
= (200 * 32) / (7 * 3,1415926) = 291.02618

#define DEFAULT_AXIS_STEPS_PER_UNIT {160, 160, 8000, 291.0261}
#define DEFAULT_MAX_FEEDRATE {1500, 1500, 2.5, 32} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {1500,1500,100,10000}
#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts

Preheat constants (need calibration, fan is always on 100%)

#define PLA_PREHEAT_HOTEND_TEMP 180
#define PLA_PREHEAT_HPB_TEMP 70
#define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#define ABS_PREHEAT_HOTEND_TEMP 240 #define ABS_PREHEAT_HPB_TEMP 100
#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255

Step 9: Configuration and Calibrating

Several parts need configuration and calibrating. Each part of this step will contribute significantly to improving the quality of your prints.

I've used default prusa setting in the previous step to test the extruder. After heating the extruder I was able to extrude some PLA. Now it's time to measure and calculate if all settings are right. We'll change the configuration.h file if needed and upload it to the ATMEGA. Remember to upload the file after each change.

The reprap.org website has all information needed for calibrating the printer. One thing that isn't on this list is PID tuning. This is described in the Reprap wiki. I started with the PID tuning because it's independent of the printer calibrating.

PID-tuning

Since I'm using marlin to control the heat bed and the extruder I need to set the correct parameters for heating these objects. Before printing we need to set the temperature of the extruder and the heat bed. When the printer turns on the heat bed the current flows through a resistor and the temperature rises. At some point the selected temperature is reached. Now the printer turns off the power of the heat bed. Because there are some delays, in reaching the temperature and switching off, the temperature will exceed the set temperature. The PID settings store the temperature characteristics of the heat bed (and extruder). It will slow down the heating when the printer reaches the selected temperature,

The following command (after connecting to the printer with the prconsole) switches the heat bed on until it reached 60 degrees celcius. And keeps it at 60 degrees for 8 cycly.

M303 E-1 S60 C8

The console gives the results

bias: 78 d: 78 min: 59.79 max: 60.19 Ku: 504.75 Tu: 10.22
Classic PID Kp: 302.85 Ki: 59.24 Kd: 387.04
PID Autotune finished!
Put the last Kp, Ki and Kd constants from above into Configuration.h

After configuring the heat bed continue with the extruder. This one has a higher temperature setting:

M303 E0 S190 C8

My first results are:

bias: 65 d: 65 min: 186.25 max: 194.55 Ku: 19.95 Tu: 51.51
Classic PID Kp: 11.97 Ki: 0.46 Kd: 77.09
PID Autotune finished!
Put the last Kp, Ki and Kd constants from above into Conf iguration.h

Run the commands multiple times until the values stop changing. Always start with a cold heat bed/extruder. My final results are (don't use these values, determine your own settings):

#define PIDTEMP
#define DEFAULT_Kp 11.60
#define DEFAULT_Ki 0.40
#define DEFAULT_Kd 83.55

#define PIDTEMPBED
#define DEFAULT_bedKp 310.61
#define DEFAULT_bedKi 60.76
#define DEFAULT_bedKd 396.96


Motors

The settings on the instructables page for building a Prusa i3 are:

#define DEFAULT_AXIS_STEPS_PER_UNIT {78.7402,78.7402,4000,760*1.1}

When using 8825 stepsticks instead of 4988 stepsticks the values are (1/16 step vs 1/32 step)

#define DEFAULT_AXIS_STEPS_PER_UNIT {157.4804,157.4804,8000,317,6616}

Both values are wrong for my printer. Do the math, and calculate these values for your own printer. I ended with the following values:

#define DEFAULT_AXIS_STEPS_PER_UNIT {160, 160, 8000, 291.0261}

It's only 2.52 steps per unit off, but you will notice the difference.


Extruder

I've done my math: steps_per_mm = (motor_steps_per_rev * driver_microstep) / (hob_effective_diameter * pi) = (200 * 32) / (7 * 3,1415926) = 291.02618

But the practice is different from the theory. Everything worked out somehow because I had the nozzle nozzle wrong too. After altering to the correct 0.3 mm nozzle settings, the printer gave too much filament. First thought was halving the value, maybe the stepper multiplier wasn't 1/32th but 1/16th. Feeding (using Pronterface) 10 cm filament to the nozzle used only 5.4 cm filament. I multiplied my settings with 0.54. I repeated this test after Uploading the firmware to the printer. Finally, with a settings of 191 steps/mm, the printer gave the correct amount of 100 mm filament.

Next setting which I wanted to check was the extruder feed rate (second image). I started with 100 mm filament at a rate of 10 mm/sec. This resulted in using 100 mm filament (this took 10 minutes). The next test was 30 mm/sec, which also used 100 mm filament. I increased the feed rate until the extruder couldn't handle 100 mm filament. This happened above the feed rate of 75 mm/sec. I changed the value to a safe value of 60 mm/sec.


Bed Leveling

This part is described in the Reprap wiki (Leveling the Print Bed).


Software

The default nozzle size of the software is 0.5 mm. The extruders nozzle size is 0.3 mm. We need to alter the software settings before printing. The first test with this printer failed because I used the default value. This resulted in feeding the wrong amount of filament and a too large layer height.

Step 10: Printing

Although the printer needs to be further calibrated everything is working properly. I probably need to alter the filament settings.

By ensuring that all axes move smoothly, no steps are skipped by the stepper motors. This was one of the problems during the first print.

The link "Printing with a LEGO 3d printer" shows the printer in action.

Next step is learning to use Pronterface and how to make stl files. I've downloaded some files and I'm learning to use 3d printers. I will record further improvements and update this instructable when the results are improving.


Update 3 june 2015:

I managed to alter the Pronterface settings by changing the gcode manually (0.1 mm layer height). I downloaded a stl file named bunny-flatfoot.stl and started printing. Everything started well, but the printer started skipping some steps on the X and Y axis. The LM8UU bearing, bought on Ebay, didn't slide as they should. I printed the same file again, after replacing all X and Y axis with new bearings (gave me a chance to make some pictures of the Y-carriage). Now everything is working like a real 3d printer! The last picture (left) shows the first layers with a honeycomb structure.

Unfortunately I can't print the entire file because I don't have enough filament (and it will take 7 hours to complete). Lowering the fill percentage might solve both issues.

Step 11: Printing LEGO

Update 5 june 2015:

Finally the answer to the question whether you can print LEGO with this printer. After dowloading of a LEGO.stl file, the second print succeeded with a layer height of 0.2 mm. Although the result does not fit exactly, it seems quite a LEGO brick (image 1). The total time to print one brick is 25 minutes

During the first attempt (Youtube video) , with a layer height of 0.1 mm, the printed filament let loose of the heating bed. Halving the low level will double the processing time, but gave an usable brick.

The second image shows the first print (orange), the second attempt and a LEGO brick.


Update 8 june 2015:

I calibrated the nozzle feeding (calibration step). After downloaded a "hollow ball by sophia1006" stl-file from thingiverse I started printing again. Estimated printer time with a layer height of 0.2 mm is 1 hour and 37 minute (with 1746 cm filament).

In one of my videos I noticed some backslash in the X-belt. I replaced the lego wheel at the end of this belt with a real ball bearing. This improved the print quality of my next print.

Step 12: First Real Print

After printing the hollow bal twice, I noticed that the printed filament stays liquid too long during printing. Especially in overhangs and bridges. Resulting in a oval bal instead of a round bal.

This is probably the reason why most printers have an additional fan near the nozze. Searching for a solution I found the "printhead fan shroud by kafan". This one fits around the cooling heatsink on the MK8 extruder. The cooling fins need to be placed in a vertical orientation. Before installing I have to change the extruder-carriage.

Update 20 june 2015:

My first "Made It!" at instructables is a Customizable Low-Poly Vase. Made some modifications after downloading the stl-file. Total print time is 3:22.

The printer is working like a non-Lego 3D printer. The new X-axis (redesign) with the Z-axis coupling gives a realy improved the print quality.

Step 13: Improvements

My first results from top left to bottom right:

- 2x testing the printer (square box). Most firmware values put on default Prusa. Without any calibration.

- A door stopper, after adjusting the X and Y settings by measuring the first print. Here we clearly see (at the top) the skipping steps of the stepper motor.

- The third and fourth attempt. Between these two prints all bearings were replaced. Also reduced the filament feeding.

- At the first Lego brick (yellow) the filament let go of the heatbed (the circles). Printing with a layer of 0.1 mm gives a good result.

- A Lego brick with a layer height of 0.2 mm.

All in all pretty fast results.

Future changes (Done)

The advantage of using LEGO is the possibility to alter the printer after building. One of the problems encountered during building was connecting the z axis to the 5mm threaded rod. This is solved by buying several items at the hardware store. I ended with a "metal hollow wall plug" (image).

Later I've bought 2 Z axis motor couplings m5. These are full metal and are threaded inside. It should be possible to use these in stead of the large metal plugs. The red 1 x 8 technic brick (last image) is connected to the coupling and can be moved by a 5 mm threaded rod.

Websites used to build this printer:

Prusa i3 Rework
Building a Prusa i3
3D Printer botbuilder

----

If you liked this Instructable, and you want to receive updates about future projects, you can follow me on Instructables, Instagram or on Youtube.

3D Printing Contest

Second Prize in the
3D Printing Contest