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.

Comments

  1. klk says:

    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. Jacob says:

    Interesting.

    Whats the volt/amp limit for stepper motor using the arduino? Or is that dependent on supporting hardware?

    -Jacob

  3. xeracy says:

    Did anyone find any actual schematics?

  4. zerth says:

    @xeracy

    There’s a circuit layout about halfway down.

    http://groups.google.com/group/rstep/browse_thread/thread/4b66f5c0c16738a7#

    @jacob
    You’d want an hbridge or a darlington array for the actual switching, arduinos only do a few mA.

  5. chris says:

    Nice! more like this!

  6. Flood_of_SYNs says:

    I believe the max current is about 40mA for the microcontroller pins.
    It has been awhile since I read the datasheets though.

  7. bud says:

    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 http://www.warp9td.com/

  8. drew says:

    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.

  9. Gottabethatguy says:

    Sweet, I’ve been thinking of doing something similar, this will really help.

  10. macona says:

    @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.

  11. Buzz says:

    THis looks a lot like what the reprap project has been doing now for about 5 years. Yes, the reprap runs on an arduino and gcodes and stepper motors!

  12. reza says:

    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.

    https://spreadsheets.google.com/viewform?formkey=dEVkUGFIcVJITjNPSkdjcXNMalhYbXc6MQ

    Thanks!

  13. xtreker15 says:

    Thanks for posting I would really like to do something like this. I know more of the G code side of this than the electrical side so I think this might help.

  14. blue carbuncle says:

    Like the build! Nice and clean and easy to understand :)

  15. Reggie says:

    @ 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.

  16. reza says:
  17. donov4n says:

    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!

    BR

  18. reza says:

    @BR It’s built form a kit from here: http://zentoolworks.com/

  19. Per-Albert says:

    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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,978 other followers