Wednesday, October 27, 2010

Building a Prusa i3 printer - Electronics mounting and wiring

This page covers mounting the power supply and electronics and wiring.

Things that need wiring on your printer:


  • Motors
  • Endstops
  • Hotend heater
  • Hotend thermistor
  • Hotend fan
  • AC power to power supply
  • DC power from power supply to electronics

Wiring in general

I recommend buying a wiring kit from a supplier which has the ends that connect to the electronics already crimped on.  Then either solder these directly to the part in question (for endstops and thermistors and possibly the heater) or solder them to the wires coming from the motors.  If you join wires to wires, it's nice if you can use heat shrink tubing as insulation, it's very neat, but electrical tape can work as well.

Please leave the wires longer than you think you need.  I'd recommend at least 6 inches if not a foot of extra wire.  Coil up the excess, secure with a zip tie and tuck it into a corner of the printer.  You never know when you're going to find that you have to move the electronics or you forgot something about wire routing.

For RAMPS, this page and particularly this diagram should help a lot:

http://reprap.org/wiki/RAMPS_1.4#Wiring

Your pre-made cables may have connectors at both ends.  For motors, thermistors and mechanical endstops, you'll just be cutting one end off.  If some of the wires on the motors or other things are long enough, you might get away with using both ends of one cable and saving the other ones for other uses later.

Mounting the electronics

You may have a mounting plate for your electronics.  If so, you can use that, otherwise you can just carefully put small wood screws through the PC board mounting holes and into the wood frame.  Pick a place for the electronics that works for you.  My recommendation is on the left side of the printer as you face the front of it, against the side wall (the triangle shaped piece) on the inside of the printer.  If you have an LCD panel, you'll probably have to put this up high.  If not I like to put it lower.  Keep the wires long enough to be able to move it around later if you want to.
Mounting electronics with LCD panel.  Without the panel I like to move the electronics down to the bottom to protect them better.


Mounting the power supply

I just made some plastic clips to mount my power supply on the right inside of the printer, and mounted the AC input module right there too.
Mounting the power supply and AC input module


Motor wiring

This page may help you if the following is confusing.

Your first step on the motors is to identify which wires are which.  Unless your motors came with a diagram, you'll need a voltmeter set on the ohms range.

Write down all your wire colors on a piece of paper, then use the voltmeter to find the resistance between each wire and the others.  Half of the wires should be not connected at all to the other half.  If you find that all the wires have some (low) resistance to the others, then you bought unipolar motors, and they aren't going to work with RepRap electronics.  You need bipolar motors.

If you have four wire motors, it's pretty simple.  Each set of two that have a small resistance to each other is one winding, and you need to wire them up so that one wire is hooked to pins 1 and 2, the other to 3 and 4, of the electronics connector.

If you have six wire motors, for each set of 3 wires that are hooked to a single winding, find the two that have the highest resistance between them, and use those, treating the motor as though it only had four wires.

Here is an example.  I wrote down the readings between each set in the page below, then drew out what I inferred from those readings, and also how I would hook it up.






For now I would just tape back the unused wires in each winding, in case you decide to use them for whatever reason later.  Always leave your options open.

When you have figured this out, determine a color pattern that you will use to connect ALL the motors.  With the electronics in place and all the motors in place, get your motor wires and your wires with the RepRap female connectors on them and cut them to an appropriate length, then solder the two together for each of the motors.

On the Z motors, you have two choices.  Most electronics have two hookup spots for the Z motors, so you can run wires from each of the two motors to the electronics, or you can just solder the wires together from both motors, like colors to like colors, then hook them to a single connector going into the electronics board.

KEEP THESE POINTS IN MIND:

  • Some of the motors move.  Be sure to leave plenty of wire for them to move their full range of motion without being stretched or bent at a sharp angle.
  • Leave at least a few extra inches more than you think you will need.  I actually leave about 8 extra inches if I can spare it at all, then I wrap up the extra in a bundle, zip tie the bundle and stash it in the back.  You might decide to move your electronics or re-route the wires at some point, and it sucks if your wires are too short.

Here's a photo of a RAMPS 1.4 board with wiring going to each of the four motor points (I have not installed motor drivers on this board, and I ran out of 4 conductor cables so the part of the extruder motor connector is being played tonight by a pair of thermistor connectors.



Endstops
On my builds, the X and Y endstops are just switches, sometimes known as "mechanical endstops."  They are straightforward - connect the ground and the "signal" wires (usually black and blue) to the "common" and "NO" (normally open) positions on the switch.

Look really close and you'll see the "C", "NO" and "NC" labels near the connectors.  Use C and NO


Be absolutely sure to double check that when you plug the endstop wire into the electronics that the colors match the electronics - +V to red, GND to black, the remaining color to "SIG".  Failure to do this may damage the electronics - if the switch is connected to gnd and +5 and the switch closes, zap.

Here's a photo of where the endstops attach to a RAMPS 1.4 board.  Notice that we're only using every other endstop position - we're using the "min" endstop, a switch that tells the printer when it's hit the 0 position. It's also possible to use "max" endstops with this electronics, but it's not usually used on RepRap printers.  You can see to the left of the three pin headers the legends S, -, +.  Make sure you get the wires as shown.  If you have other electronics, like Sanguinololu, the pin order may be different!  If that's the case, I will use a small tool to lift the catches and release the wires from the connectors, then rearrange them correctly.




Here are the X and Y endstops with the correct wires soldered on.


X axis endstop


Y axis endstop
If you have an active Z endstop (optical or hall effect), it needs all three wires.  If you have a jumper wire with a 3 pin connector on either end, you can use it on the Z endstop.  If your cables only have connectors on one end like mine, you can just solder them on to the pins as I did below.  I probably should put heat shrink tubing on there but I haven't yet.
Z axis (magnetic) endstop


Hotend heater

If you have a ceramic cartridge heater, it probably came with plenty of wire attached.  Simply route it to the electronics and attach it to the output terminal for the heater (D10 on RAMPS 1.4 boards).


JHead with resistor heater and thermistor, with Kapton tape wrapped around it.

If you have a resistor, use 16 gauge wire (lamp cord works fine).  You can't use solder to connect them because the solder will melt at the temperatures the resistor wires reach.  Use an uninsulated electrical butt connector (a small metal tube) insert the resistor wire in one end and the wire in the other.  I like to run both of these all the way through to the other side so that they overlap.  Then crimp them using a pair of vice grips.  You want to absolutely crush the thing all along its length to make a very solid contact.

Put the resistor into the hotend if you haven't already before doing the second wire.  I like to smear heat sink compound on the resistor before inserting it.

Hotend thermistor
Your thermistor should have come with some high temperature insulating tube. Cut two pieces so that it will cover the wires on the thermistor with only about 4mm of wire exposed on the end.  Place it over the wires (this is a bit difficult, the wires are thin, be careful).  Use a 2 wire connector and solder it to the thermistor then insulate with either heat shrink tubing or electrical tape.

If you didn't get insulating tube, I've made do by soldering the wires as needed then folding some kapton tape around one wire, then another bit around both wires.

When you're done with both of the hotend bits, route the wiring roughly, then insert the thermistor into the small hole in the hotend and secure the heater and the thermistor using enough Kapton tape to wrap around the hotend 4 or 5 times.


Here's where the thermistor plugs in for the hotend.  The other two thermistor inputs are for an optional heated print bed and an optional second extruder.




Hotend fan

Determine where you will attach the hotend fan on the electronics.  On RAMPS 1.4, you can attach it to the D8 power port and the electronics will be able to switch it on and off.  This precludes using that port to run a second extruder though.  You can also just wire the fan directly to the 12v power.  BE CAREFUL to get the polarity correct on the fan - wire it wrong and it'll burn out.

AC to power supply

Get some 16 gauge wire (lamp cord is fine) and some crimp connectors.  The AC connector that I use requires at minimum a jumper to go from the output of the fuse over to the switch, then two wires, one from the neutral on the connector to the power supply and one from the other side of the switch to the power supply.  A nice option if you like is to also jumper over from the neutral on the AC connector to the 3rd lug on the switch, which is a light - that way the light inside the switch comes on when the switch is on.  This is totally optional though.


This is a 4 wire AC input module with switch, fuse and AC input jack.  On the switch, the top two connectors are the switch, the bottom two are the lamp inside the switch.

I've seen two kinds of switches in these AC power assemblies, one has three and one has four connectors.  The three connector ones just have the light hooked up to the switched side internally, so that just saves you making one connection on the outside.


Use a voltmeter to determine which two wires short out when the switch is "on".  The other one or two conductors is the light.


These modules always have the hot side of the AC power jumpered permanently to the fuse compartment. 


First, you need a short jumper to go from the fuse to the switch - on a 3 wire switch, use the one farthest from the lamp connector.  On a 4 wire, either one.  This is the short orange jumper on the left in the photo below


Next, you need a connector on a long wire connected to the common on the AC jack, and also connected to a short jumper to go over to the light terminal if you're going to use the light.  On a 4 wire switch, either light terminal is fine.  This is the black wire set in the photo below.


Finally, you need a connector on a long wire connected to the second terminal on the switch - this takes live power over to the power supply.  On a four wire switch, you'll also need a short jumper to take the live switched power over to the light.  This is the orange jumper set on the right in the photo below - on a 3 wire, there won't be any short jumper on this connector, since it's already connected inside the switch for you.

This is how a 4 wire AC input module is wired.


This is a three wire AC input module all wired up and mounted.

Also, I don't show it here, but the ground strap (the terminal on the very bottom) should be wired to the ground screw on the power supply. I inadvertently omitted this step earlier because it was too obvious and I was concerned about getting the actually difficult wiring straight.


DC power from power supply to electronics
Get a pair of 16 gauge wires long enough to route from the power supply to the electronics along a reasonable path with the wires arranged to not get snagged on any moving parts.  Lamp cord is acceptable but be careful of polarity since it's all one color.  Basically, hook up plus to plus and minus to minus.  Check the polarity very very carefully, about 10 times, before you turn it on for the first time.  If it's swapped, you're buying new electronics.  I honestly power up without motor drivers or LCD panel plugged in the first time until I see an LED glowing - if I screw up, it's that many fewer things to buy.

On RAMPS 1.4 electronics, hook up to the large power connector on the two wires closest to the edge of the board, labelled "5A" for 5 amps.  This powers everything on the printer except the heated print bed.  If you are going to have a heated print bed driven off 12 volts, you'd need to hook up a 11 or more amp supply to the other input as well, but without a print bed you can just leave that unpowered.


4 comments:

Iason Giraud said...

the ground wire for the switch with fuse doesnt need to be connected onto the psu?

John Ridley said...

Yes, it should be. I have added a note. Sorry, I always do connect that but it was lost because I was worried about getting the actually confusing wiring done and forgot to mention the "obvious" ground strap.

Of course, it'll work without that, but with these cheap power supplies it's more important than usual.

Dorotea Td. said...

Any change you have a picture of the completed board (or a diagram for reference?) I'm especially confused about the endstops- you have 3 connectors on the board but only 2 wires connected to the endstop itself. Maybe I'm just confused.

John Ridley said...

I don't have a RepRap printer in house currently so no more photos, but basically if you have mechanical endstops (simple switches) you need to not wire the power connector. On the RAMPS, starting on the endstop connection closest to the edge of the board, they are labelled S-+

This means the S is signal, - is ground, + is power. Do not wire anything to the +. Wire switches between - and S.

If you use a powered electronic endstop, such as a hall effect or optical endstop, then you need to use the power. If you wire anything to the +, you may short out the power when the switch closes. This would be bad.