top of page

Arduino Mega 2560

RAMPS 1.4

Stepper Motors

Stepper Motor Drivers

Connections

Arduino
RAMPS
Step Motor Driver
Stepper Motors
Connections
The power supply unit ("PSU") is the 3D printer's main source of power that will power all the motors, hot end, and heat bed. The Arduino itself needs little power an generally the USB cable from your computer is sufficient to power it, but not enought to power the entier printer. It might be possible to power the printer using your (desktop) PSU but i wouldn't risk it given that PSUs are pretty inexpensive.
 
The following instructions will explain step by step how to modify a standard computer PSU to power the 3D printer. Once you've completed the process, you'll realize that it's pretty simple.
 
  • Time Required:    3 hours
  • These are generic instructions that apply to any ATX PSU
  • Any computer PSU should work as long as it provides at least 350W needed to power the Wallace G1 
 
Unboxing
                                    Front Cover                                                                                                      Back Cover
In the box, we have the ATX PSU packaged in bubble wrap, a power cable (to connect your 3D printer to your power source) and a small plastic bag with four black screws.
You will need to buy a terminal block strip (12 position or 2 x 6 position) as well as a 47 Ohm resistor of any size (I used a 56 Ohm resistor ).
You will need a simple resistor to connect two of the wires later on. Those two wires are a circuit that power a computer's inner clock even when the computer is turned off, it also acts as a switch in a PSU.
 
Here is what the Ohm resistor that I used for my PSU looks like. The green, blue and black stripes tell us how many Ohms of resistance this specific resistor provides. I've also included a little chart that can help identify how much resistance the resistor provides. In our case you can read the colour bands as follows:
 
  • 3 bands means a 2 digit number multiplied by a single digit 
  • Green = 5  and Blue = 6  
  • Black as the last stripe  = x1
  • 56 x 1 =  56 ohms 
To perform the required tasks you will need the following tools:
 
  • Electrical tape
  • Soldering iron and Solder
  • Phillips screwdriver
  • Slotted screwdriver
  • Small cutting pliers
  • Long nose pliers that can strip electrical wires 
Now we begin to perform the electrical surgery!  
 
We begin by carefully removing the cover of the PSU. You will usually find the screws we need on the fan side of the PSU. Start by unscrewing the four screws which are the closest to each corner with a phillips screw driver. Becareful not to unscrew the screws that hold the fan in place. Make sure the PSU is unplugged (i.e. not electricity) before opening the PSU !
 
Once the 4 screws removed, you will need to lift the cover off of the PSU. There are a few tabs that hold the lid in place by pressure and with a tongue and grove. A slotted (flat) screw driver may be helpful to get it open without bending it.
Here's what's inside.
(click image to enlarge)
Find the little white jack which is connected to and powers the fan. Gently disconnect it with pliers as shown below.
Snip and cut the hard plastic tie that holds the bundle of wires leaving the PSU so you can losen up the pile to work with it. Once done, look for a lone grey wire (PG) and using the small pliers cut the wire as flush to the PCB board as possible. 
Locate the orange wire (looks red on the picture but its orange) that connects to the PCB board where it's labled (S+). Cut the orange +S sense line to 50-70 mm.
Find the blue wire that connects to the PCB board near the side wall of the PSU. Cut the blue wire labled (+12 V) on the board. Try to cut it as flush as possible at the PCB level.
Next, Cut two red wires labeled (+5V) on the PCB board. Try to cut them as flush as possible to the PCB level. Add non-conductive tape to the ends if needed.
 
 
 
Once you've cut the wire it looks like this.
 
We don't need 3.3V power provided by the orange wires for any of the elements in the 3D printer.
 
 
So cut all of the orange (3.3V) wires as short as you can except these two. 
 
 
Cut the last tw0 remaining orange wires leaving a length of 50mm to 70mm.
 
 
Strip the two orange wires to expose the metalic wire.
 
 
 
Expose the metallic wires ... 
 
 
 
Solder the two wires together.
 
 
 
Twist the metalic wires together ...
 
 
Cover the soldered wires with electrical tape. 
 
We will now look to cut the connector that's normally used to connect the PSU to a computer. 
 
 
 
Decapitated!
Only some of the wires are needed for the 3D printer, so we will now sort them out and cut the unecessary ones. However keep the wires that we cut as they can be reused.
Find all of the other cable clusters and cut the connectors for those as well. Then remove the casing holding al the wires together, you may want to use it later.
 
There are way too many wires for our needs, so we will cut most of them. The ones we want are the yellow and some of the black.
 
 
Cut two blacks from one cluster, and all the blacks from another cluster
Find all of the other cable clusters and cut the connectors for those as well. Then remove the casing holding al the wires together, you may want to use it later.
 
 
Re-connect the white jack on the fan wire to the PSU.
Cautiously reassemble the PSU cover to avoid disconnecting the fan wire. Also make sure to have the tongue inserted into the slot on the sides before tightening screws.
 
 
You may consider braiding the wires by cluster to keep things tidy.
 
Insert each wire cluster into a different slot in the terminal block, and tighten the fastening screws.
Now insert the 56 ohm resistor in the terminal block (opposit side from wires) to connect the green wire and one of the black (ground wires). This turns on an internal switch inside the PSU. This is normally performed by powering a computer's internal clock.
When ready, you will connect the RAMPS 1.4 to the terminal block to get power. From the green power block on the RAMPS 1.4, first connect the negative (- same as gnd) to the black wire on ther terminal block. Then connect the (+) on the green terminal block on the RAMPS 1.4 to the red wire on the terminal block. This pair powers all of the motors and the hot end on the printer. Repeat the exercise with the next (-) and (+) from the green terminal block on the RAMPS 1.4 to the terminal block, this pair powers the heat bed on the printer. 
This is the Arduino Mega 2560 (called [   ] outside the U.S.). This is very popular a small low cost computer. In fact it's so cheap that most people building electronics will build it around the Arduino even though it provides way more computing power than is really needed for simple devices. Its so affordable that people will buy and include an Arduino in each device they build as opposed to reusing (plug and un plug) the Arduino for other devices.
 
The Arduino Mega 2560 is similar to a Raspberry Pi computer but different in many ways. A Raspberry Pi is designed to be a small extremely inexpensive widows type personal computer with graphic capabilities etc. However an Arduino is a computer that is designed to control other devices and it assumed that the Arduino will be controlled by another computer like your laptop ... or even a Raspberry Pi.
 
Since it's intended to control other devices such as motors, it's built with the capacity to use and direct more power to it's pins to control a wider range of motors sizes and type. It's also built to use certain computer languages including G-Code.
 
So your PC does the computationally intensive calculations and processing, then translates the instructions to print to G-Code. Your PC then sends these G-Code commands to the Arduino computer which takes these software commands and interprets them and then turns switches ON and OFF sending electrical pulses and power to specific metal pins (inside the black sockets along the edges). Those pins are ultimately connected to electrical devices like motors, heaters, and fans that perform a task. 
The RAMPS 1.4 is a circuit board (also called a shield) that was developped to make it much easier to connect the various motors and seperate power feeds to the Arduino Mega 2560. This board is not a computer, it doesn't have a microchip, it's best to think of it as an adapter. It was developped since 3D printers have the same electronic architecture and would be very useful, save time, and money for anyone building a 3D printer and some CNC machine build on the very popular Arduino Mega 2560.
Below is a diagram that labels what is what on ths Ramps 1.4. Remember that the Ramps 1.4 is really a compact adapter to plug in many devices. It also allows us to use 12V to power motors and heating elements, but this voltage could fry an Arduino.
 
Technical info:   http://reprap.org/wiki/RAMPS_1.4
A stepper motor driver is a specialized chip that receives electrical pulses from the Ramps 1.4 and then interprets these signals (commands) and then sends electrical pulses out some other pins towards the stepper motors. 
 
A stepper motor can be controlled by many types of stepper motor drivers, in this case we use A4988 chips but there are others that exist with different characteristics.
 
Since these chips are small and they can let through several amps of power, the chip can get very hot. When it gets too hot, it has a feature that switches the chip off for a fraction of a second or more to allow it to cool down, and then continues. Guess what happens when you have 4 of these doing different tasks in a synchronized manner and one of them decides to shut down for a fraction of a second ... everything gets unsynchronized !   To help avoid this, you should add a "heat sink" on the micro chip (the black square) to help it cool down. 
 
The heat sink will suck the heat away from the chip since it conducts heat. Heat will move from hot place (the chip) to cold place (the heat sink). You can also add a small fan to help even more. Becareful to not create a short circuit on the top of the stepper motor driver when installing the heat sink.   
We had mentioend in the previous section that there are 2 coils that push and pull at the same time. This diagram describs what each pin does and labes the positive and negative for coil 1 and coil 2.
 
When connecting the stepper motor you may need to do a bit of guess and check to get the right pairs together. Try a grouping, test, try another grouping until you get a rotational movement that makes sense (not move and click!). Don't worry about the direction of the motors' rotation since this is usually corrected in the Repetier-Host and/or the Arduino Firmware.
The main parts of the Arduino Mega 2560 are labled above, where the Mega 2560 is the brain of the board. Its this micro chip that receives G-Code commands from the Mini-USB port (top left), processes them, and sends electrical pulses to the pins.
 
The LED lights are indicators to let you know that it's on and working.
 
Technical info:   https://www.arduino.cc/en/Main/arduinoBoardMega2560
There are two very common types of motors used in elecronics: Servo motors; and Stepper motors. Servo motors are found in all kinds of electric toys like cars, boats, planes etc. They are really simple when you give it electricity, it turns. In fact if you invert the positive and negative wires, the motor will turn in reverse (we call this bipolar). Simplicity over precision.
 
Stepper motors are electrical motors that are designed and built to be very precise, but are more complex. If you just give it electrical power, it does nothing. It won't move. This is because of it's design. To be very precise (1 step = 1.8 degrees and the ability to do fractional steps for small fraction of degrees per micro-step) you have to "push and pull" at the same time. It's like a foot on the gas and a foot on the break at the same time.
A stepper motor will have at least 2 positives and 2 negative wires and a permanent magnet. So one coil with a positive and negative wire is placed next to and perpendicular to a second coil with a seperate positive and negative. To create the rotation movement, the first coil will generate a positive magnetic force near the positive pole of the permanent magnet core while at the same time (or shortly after) the second coil will generate a negative magnetic force near the permanent magnet. Since the permanent magnet is locked in place and can only rotate, it will rotate away from the positive magnetic force and towards the negative magnetic force. Switchinf these coils on and off will cause the rotor (attached to the permanent magnet) to rotated. To stop the rotation, simple inverse the sequence of the coils switching on and off. This is called bipolar stepper motor which is what we need to use.
 
A stepper motor doesn't have mechanical pieces inside, it's all magnets. If you hear grinding don't worry, it's just the noise of magnets and coils playing tug-a-war. Stepper motors don't ware out since there's no friction, however the soldering that attached the wires to the motor can soften and melt if the motor gets too hot. This can happens especially with cheap motors then they are useless.
 
You probably realized that this is tricky stuff which is why there's a little device that takes care of this for us which is called a Stepper Motor Driver.
 
Once the stepper motors drivers and plugged into the Ramps 1.4, and the Ramps 1.4 is plugged into the Arduino Mega 2560, this is what it looks like. So this is brain, spine and organs, now all that is left to do is connect the limbs.
Last step once the JR connectors are attached to the wires coming from components is to connect all the components together. This is how all of the actual devices must be connected to the Ramps 1.4.  (click to enlarge). 
Here are some common wire configurations
Stepper Motor

1B

2B

Endstops

Endstops

Heat Bed

Heatbed
Endstops are switchs that you place and attached the the end of the X-Axis movement, the Y-Axis movement, and Z-Axis movement to tell the printer software to stop because the printer has reached its limit. They are a safety mechanism to prevent damage, but they are optional. Its a good idea to install some if you plan on leaving the printer printing unattended for a long period of time. The idea is to position the switch so the print bed or print head presses the switch if it has gone too far.
 
There are two kinds of switches, mechanical and optical. Personally I like the mechanical endstops as its a matter of fact of the switch has been hit.
Mechanical Endstop
Optical Endstop
Heat beds are a component of a Print Bed. The print bed is the surface that you will be printing on and in most printers the pring bed surface is designed to move around. The heat bed is a very useful part of the print bed. It's purpose is to heat the print bed surface to help:
            1) the print job stick to the surface
            2) to help control the natural tendancy of prints to curl towards the middle
 
The technical challenge when printing it that not all of the print is the same tempurature at the same time. When the plastic leaves the extruder, its very hot (around 200 C ) while room tempurature is around 21 C.  Once the plastic has been printed on the bed, it starts to cool. As it cools the plastic tends to shrink. If it shrinks too fast it will curl since the extremities are colder than the middle ... like fingers in winter !
 
The trick is to provide a heat source from the bed at 60 C to slow the cooling process a little such that the print cools at a slower speed such that the shrinking/contracting force is reduced below the strength of the plastic. Then even if the plastic wants to shrink as it cools, it doesn't have enough force to make the piece curl.
Heat beds are a component of a Print Bed. The print bed is the surface that you will be printing on and in most printers the pring bed surface is designed to move around. The heat bed is a very useful part of the print bed. It's purpose is to heat the print bed surface to help:
            1) the print job stick to the surface
            2) to help control the natural tendancy of prints to curl towards the middle
 
The technical challenge when printing it that not all of the print is the same tempurature at the same time. When the plastic leaves the extruder, its very hot (around 200 C ) while room tempurature is around 21 C.  Once the plastic has been printed on the bed, it starts to cool. As it cools the plastic tends to shrink. If it shrinks too fast it will curl since the extremities are colder than the middle ... like fingers in winter !
 
The trick is to provide a heat source from the bed at 60 C to slow the cooling process a little such that the print cools at a slower speed such that the shrinking/contracting force is reduced below the strength of the plastic. Then even if the plastic wants to shrink as it cools, it doesn't have enough force to make the piece curl.
PCB Heat Bed
Silicone Heat Bed
There are two types of heat beds, the PCB heat beds and the silicone heat beads. Both work the same way, with think heating traces (wires than can get really hot without melting) that zig zag back and forth under the surface. When you run electricity through them, they heat up. 
 
One pair of wires are connected to the heating traces. You can use either one as positive and the other as negative.
 
The other pair of wires is connected to the thermistor. The thermistor is an electrical thermometer which can helps control the temerature of the heat bed. The thermistor is a resistor whose resitance changes with tempurature: NTC thermistor's resistance drops as the tempurature rises, a PTC thermistor does the opposit. We use NTC thermistor. The Arduino can measure the amount of resistance in the circuit, and your PC (Repetier Host) has a table in memory that it compares the measured resistance to. When the reading corresponds to a tempurature that's too hot (based on you selected target tempurature) then Repetier Host tells the Arduinio to cut the power being set to the heat bed (and vice versa).
 
Jumper Configuration
Jumper settings for A4988 Stepper Motor
                     Jumpers
                M1    M2   M3    Description
                No     No    No   Full step
                Yes    No    No   Half step
                No     Yes   No   1/4 step
                Yes    Yes   No   1/8 step
                Yes    Yes   Yes  1/16 step
 
Jumper settings for Drv8825 Stepper Motor
                     Jumpers
                M1    M2   M3    Description
                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/32 step
                Yes    Yes  Yes     1/32 step  
 
If your stepper motor is 1.8 degree rotation per step with jumpers set to yes-yes-yes then you can reduce steps to 1.8 degree / 16 of a rotation.
Most of the electronic components connect to the Ramps 1.4 board using JR 4 pin female and 2 pin female connectors. You will most likely need to attach these JR connectors to the wires coming from your components.
 
Here's a quick video that shows you how to do it:    
JR Connectors
  • Power supply unit of 430W or more
  • Arduino Mega 2560                                       ... called Genuino Mega 2560 outside the US
  • Ramps 1.4 board
  • 5 stepper motor drivers                                ... either A4988 or Drv8825
  • 4 Nema 17 stepper motors                          ... 1.8 degree per step and ideally 4800 g/cm holding torque
  • Heat bed 300mm x 300mm                         ... MKA 2 PCB board type or Silicone type
  • Thermistor for heat bed
  • Hot end (assembled)
  • 1 relay switch for heat be
  • 3 end stops (optional)

Parts needed for this section

Overview of Assembly
(commands flow in opposit direction)
Electronic components
Power Supply Unit
Your     Laptop or PC
Arduino   Mega 2560
Ramps 1.4 board
Stepper
Motor
Driver

2A

1A

Power Supply  .... (you can buy one from our site or modify a regular one meant for computers as follows)

Relay Switch for Heat Bed

Anchor 1
The Heat Bed can suck a lot of power (Amps or Watts) from the Power Supply causing smaller wires or circuits to heat up and melt. To avoid having your Arduino or RAMPS 1.4 boards melting during the heat-up phase of printing, you can either slow down the speed at which your Heat Bed heats up so it draws less power. This is done by adjustinghow many degrees celcius per second the heat bed and heat up in the Repetier Server software or the Arduino Firmware.  However, a software setting can easily be wrongly input leading to real physical damage to your components beyond repare. Or even worse, the wires could get so hot that the plastic coating would melt and wires could cross causing sparks and fire.
​
A safer way to do it is by creating a dedicated sub circuit with a relay switch for the Heat Bed since that component is the one that draws the most power. This way, the power from the Power Supply normally going to the Arduino to power the Heat Bed doesn't go through the Arduino. The power going through the Arduino is only required to turn a electro-mechanical switch on-and -off (a relay switch).
 
Make sure that the wires going to the Heat Bed and Power Supply Unit are thick (or use 3 strands of wire together for each line to reduce the Amps in any one wire to avoid over heating !
 

From RAMPS 1.4

To RAMPS 1.4

From Power Supply Unit

To Heat Bed

From Heat Bed

To Power Supply Unit

From RAMPS 1.4

To RAMPS 1.4

To Heat Bed

From Power Supply Unit

To Power Supply Unit

From Heat Bed

bottom of page