I like the RAMPS electronics that my RepRap runs on, so when I decided to build a CNC router, I wanted to run it on the same technology. I set up the electronics with two Y axis motors and 2 Y axis stepper drivers for extra torque.
You will need (see 0:59 in the video):
- RAMPS 1.4 board
- Taurino board - based on Arduino but can handle higher voltage and current
- RepRap wiring kit, with 1 metre wires. You can make your own cables, but the wiring kit is cheap and easy.
- 4 x DRV8825 stepper drivers
- 6 x opto endstop boards - I used ones from the original RepRap, but various other opto endstop boards will work
- 4 x stepper motors. I'm using Nema 23 motors. For the X and Y axes, I'm using motors with a 1.8 degree step angle, and for the Z axis, I'm using a motor with a 0.9 degree step angle.
- ATX computer power supply, or any power supply with 12-24V at 15A or more
- Download Marlin firmware from github: https://github.com/MarlinFirmware/Marlin
- Solder + soldering iron
- Heat gun
- Cable ties
- Electricians' tape
Wire up the motors to the 4-wire motor cables from the RepRap wiring kit
3:06 Stepper motors often have 8 wires - this is called a unipolar configuration. In the video, the motors are already prepared to have 4 connections, but you'll probably have to connect the 8 wires together in the correct order so that the driver chips can control them.
4:46 I talk about how to connect those 8 stepper motor wires together. Technically speaking, this means wiring a unipolar stepper motor in a bipolar configuration.
5:40 I Googled the motor serial number and found the data sheet. The first image shows the diagram of the motor coils and wires from the data sheet. I've drawn red lines between the wires I joined together, and the blue lines show the wires that you need to solder to the 4-wire motor cable. The colour codes of the wires coming from your motors will probably be different, but the aim is to connect each pair of coils together as shown in the diagram.
The second image shows the most common 6 - wire stepper configuration. In this case, you'd ignore the 2 wires that I've coloured orange, which are connected to the middle 2 pins of each pair of coils.
If you can't find a datasheet for your motors, it is possible to work out which wire is which using a multimeter, but I won't cover that here because I don't want to overload this Instructable with details.
7:02 How I soldered the wires from the middle of the coils together, protected the joints with heatshrink, and tidied the wiring with cable ties. I could have cut those wires back a bit before soldering them, to make the wiring neater.
7:13 Finally, soldering the motor wires to the 4-wire motor cables, and protecting the joints. I used electrical tape plus heatshrink, but it's better to use heatshrink of the correct size instead.
8:41 Use a heat gun to shrink the heatshrink - don't use the soldering iron like I always do!
9:56 Wire the endstop boards to the 3-wire endstop cables.
10:40 Prepare the ATX power supply..
11:15 If your ATX power supply still has its motherboard connector, cut the motherboard connector off the end of the wires.
12:40 Unplug the RAMPS terminal plug (with the screw connectors) from the board. Strip the ends of 2 yellow (12V), and 2 black (Ground) wires from the ATX, and screw them into the RAMPS terminal plug. The RAMPS board has + marked next to the terminals that should be connected to the 12V wires. Strip the end of the green wire, and screw that into one of the terminals with a black wire. That's essential to turn the ATX on. Cut the rest of the wires back so that there's no exposed metal, and tape or cable tie them out of the way.
13:00 Don't plug the terminal plug into the RAMPS board quite yet! Plug in the ATX and turn it on. Use a multimeter to check that the terminals that are marked + on the RAMPS board are being supplied with 12V.
13:20 Connect the RAMPS board to the Taurino.
13:30 I had to remove the DC jack plug from the Taurino so the RAMPS board would sit correctly.
15:06 Plug in the terminal plug into the RAMPS board, turn the ATX power supply on, and check that the LED on the Taurino lights up (and beware of the magic smoke..!).
15:20 Connect the Taurino to your computer using a USB cable.
Configure the Marlin firmware
15:28 Download a copy of the Marlin firmware and open it in the Arduino application. Click on the Configuration_adv.h tab.
15:30 Uncomment #define Y_DUAL_STEPPER_DRIVERS (by removing the // at the start of the line). For a leadscrew driven machine, set #define INVERT_Y2_VS_Y_DIR to false. For dual Y belts, this should be set to true.
(not shown in video) Click on the Configuration.h tab. Check the #define MOTHERBOARD line - it should be set to #define MOTHERBOARD BOARD_RAMPS_13_EFB
16:30 In Configuration.h, set all the temp sensors to 0:
#define TEMP_SENSOR_0 0
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 0
[This is where the video is a little bit backwards - you should use the method described at 20:00 minutes to find the steps per unit for each motor, and write them into the #define DEFAULT_AXIS_STEPS_PER_UNIT line in Configuration.h. The Prusa Step Calculator is at http://prusaprinters.org/calculator/ - I used the one for leadscrew driven machines. The option that says 1/64th stepping actually means 1/32nd]
Click Tools -> Boards and select 'Arduino Mega 2650 or Mega ADK'. Upload Marlin to the Taurino.
16:40 Open Printrun / Pronterface and click Connect. You should be able to connect to the Taurino with any errors.
[backwards video again - plug in the jumpers that came with the stepper drivers, as described at 20:50 in the video]
16:47 With the ATX turned off, plug the stepper drivers into the RAMPS board, with their trimpots (the little silver adjustable dials) pointing towards the USB plug. Plug them into the X, Y, Z, and E1 slots. Turn all the trimpots all the way down (all the way clockwise). Stick the heatsinks on to the driver chips.
17:30 Turn on the ATX, check for smoke, and check the heatsinks aren't heating up.
17:40 Plug a motor into the X axis plug on the RAMPS board.
17:44 In Pronterface, set the XY speed to 50mm/min or less, and try to move the X axis. The motor probably won't move.
18:15 Use the trial-and-error wiring method I describe at this point in the video, until you get the motor running. If your motors are all the same model, copy the wiring order you found to all the motor plugs. Look at http://reprap.org/wiki/Stepper_wiring under Methods and Procedures, Trial-and-error method.
22:25 After those 2 steps I did out of order, the X motor is turning correctly when jogged from Pronterface. Once the motors turn, you can play with the feedrate in Pronterface to find out how fast you can make them turn. Don't turn up the trimpots on the stepper drivers yet, though. You should connect a fan first.
24:58 Plug an endstop in to the X-min endstop plug on the RAMPS board.
25:09 Type M119 into the Pronterface console and press Enter. Marlin should report the status of the endstops.
25:19 If the X min reports TRIGGERED and the others show 'open', you probably have
const bool X_MIN_ENDSTOP_INVERTING = true;
set in the Marlin Configuration.h. Open that file again and change all the ENDSTOP_INVERTING lines to false, and make sure that all the #define ENDSTOPPULLUP lines are uncommented. Close Pronterface and upload Marlin to the Arduino again.
26:13 Type M119 into Pronterface and press Enter. Now all the endstops should report 'open'.
26:25 Place a piece of aluminium foil into the X-min endstop and type M119 into Pronterface and press Enter again. Now X-min should report TRIGGERED.
Plug in all the endstops and test that each reports TRIGGERED when you insert aluminium foil into the gap.
27:11 You can also test the homing routine. Press the Y home button in Pronterface. The Y motor should start to turn. Then insert the aluminium foil into the gap of the Y-min endstop. The Y motor should reverse direction. Remove the aluminium foil from the gap, then put it back in again. The Y motor should now stop.
That's it! The electronics are ready to install in your CNC router or milling machine. Once they're installed, and you arrange a fan to cool the stepper drivers, you can tune the motors up a bit more.