Set Up RAMPS (Arduino, RepRap) Electronics for a CNC Router

11,769

53

12

Published

Introduction: Set Up RAMPS (Arduino, RepRap) Electronics for a CNC Router

About: Please see this Instructable they refused to list https://www.instructables.com/id/Hammer-Time-Arduino-Hammer-Pendulum-Clock/

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
  • Heatshrink
  • Solder + soldering iron
  • Heat gun
  • Multimeter
  • 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.

Share

    Recommendations

    • Clocks Contest

      Clocks Contest
    • Oil Contest

      Oil Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    12 Discussions

    So it looks like you're not controlling any of the spindle via RAMPS? If you are, select BOARD_RAMPS_14_SF (spindle, fan).In your board's pins.h scroll down to where it defines the controls and adjust them as you want. I changed my spindle PWM pin to 10, i.e. the main extruder output.

    7 replies

    So after you assign the pins do you send the signals to an ESC then from ESC to a spindle ??

    Nope! Spindle is Standard DC, Just send the PWM to the spindle via MOSFET. You can use a resistor and capacitor to help smooth it or some spindles come with inbuilt control units that you can hack to accept PWM

    Interesting, I have never really understood what MOSFETS do. I know they are a gate controlled switch or something like that, correct me if I'm wrong. So the spindle has its own power supply, separate from the ramps board. I would connect the Spindle power supply to the MOSFET as well as connect the MOSFET to pin 10 (or whatever pin I assign). From there the MOSFET releases power to the spindle based off the PWM originating from pin 10 ?? Am I on the right track?

    So a MOSFET is a form of transistor, which basically allow you to scalable control a larger power with a smaller one. You get NPN and PNP versions, the important distinctions aren’t that NPN are more common and you put them on the NEGATIVE side of your load. In fact the MOSFETS on the RAMPS1.4 (if those on spec) are pretty powerful things and at be able to control some spindles without too much trouble.
    However yes, you connect your spindle to the supply +ive, the spindle -ive to the MOSFET, the mosfet to the supply -ive.

    Google “controlling a high power motor with a mosfet” to get a good feel for it :)

    Awesome thanks for the reassurance and clarification. So I guess heres the big kicker for me conceptually. With this setup will I be able to control the PWM via a CAM software, or will I just be able to program Marlin with a set PWM and change it manually.

    So just like you can change your nozzle and bed temp via PWM, you will be able to change the speed. Keep in mind that sending it pure PWM will mean the motion isn’t entirely smooth and you really do want to send it via a controller or a smoothing circuit. I have a wiring diagram on how to do that somewhere but I doubt I’ll find it this century, damn my clutter...

    If you could draft one up for me I would be forever grateful haha. Regardless, the information you have provided me has helped quite a bit. I just ordered a Logic level MOSFET and will be attempting to implement the changes to the spindle and Ramps board later this week. The only thing I am still unsure about is where to attach the - pmw signal wire, could I just attach it to any - lead on the ramps board or should I try to create a circuit with one PWM wire? Thanks again for the advice

    Hi, by setting TEMP_SENSOR_0 = 0 and commenting the error line "#error "TEMP_SENSOR_0 is required", the compiler return another error error: 'class Temperature' has no member named 'print_heaterstates'. Please, how to solve this issue?

    1 more answer

    I made this Instructable in late 2016 so the firmware has probably changed since then. I checked the Marlin website now, and it looks like you need to define a dummy thermistor (998) with a set temperature then set TEMP_SENSOR_0 998. If you're using the latest Marlin version.

    Hi, by setting TEMP_SENSOR_0 = 0 and commenting the error line "#error "TEMP_SENSOR_0 is required", the compiler return another error error: 'class Temperature' has no member named 'print_heaterstates'. Please, how to solve this issue?

    0
    user
    bbou

    1 year ago

    Thank you.