Controlling 5 axis CNC using arduino uno

Hi everyone! I'm new to arduino and I found myself in a project that is challenging to me. The project is converting a mill into a 5 axis cnc and controlling all 5 steppers using arduino. I did some research online and watched a few tutorials and I believe I understand how to control 3 steppers using grbl. A friend is sending me an arduino uno with a CNC shield (not grbl but grbl compatiple) and 4 stepper controllers. The CNC shield has 4 spots for controllers labeled X, Y, Z, A. So I assume with that shield I can control 4 axis. ( Normal X Y Z and the rotational A axis). The setup has to be able to understand g code of course and I assume it will need to control all steppers simultaneously. Also, in the future I plan on installing optical sensors on the stepper shafts to monitor the position, making it a closed loop system. Meaning that if a stepper misses a step the sensor will pick it up and make sure all the steps are completed. So I need my setup to have the capability to do that. Now I have a few questions.

  1. How would I wire a fifth stepper? Also what other hardware would I need? And is this even possible using arduino uno? A friend (not a reliable one) mentioned that I can "stack" the shields giving me the ability to control 8 steppers.

  2. What software or code do I need for arduino to understand g code for 5 axis? I heard that grbl can only control/understand only 3 steppers. And I also heard that it can only control one stepper at a time. If that is the case, is there something else I can use?

  3. I'm having trouble finding a good 5 axis CAM software for generating toolpath and g code. I would love one that works with solidworks... Anything in mind?

  4. How would I go about connecting my optical sensors to ensure that the steppers complete every step? I was also thinking of a few other sensors to slow down the operation if the mill bit encounters too much resistance. Any Ideas on how I would wire them and program them?

  5. And finally I need to install limit switches to make sure the CNC doesn't move out of the set limits. How would I wire those?

I'm sorry for the long post but I was thinking I should get as much answered in one shot. Thanks in advance!! P.S Im thinking of doing a full writeup tutorial on this project if anyone is interested and if it is successful.

If you think of the CNC shield as just a connector for the stepper drivers (are they A4988s?) you should (in theory) be able to connect another driver to an Arduino. The "theory" depends on whether you have enough spare I/O pins. You will probably need three pins for step and direction and for a limit switch

I don't know anything about GRBL but I suspect it is too complex to easily modify for extra motors.

It would not be all that difficult to write code to drive 5 stepper motors - especially if you do as much of the heavy lifting as possible on your PC. I have written code for 3 motors that could easily be extended to 5. But it depends on a Python program on the PC to interpret simple GCode.

The main stumbling block could be the speed at which you want to send step pulses to the motors. If you want a high rate of pulses (perhaps for microstepping) the 16MHz Arduino may not be fast enough for 5 motors. However if the Arduino does not also have to interpret GCode (which is what GRBL does) it should have some extra capacity.

...R Stepper Motor Basics

The RAMPS 1.4 board has room for five stepper controllers. You need an Arduino MEGA 2560 (or clone) to run it. They are inexpensive (under $30) when you purchase a set (MEGA + RAMPS 1.4 + 5xDrivers) from China or Hong Kong via eBay. It has inputs for six limit switches and three MOSFET outputs: 2x5A and 1x11A.

For example:

http://www.ebay.com/itm/2015-New-Kit-5PC-4988-Driver-Mega2560-R3-3D-Printer-RAMPS-1-4-Control-Board-/171771853536?pt=LH_DefaultDomain_0&hash=item27fe667ae0

That's great input guys! So robin2 grbl is a shield for arduino for controlling steppers. It comes with its own software that gets burned onto arduino. Arduino can't interpret g code so the grbl software does it for arduino. Unlike other arduino code the grbl software comes in a hex file and has to be programmed onto the arduino. But I think grbl software can only interpret 3 steppers.

johnwasser: The RAMPS 1.4 board has room for five stepper controllers. You need an Arduino MEGA 2560 (or clone) to run it. They are inexpensive (under $30) when you purchase a set (MEGA + RAMPS 1.4 + 5xDrivers) from China or Hong Kong via eBay. It has inputs for six limit switches and three MOSFET outputs: 2x5A and 1x11A.

For example:

http://www.ebay.com/itm/2015-New-Kit-5PC-4988-Driver-Mega2560-R3-3D-Printer-RAMPS-1-4-Control-Board-/171771853536?pt=LH_DefaultDomain_0&hash=item27fe667ae0

John I love your idea about the arduino mega!! That definitely solves my hardware problem. What would I use to interpret the g code on arduino? As I mentioned before I think the grbl software can only interpret g code for three motors. And to avoid any confusion I'm not going to write the g code myself. The CAM software is gonna analyze my CAD drawing and generate tens of thousands of lines of g code that are going to get streamed from my computer to arduino.

GRBL is software. It interprets G Code. RAMPS is the hardware.

There are many CNC Forums. It may be useful to look at some of them.

...R

The 'R' in RAMPS stands for RepRap (RepRap Arduino Mega Pololu Stepper driver). You can find assorted firmware at the RepRap site: http://www.reprap.org/wiki/List_of_electronics#RAMPS That lists the available firmware as Repetier, Marlin, Sprinter, and Teacup

1 Like

Thanks guys! I appreciate the help! I'll check out the reprap site and let u all know how that goes!