Wednesday, December 25, 2013

Assembling the Electronics (Videos 18 and 19)

Recap: I'm assembling a Prusa Mendel 3D printer from a kit I purchased from  The web site includes a series of videos which guide me through the assembly process.  The assembly of the electronics is covered in videos 18 and 19.

In a previous blog entry, I explored all of the electronics components that came with my kit.  Now I'm going to go through the electronics assembly process. 

This time around the videos were not as useful in guiding me through assembly, mainly because the electronics used during assembly in the video were made by Printrboard, but the electronics in my kit were RAMPS 1.4. An additional difference was the power supply.  The one used in the video was an ATX form factor, but the power supply provided with my kit was a mystery model with no discernible standard form factor.  However, I do think the videos are still worth watching for pointers on routing the cables and wire crimping techniques.

The general approach in the videos is mount the controller board on a printed mounting plate on the right-front of the machine, route the cables along the threaded rods to the controller board and attach the cables using tie wraps.  Excess wire is trimmed and new connectors are attached via crimping or soldering.  This approach was very neat and I was thinking of following it but I had reservations: all of the crimping looked very labor intensive and once the wires are trimmed, I felt it would not be possible to physically move the controller board or even take it off the mounting plate.

As a first-time builder, I thought it would be better to leave all of the cables at their original length in case I wanted to move the controller board somewhere else - possibly to the top of the X axis threaded rods. 

I divided the electronics assembly process into these steps:
  • Lengthen the fan cable
  • Route The Wires To The Controller Board
  • Solder connectors onto bare ends
  • Special considerations for attaching two Z axis stepper motors to one driver
  • Attach the controller board to the printed mounting plate
  • Connecting the AC power cable to the power supply
  • Mount the heat sinks on the stepper motor drivers
  • Plug everything into the controller board
  • Connecting the power supply to the controller board
Lengthen the fan cable

The original fan cable was 6" long - not nearly long enough to reach the controller board.  I unscrewed the fan from the X carriage to make it easier to work with.  The fan does not plug into the controller but rather the wire ends are inserted into gaps at terminal D9 with a screw, so I cut off the little plastic connector.  Then I added about 12 inches of wire.  Finally, I re-attached the fan to the X carriage.

Route The Wires To The Controller Board

I grouped the wires into four groups according to how the endpoint of each wire moves in space:
  1. X carriage wires (extruder stepper motor, fan, hot end thermistor, hot end resistor) 
  2. Heat bed wires (heat bed, heat bed thermistor)
  3. X end wires (X stepper motor, X limit switch)
  4. Wires that do not move (Y axis stepper motor, both Z axis stepper motors, Y axis limit switch, Z axis limit switch)
Group 2 - wires from the heat bed
Group 3 wires - X end wires
First I made sure all of the wires are long enough to reach the controller board.

For group 1, the farthest distance from the controller occurs when the Z axis is in the topmost position and the X carriage is in the leftmost position.

For group 2, the farthest distance from the controller occurs when the Y axis is all the way back.

For group 3, the farthest distance from the controller occurs when the Z axis is in the topmost position.

Wires in group 4 do not move.

I had to lengthen the heat bed and the hot end resistor wires because they did not reach the controller board when the heat bed / X carriage were moved to the farthest distance.

I had to rotate the extruder stepper motor 180 degrees so that the wires exit the motor on the upper left (previously it was on the lower right) so that there was less chance of wires from group 1 interfering with the X axis belt and less chance of those wires hitting the right front threaded rod when the X carriage was in the uppermost/rightmost position.

Extruder stepper motor has been rotated
Solder connectors onto bare ends

My kit came with an assortment of 2 pin, 3 pin and 4 pin 1/10" connectors.  I soldered the thermistor wire bare ends onto the connector inserts and fit them inside the 2-pin connectors.  I soldered the limit switch wire bare ends onto the connector inserts and fit them inside the 3-pin connectors.  I stripped the hot bed and hot end resistor wire ends, twisted the strands and tinned them with solder.  They do not need to be attached to a connector because they attach to the controller board by inserting them into a gap on a terminal and tightening a screw.  I left the stepper motor connectors unmodified for now.

Soldering the wires was tedious and I messed up quite often and wasted quite a few connector inserts.  One of the things I realized was that if you got too much solder onto the connector inserts, it leaked into the space occupied by the pin and it made it impossible to plug the pin into the insert.

Special considerations for attaching two Z axis stepper motors to one driver

The Prusa Mendel design calls for connecting the two Z axis stepper motors to one driver.  Surprisingly, there is a considerable amount of advice out there against doing this.  The first is the Pololu website which clearly states that each driver is to be used with one bipolar stepper motor.  This post also advises against it.

Despite the advice, the standard Prusa Mendel design requires connecting two stepper motors to one driver.  For this, there are two options: connect in series or in parallel.

The nwreprap video and the (item #13) site advise you to wire them in parallel.  However a couple opinions (one two) disagree. 

It is a fact that the physical loads on the two Z axis stepper motors are different.  The right motor bears the weight of the X axis stepper motor hanging below it which is greater than the weight of the X axis idler that hangs below the left motor.  Different loads result in different impedance of the coils.  In parallel mode, the same voltage will be applied to both motors, but because the impedance is different, the current through the coils will be different and can result in non-uniform performance.

I think the user ElmarJongerius hit the nail on the head in the 2nd post here: wiring them in series will ensure that the current going through both motors is identical which will result in more uniform performance.

The series approach appears to have been accepted by the RepRap community - here is a product offering for two stepper motors pre-wired in series.

I drew a little diagram for myself before I started wiring the Z stepper motors in parallel.
Wiring up two stepper motors in parallel.
Diagram shows 3 connectors - 2 for the motors and
1 for the pig-tail
I built a "pig-tail" which is a 4-pin connector with wires attached to it.  The colors of the wires match the colors on the stepper motor connectors.  I fashioned the ends of the wires into pin-like ends that plug into the Z stepper motor connectors.  The way I built these "pins" is to strip about a 1/4 inch from the end of the wire, remove 5 strands of wire, twist the remaining strands and tin them with solder.  Once the solder is applied to the end, the whole bundle becomes stiff like a pin.  In addition to the "pig tail", I needed two short wires to connect Blue on motor 1 to Yellow on motor 2 and Green on motor 1 to Red on motor 2.

The "pig tail" for the Z stepper motors

The 2 Z stepper motor connectors wired up to the "pig tail"
Attach the controller board to the printed mounting plate
There is a printed controller mounting plate included in the kit.  The controller board is supposed to attach to it and it attaches to some of the threaded rods.  Unfortunately the holes on the mounting plate did not line up with the holes on the controller.  So I got a 3.2 mm drill bit and drilled some new holes in the mounting plate. I made a paper template of the Arduino and marked the holes on the template.  After I drilled them, I realized two things which made me wish I planned ahead a little more thoroughly:

  1. The spacing on the Arduino does not allow enough space for the heads of M3 bolts, so you have to pass the bolts through the RAMPs 1.4.
  2. The RAMPS 1.4 has just 3 holes for mounting, so I could not use one of the holes.

So I attached the controller board to the mounting plate with three 25 mm M3 bolts and M3 locknuts.

Mounting plate with holes that I drilled marked with white arrows.
Upper right hole could not be used because RAMPS board did not have corresponding hole.
RAMPS and Arduino mounted to printed mounting plate front (1).
RAMPS and Arduino mounted to printed mounting plate front (2).
RAMPS and Arduino mounted to printed mounting plate rear.

Connecting the power cable to the power supply

My power supply has a 110V/220V selector switch. First thing is to check that the selector switch is set to the right voltage for your area. Mine was initially set to the wrong voltage.  My power supply has screw terminals for both line voltage and for 12V output.  The kit came with a typical power cord which has a NEMA 5-15P connector that plugs into the wall and a C-13 connector that plugs into equipment.

The power cord that came with my kit.  NEMA 5-15P male to C-13 female

Power supply, power cord and nylon cable clamps
Since the power supply has screw terminals, I had to cut off the C-13 connector and connect the wires to the screw terminals.  The wires are connected as follows:

Green Wire -> Ground Terminal - labelled with the Ground symbol which looks like an upside down tree
White Wire -> Neutral Terminal - labelled "N"
Black Wire -> Hot/Live Terminal - labelled "L"

I found some 1/4" Nylon Cable clamps in my basement and used them to firmly attach the power cable to the power supply, so that an accidental pull will not cause the ends to come loose.

Strain relief for the power cord
When it was all done, I plugged it in.  The LED on the power supply came on and I heard the fan.  I measured the DC output voltage and it looked correct!  Of course this is not very meaningful because there is no load on the power supply.

Power supply has been wired up and is putting out 12V DC under no load

Mount the heat sinks on the stepper motor drivers

My kit came with 4 heat sinks and some two-sided tape.  I peeled the cover off, cut it into little squares and used it to attach the 4 heat sinks to the 4 controller chips on the Pololu drivers.

Heat sinks ready to be attached to Pololu drivers

Two sided tape has been attached to Pololu drivers
Heat sinks have been attached to Pololu drivers
Plug everything into the controller board

Attach the mounting plate to the Prusa.

Controller mounting plate has been attached to the Prusa Mendel
Here is the wiring diagram and some photos of the assembled RAMPS 1.4 controller ( photo1 photo2 ).  The fan connection does not appear in the diagram, but does appear in some of the photos - the fan is plugged into D9.

Everything has been plugged into the controller except power supply.

Connecting the power supply to the controller board

Using 2 sets of 18 gauge wires, connect the +V and -V terminals on the power supply to the designated power terminal on the RAMPS.

Wiring the power supply to the connector on the RAMPS 

At this point, assembly is complete!  

The next step is to power it on!

Assembly is complete (1)
Assembly is complete (2) 

Exploring The Prusa Mendel Electronics

Recap: I'm assembling a Prusa Mendel 3D RepRap printer from a kit I purchased from

With the physical assembly complete, the next step is to complete the assembly at the electronic level.  After the electronic assembly is complete, I believe the only things that remain are to install the software and perform the calibration and then I should be able to print.

Before I started the electronic assembly, I decided to learn more about the electronic components of my Prusa kit. 

The Big Picture

The Prusa Mendel connects to a PC via a USB cable.  The PC runs various software programs that control the Prusa.  The Prusa Mendel also connects to a 12 VDC power supply.  The USB and power connections terminate on the controller board on the Prusa Mendel.  The controller board is the brain of the machine.  It connects to all of the electronic components.  Designs are loaded from the PC into the controller board in the form of instructions over the USB cable.

Big Picture: Prusa Mendel is connected to computer and power supply

The controller board is actually made up of three components:
  • Arduino Mega 2560
  • Ultimachine RAMPS 1.4
  • Pololu md09b A4988 Stepper Motor Driver (4)
The "base" is the Arduino Mega.  The RAMPS 1.4 plugs into the Arduino.  4 Pololu Drivers plug into the RAMPS 1.4.  The Prusa's stepper motors connect to the Pololu Stepper Motor Drivers and the rest of the electronic components such as the limit switches, thermistors, etc. on the Prusa connect to the RAMPS.

Stepper motors are plugged into Plolu Drivers
Pololu Drivers, 12 VDC power and many other devices are plugged into RAMPS
USB and RAMPS are plugged into Arduino

The following electronics components were included in my kit from :
  • Controller Board assembly (including Arduino Mega 2560, Ultimachine RAMPS 1.4, Pololu md09b A4988 Stepper Motor Controllers (4) )
  • Kysan 1124090 Stepper Motor (5)
  • YXDY S-360W-12 Power Supply
  • Limit Switches (3)
  • MK1 heat bed (previously discussed in this blog entry)

Arduino Mega 2560 R3

This is a very popular controller board that has uses far beyond 3D printing.  It has numerous features that make it ideal for a wide variety of applications.  One novel aspect of Arduino products is the standard way in which connectors are exposed which allows a variety of interchangeable modules to be plugged into the Arduino.  These modules are known as shields.  One of the well-known shields is the RAMPS 1.4 which allows the Arduino to communicate with the Prusa Mendel devices and the stepper motor drivers.

Here is the product page for the Arduino Mega 2560.

Arduino Mega 2560 R3 with USB connector (red)

Ultimachine RAMPS 1.4

Here is the product page for the Ultimachine RAMPS 1.4.
Here is the page for the RAMPS 1.4

RAMPS 1.4 with power connector (yellow) and 4 Pololu Stepper Drivers (red)

Pololu md09b A4988 Stepper Motor Controller

Here is the product page for the Pololu md09b A4988.
Here is the page for the Pololu

According to Pololu's web site, this is basically a breakout board for the Allegro A4988 stepper motor controller which is the large component you see in the center.  The Allegro A4988 web site is here.

Now I'm not really sure why it wasn't possible to integrate the Allegro A4988 stepper motor controller directly onto the RAMPS and eliminate the need for the Pololu component.  Perhaps it was to give users the option to choose a different stepper motor driver.  Perhaps it was to allow easy replacement if it burned out.

Kysan 1124090 Stepper Motor

Here is the product page for the Kysan 1124090 Stepper Motor.

This is a good video on stepper motor basics.

A good motor FAQ appears here.

Stepper motors are used in the RepRap because when used properly (i.e. not overloaded) they are easier to control because the do not require a closed loop system.  A closed loop system is one with a motion sensor that detects the effect of the applying current to the motor and a controller which adjusts the current sent to the motor while monitoring motion sensor to get the desired result.  With a stepper motor, it is typical to operate in an open loop fashion which means that current is applied in pulses to the coils and it is assumed that the motor will "step" a pre-defined amount as a result of each pulse.  Of course if the motor is over-loaded or stuck or not connected and does not actually move, the controller will not detect this.

YXDY S-360W-12 Power Supply
The power supply included in my kit is somewhat of a mystery.  It is Chinese-made and quite "generic" looking.  It comes in a separate box within the kit, but no documentation is included.  I can't seem to find a web site for it, except for an ebay listing.   The ebay listing seems to contain some set up instructions.  I've yet to see an ebay listing used to disseminate technical info like this.  Here are the specs taken from the ebay listing:
  • Input: AC 100-120V 60Hz / AC200-240V 50Hz Manual switch.
  • Output: DC12V 30A .
    T.C.: ±0.02%℃
    Start time:<1S
  • Auto on/off cooling fan .
  • High Efficiency, Low Temperature.
  • High reliability .
  • LED indicator for power on
  • Built-in EMI Filter.
  • Over Load and Short Circuit Protection.
  • Over Voltage Protection.
  • Auto-recovery after protection.
  • Overload protection:105%-150% Rated power
  • Auto-recovery over voltageprotection:115%-135% Voltage nominal Value
  • Working condition:0~45℃ 20%-90%RH
    Storage condition:-20℃ ~80℃ 10%~95%RH
  • ASL <2000M
  • Dimensions: 214mm x 114mm x 50mm.
  • Weight: 920g
YXDY S-360W-12 Power Supply

Friday, December 6, 2013

End Stops (Video 17)

Recap: I'm building a Prusa Mendel 3D printer from a kit I purchased from using a series of videos.

Video 17 walked me through the process of installing the end stops.

First, gather the parts: you'll need three of each: end stop switches, end stop holders and 24 gauge wire pair.  If you can, you might want to test that the switches function properly using a DVM.  Start by drilling out the hole in the end stop switch that is closest to the terminal marked "NC".  Use a 3 mm drill bit.

Components needed for end stop assembly
 Strip the wires and solder them to the terminals marked "CO" and "NC".

Ends of wires have been stripped and soldered to "NC" and "CO" terminals
Attach two of the three end stop switches to end stop holders as shown in the two photos below:  use an M3 locknut with a 14mm M3 bolt.  The bolt passes through the middle hole on the switch holder and through the hole that you drilled out on the switch earlier.  You'll use this configuration for the Y and the Z switches.  The X axis will have to be set up a bit differently as described later.


Mounting Y and Z switches on holders (2)
Mounting Y and Z switches on holders (1)

 Mount the Y axis switch as shown below using an M3 locknut, an M3 washer and a 25mm M3 bolt.  The Y axis switch will be activated by one of the Y bushings when the MDF bottom plate slides all the way forward.

Y end stop holder has been mounted to a smooth rod

The X end stop had to be mounted somewhat differently than the Y and Z end stops.  The X end stop will be activated by the head of one of the bolts that attach the fan to the X carriage.  Use a 25mm M3 bolt, an M3 washer and an M3 locknut.  Pass the bolt through the washer, then the switch, then the two holes in the holder and tighten so the holder clamps around the X axis smooth rod that is closest to the stepper motor that moves the X carriage.

X end stop installation.  The X end stop holder appears inside the blue rectangle.

The Z end stop holder is mounted to the smooth rod underneath the stepper motor that moves the X carriage.  The Z end stop will be activated by the  printed part that holds the X motor.  Do not tighten it yet - the exact positioning will be finalized in a later step.

Mounting the Z end stop holder (1)

Mounting the Z end stop holder (2)

Thursday, December 5, 2013

X Carriage and X Axis Assembly (Videos 15 and 16)

Recap: I'm building a Prusa Mendel 3d printer from a kit I purchased from using a series of videos.

Videos  15 and 16 walked me through the process of assembling the X Axis components.  The steps are broken down into:
  • mounting the X carriage on the linear bearings
  • mounting the fan on the X carriage
  • mounting the extruder on the X carriage
  • attaching the X stepper motor
  • assemble the X axis idler
  • attaching the X axis idler
  • installing the X belt
Mounting the X carriage on the linear bearings

The X carriage is to be attached to the linear bearings with four zip ties.  I suggest placing the X carriage on the linear bearings and sliding it back and forth a few times to make sure it slides smoothly before attaching it.

X carriage sitting on top of linear bearings.

Later, the extruder will be attached to the X carriage using 2 M4 hex bolts.  Now is a good time to install the 2 M4 hex bolts into the X carriage.  There are 6 holes in the X carriage, allowing for 3 possible mounting options for the extruder.  Study the picture below and insert the M4 bolts into those two holes.  Use 2 M4 washers.

M4 bolts have been inserted into the X carriage.

Mounting the fan on the X carriage

There is a small 30 mm fan in the nwreprap kit. It is to be attached to the X carriage to keep the hot end cooler. The fan is attached to the X carriage with 2 14mm M3 bolts. The bolts pass through two holes on the fan and into two holes on either side of the X carriage. Nuts are not used here. I suggest you use the two holes on the fan closest to the wires. Mount the fan on the right side of the X carriage (some of the photos below show the fan mounted incorrectly on the left side) .  The silvery sticker on the fan should face toward the X carriage.

Underside of the X carriage showing heads of M4 bolts, the M4 washers and the fan attached to the left side (incorrectly).
At this point you can attach the X carriage to the linear bearings with zip ties.  Make sure that the two mounting points for the belt clamps are facing the front of the Prusa Mendel (away from the Y axis stepper motor).

X carriage has been attached to linear bearings.  Fan has been moved to the right side of the X carriage.

Mount the extruder on the X carriage using 2 M4 nuts and tighten.  Take care to orient the extruder stepper motor toward the right - it should be over top of the fan.  You may need to raise the two X axis smooth rods to allow the hot end to fit.  You do this by turning the Z axis stepper motors.

Extruder has been attached to X carriage (viewed from the left-front)

Extruder has been attached to X carriage (viewed from the right-front)

Extruder has been attached to X carriage (viewed from the rear-top)

Extruder has been attached to X carriage (viewed from the rear-level)

Extruder has been attached to X carriage (viewed from the front-level)

Attaching The X Axis Stepper Motor

Prepare the X axis stepper motor by sliding the pulley onto the shaft and securing the 2 grub screws.  Orient the teeth of the pulley as close as possible to the body of the motor.

Pulley has been installed onto the X axis stepper motor.

Attach the motor to the X motor mount using 3 14 MM M3 bolts and 3 M3 washers.  Orient the motor so that the wires face down.

X axis stepper motor has been attached.
Assemble the X axis idler.

X axis idler is prepared starting with locating a short M8 threaded rod.  Slide the following onto the M8 threaded rod: M8 nut, fender washer, M8 washer, bearing, M8 washer, fender washer

X axis idler before installation showing (L-R) fender washer, M8 washer, bearing, M8 washer, fender washer, M8 nut.
Attaching the X Axis Idler

Attach the X Axis idler to the X end idler printed plastic piece by passing the short M8 threaded rod through a hole in the X end idler and securing with an M8 nut on the other side.
X  axis idler has been installed
Installing the X Axis Belt

You'll need the remainder of the timing belt, 2 belt clamps, 4 M3 14mm bolts and 4 M3 locknuts. 

Parts for X axis belt installation
Attach one end of the belt with a belt clamp to the X carriage using two 14mm M3 bolts and 2 M3 locknuts.  Pass the belt around the pulley on the stepper motor and around the bearing on the X idler.  Attach the other end of the belt to the X carriage using the last belt clamp.  The belt should be stretched pretty tight.  Cut off the excess belt.  In the video I see a slightly different X carriage that has a tensioner.  Slide the X carriage back and forth to make sure nothing binds.

X carriage with both belt clamps installed.

This is how the Prusa Mendel looks at the end of Video 16: