CNC Hardware: Stream G-code To An Arduino

[Reza Naima] has been using an Arduino as the center of his CNC setup for quite some time now. It handles three stepper motors, limiting switches, e-stop, and spindle control. The sketch he’s using allows him to stream g-code to the popular prototyping platform, freeing him from needing a dedicated PC. It’s worked so well that he’s decided to clean up the code and develop a shield to help others get up and running. If you want to see his progress or lend a hand, check out the google group he started for the schematics, code, and forum discussions. There is already a CNC project for Arduino called Grbl but [Reza’s] approach uses the Arduino libraries in an effort to make the sketch more customizable for the average user.

19 thoughts on “CNC Hardware: Stream G-code To An Arduino

  1. i’m doing something similar with an xmega-based controller board, but instead of building a g-code parser, i’m piggybacking on the work of the reprap folks and their sanguino3g protocol, which is cheap to implement on the microcontroller side. plus replicatorg is pretty decent software, even if it is biased toward 3d printers.

  2. what is the max step rate using the Arduino.
    for one axis to move at 100ipm with a lead-screw pitch of 5tpi and using a driver in 8th step it would require a pulse train of ~13khz. (100*5*200*8)/60
    200 steps per revolution stepper motor

    a fpga would be much faster despite the increced complexity
    smooth stepper

  3. I know enough to know that this is quite impressive, even though I don’t yet know CNC coding.

    Being able to implement this in a shop environment with a dedicated switching array could completely cut out another computer from the mix, and a possible choke point by infection.

    This is very impressive- I really welcome further development of this.

  4. @bud

    The smoothstepper is pretty much dead. No software updates. Promised features never materialized. I have a small lathe with one.

    Still the best bet is using the parallel port with Mach3 or EMC2. Sounds like the little microcontrollers have a hard time keeping up, lots of processing to do when doing circ int.

  5. Hi all –

    Thanks for the words of encouragement. The controller board is designed to handle 35V @ 2A per winding (2 winding per motor -> 16A total).

    The firmware started from the reprap codebase, but 99% of it has been re-written (the only remaining part is how circles are computed). The biggest problem with the original code was that the steps were not spaced out equally and could cause badness (I can elaborate but it probably will not interest the majority here). I played around with a number of algorithms till I was able to get the timings evenly spaced (to within 1uS).

    If possible, let me know if you would prefer having this designed as a shield or add an AVR+FTDI chip to make it self sufficient. Please post your response here and your reasoning.


  6. @ Reza – Do both designs, then it gives the complete novice a buy once unit, whereas arduino enthusiasts would more than likely appreciate a shield and anyone more advanced can adapt the shield and add their own mcu configuration.

  7. Hi Reza,
    I’ve seen your video. Nice work! Did you build your DIY-CNC by yourself or based on an existing design on the web?
    I’m just asking because I plan to build a 3d printer by myself but it should be good for milling pcbs as well!


  8. Hi Nice work indeed, any possibility to buy one of these Rstep boards in near future, i currently working on a couple of small and medium size 3 axis mills. this seems to be the perfect choice of controller. I already have almost ANY TYPE of Arduino in my stock + a couple of Sanguino as well. currently running 1 mill on EMC2 and a 3 axis Stepper Motor Driver Board Controller TB6560. works fine but i really love working with the Arduino, but sadly not an expert into soldering and components.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.