EMC2.4/AXIS over USB w/Arduino and a call to the crowd.

After looking at RepRap, rStepper, Grbl and others, I found that although they are all really cool projects for turning an Arduino into a G-Code parsing CNC controller made by some really clever people. 3-Axis only, or 3d-printing choices only just didn't fit what I was looking for...

An industry compliant solution that accepts custom codes, canned routines, offsets, tool compensation, encoder feedback for closed-loop control and a UI that lets me see what I'm about to make all on a platform that can grow with me AND my machine. All the way up to 9-axises! You know, THE WHOLE WORKS!

Well I'm glad to say I found one, and its free to boot! Called EMC/Linux, its been around for decades and its very well documented. Perfect! Just one problem, how to get this wonderful piece of software to talk to an Arduino that wants to become a CNC machine one day.

After looking around the web for weeks and pouring over documents, forums and posts that said "it can't be done" blah blah blah. I was becoming discouraged.

But, I discovered it could be done! And this is how:

EMC has an underlying interface called HAL, a virtual breadboard or sorts that can do tons of stuff including loading a python script. A python script can use serial communications and talk to one or more Arduino's simultaneously. Interesting...

That python script could then collect the X/Y/Z/Whatever coordinates from EMC's HAL interface and send the data over to the Arduino, the Arduino then moves the machine accordingly and tada! CNC magic happens!

So in a nutshell, here is a sketch, instructions, a python script and a HAL config to interface an Arduino to EMC in a useful way, and all the code is wrapped up inside the sketch for ease of use.

If anyone finds this useful, have any constructive suggestions or code contributions/improvements please let me know.

There's enough code to get a plotter up and running, but hopefully laid out well enough that one could interpret and expand it to their needs.

It currently supports:
Stepper motors (microstepping as well)
A plotter solenoid.
ATX psu control for automatic power up/down
LCD display (alpha)
Closed-loop feedback (Arduino controlled.)
Machine power status LEDs
Power control button that will tell EMC to turn the power on/off.

So check it out at: GitHub - dewy721/EMC-2-Arduino: Arduino + LinuxCNC = Your very own FREE high-end CNC controller.

If you do add to it, PLEASE let me know. It would be interesting to see what others make from it, or a link to it so others can benefit too.

Hack it, mod it, improve it, tag it, post it. This is now a crowd-source project, and its now public domain. Enjoy!

That is cool you started this I am working on emc2 and arduino. It will power a 4x8 router and plasma table (to start with).

I just realized that all your files are ino's don't quite know what to do with them yet. any help would be a great. really exited about this project, I will be trying to get stepper motors to work.

The .ino files you can open with the Arduino software. I'm currently making a stepper version for 4-axies. (3+optional rotary chuck/print head.)

Here's the alpha version if you'd like. This one loses the servo/encoder support in favor of steppers instead. (I added an optional fourth axis to boot!)

I've moved the project over to GitHub at GitHub - dewy721/EMC-2-Arduino: Arduino + LinuxCNC = Your very own FREE high-end CNC controller. were I can facilitate its development better.

What is the difference between: EmcArduino_02b and EmcArduino_04a?

Also, when you edit the my-mill.hal file do you comment out all lines containing "parport" or just the ones that start with "net" ?

GREAT IDEA! This is going to be fantastic, please keep it up.

Sorry about that I should have been more clear about it in the description.

In the HAL file you comment out the lines starting with "net" that refer to parport. This is normally the case, UNLESS you want to take input from the parallel port as well. But that would make for a debugging nightmare should something go wrong. (Limit/home switches for example.)

ie:
#net home-x <= parport.0.pin-10-in
#net home-y <= parport.0.pin-11-in
#net home-z <= parport.0.pin-12-in
#net home-a <= parport.0.pin-13-in

0.2b is the initial public release that has support for making 2.1-axis servo/encoder driven plotters. It just uses 2 moving axies (X,Y) and one solenoid (Z) to deploy a pen/pencil/marker with.

0.4a however has temporarily dropped servo support in favor of stepper control. This version controls four stepper motors simultaneously and was developed using an Arduino Mega2560 and a quadStepper controller from sparkfun. This makes a setting up a 3 or 4 axis CNC a lot easier.

When I get a chance It re-include servo/encoder support and mix-n-match so junk bot CNC building will be just another weekend mashup. :slight_smile: I'm still looking for user input, coding help, and general feedback. So if you use it and need some doodad or feature I'll try to add that into a future release. Wanna help with the code? Just let me know.

EmcArduino_05b has been released.

Completely rewritten code, optimized, documented and cleaned up.
3 times faster than previous versions.
Full support for virtual and/or physical limit and homing switches.

Now supports full 9-axis (non-blocking) stepper motion control, expanded HAL file.

Included example ini file to get your CNC machine up and going fast.

Coders wanted.

Hot off the presses, EmcArduino 06b CNC control has just been released.

Added support for the following:
E-Stop
Power
Start/Run
Stop
Pause
Resume
Program step

Accepting feature requests, if you got one and its related just let me know. :slight_smile:

By the way, it also accepts basic serial commands which makes it an excellent robotics controller!

With 9 non-blocking stepper channels. That's enough to control an entire RC robot with an 7-joint arm to boot! Just feed it serial commands and go.

Enjoy!

Emc2Arduino has been released! (As well as a new Homepage)

Added support for:

  • Spindle control, On/Off, Direction, RPM control.
  • Coolant options, flood and mist.
  • Power Supply control.
  • Power and E-Stop indicator output for LEDs and such.

Were accepting feature requests on our poll.
Cast your vote and be heard by the development team.

Come and check us out at http://emc2arduino.wordpress.com/

Hello,

is there a noticeable speed improvement over outputting step and dir signals through the parallel port ?

Thanks

Parallel ports are generally faster (provided you’re using a suitably fast PC).

Emc2Arduino is really meant for those that:

  1. Have no parallel port available. (Newer PC’s or Virtual Machines for example.)
  2. Have an existing CNC that needs expansion.
  3. Want to toy around with CNC’s (or even robotics) but without buying dedicated hardware.

PS. Sorry for the delay in response. (PC Upgrade complete.)

Dewy

Hi dewy,
first of all: thx for ur software (and sorry for my bad english ;))
i tried to get your programm running, but i couldnt. I tried to configure everything you said, but the machine made almost nothing. x axis was a little bit moving (not really nice) but y and z werent.
my configuration is :
Mega 2560 with Ramps 1.4 Shield and Pololu drivers
mechanical endstops (NC)
EMC2Arduino_07b
the mechanic works perfect

Hopefully you can help me

Mike

Usually this is a situation where the stepper driver is moving too fast. Try raising the value for the following line:

#define minStepTime 1

Using a value of 100 should work.

Higher values are slower but more compatible, lower values perform faster.
Ideally, it should be set high enough to give your machine strong motor torque, but low enough to move as quickly as you need to.

Using stepper motors is game a balance between speed vs strength.

thanks a lot.
i ll try it out as soon as possible

hi dewy,

First of all : Respect for what you have accomplished so far!!! really cool project.
i'v stumblues upon today so i dont really get all the components but i guess the basic is clear.
iv been working on my CNC since last summer after buying an arduino i thought that should be possible, but i did not know anything about anything! So after a lot of reading about basic electronics and steppers and (.. you know what i mean) i finally got the mechanics together and now its time to implement the controlling part. i will be using an arduino UNO for now but probally it will be a MEGA or DUE to have enough pins and 3 A4988 shields from Pololu. ( theese basterts took me a long time to figure out that they need to be cooled, but they work fine now)
At first i wanted to parse a dxf and calculate it into the correspondning XYZ coordinates and use an adapted version of the stepper library.
the problem is i would have to implement everything myself. Lines at any angle is eays but wehn it goes to cicles and splines i will have to spend a lot of time to get an accepting code.
i took a look at LinuxEMC some time ago, but the problem was i had no idea how to get the connection to the arduino

So here you are with your project!! Awsome :slight_smile: !!! i will try it out as soon as i can and will tell you how it works for me!!

thanks allready

keep on coding

jeff

Thank you Jeff,

It sounds like you have been going over every bump in the road that I did. :slight_smile: Only difference is I started with the controller and worked my way outwards to the mechanical bits. I also knew from past projects that once I learn to make something ( like EMC2Arduino ) I end up learning some new things along the way.

I wrote EMC2Arduino as a pilot project to learn how to make a working DIY CNC.

These days as I get time, I'm working on writing HAL2Arduino to make it even better, to refine what I have learned and distill those ideas into less complicated easier to use / easier to understand project.

When I'm done I intend to make a customized live linuxCNC CD that will have all the tricky bits in place so people won't have to worry about it. That way all they'll have to do it play with is the Arduino.

sound like a good plan an a lot of work...

i could spare a few hours today to tried it out and it did not work, which is not really surprising for me since i am not really new to linux but i have to learn a lot of things so i probably did something wrong.
i could offer you to document everything in a latex file hoping that in the end it will work for me and there will be a more user friendly installation guide ( no offence, but if you dont know anything about linux its pretty much chineese).

Im gonna start over and post the problems

i would love to contribute but my skills arent anywhere in your range so i guess this is my way

jeff

hi again,
hope you did'nt get me wrong in my last post...?

since 10 minutes ago i'm ready to go... i got my steppers to work -all 3 of them :slight_smile:
woohoo

Sweet! Now the fun begins. :slight_smile:

Hi :
Great project bro !
1-Can someone use servo instead of stepper motors in your project ???
I guess, cuz Arduino mega has pwm output, so that, it would be easier to contact with servo motors without any motor drivers !!
2-what should I do to replace servo as stepper in programming ????
3-what are disadvantages of this action ???

Thanks !
Wish you best !