Go Down

Topic: EMC-2-Arduino CNC/Robotics control firmware. (Read 10311 times) previous topic - next topic


Apr 01, 2012, 11:49 am Last Edit: Apr 10, 2012, 04:40 am by dewy721 Reason: 1
Need a good sketch to some non-blocking stepper motor control over a serial link?

Maybe your looking for a full-featured interface for your Arduino controlled CNC machine.

Or you just want to build a RC robot complete treads and a 7-joint arm.

Well I'm glad to say that I have a sketch here to help you out!

If your into CNC stuff this is what EmcArduino can do for you:

 Directly supports LinuxCNC (EMC2.4/Axis). The free top-end CNC control software.
 Up to 9-axis simultaneous stepper motion control.
 Min/Max/Home limit switches for each axis (both physical and virtual supported).
 Support for E-Stop, Power, Stop, Start/Run, Pause, Resume and Program step buttons.
 Touch probe input for G38.x commands.
 Software selectable microStepping.
 Tuning LED indicator lets you get the maximum safe performance for YOUR application.
 Entirely USB based interface, no more printer cables required. (but still optional)
 Partial application support for those that just want an addon for their current rig.

If your into robotics:

 9 non-blocking stepper channels that won't hold up the show while ONE motor finishes moving.
 Serial command interface makes cross-platform building a breeze.
 Written with the native Arduino IDE for easy code modification.
 Uses the digitalFastWrite2 library for 8x speed over standard digitalWrite command.
 Software configurable mircoStepping for dynamic speed control.

And to top it all off:
 Its Open-Source software so it doesn't cost a thing! :D

Interested? Here's the link. http://emc2arduino.wordpress.com/


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.

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


It's me again. I have lots of problems building my own CNC. I'v got stepper motors that I don't know what kind are they, I just know that they have 6 wires .
1-About driving stepper motors, witch one of these two are better for me ????
2-How should I wire my arduino mega to drivers and motors ????
So many questions ha ??   XD
thanks  ;)


You first measure the winding resistances (which will also identify which
windings are which and where the common wires are).

If its low impedance (< 5 ohms) and not 5-wire you then get a bipolar chopper driver
that can handle the current (finding the current rating might be an issue too) and
an appropriate 24, 36, 48, or 80V supply (depends on what the driver can handle and
what performance you need).

If its high impedance (10 ohms or more) and not 4 wire then use unipolar drive and
a supply voltage matched to the windings, but don't expect much speed.

Most stepper drivers have step, direction and enable inputs, often opto-isolated.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thanks for responding . But I really got nothing  =(
would you please tell me more about this method ( that tells differences between bipolar and unipolar ) ???


Feb 22, 2014, 03:13 am Last Edit: Feb 22, 2014, 03:41 am by dewy721 Reason: 1
Either one of those drivers will work for driving ONE stepper motor. I like the one with jumpers better. (My personal preference.)

Most six wire steppers are unipolar (which can be wired up to run as bipolar). The driver boards you shown can be used to drive bipolar steppers.

In your case, you would just leave out the 'common' wire from each phase (or coil). Six wire unipolar steppers have 2 pairs of coils (four total).

Each pair of coils has 3 wires, one of which is a common wire shared by both coils in that 'phase'. The other two wires are the ones your looking for. Those two wires from each phase, get wired to your driver board.

With a digital multimeter, you can test for resistance between the wires. Look for 3(of6) wires that are connected. Place a band of tape around them so you can identify them as a phase. From those three wires, two of them should have a higher resistance. The remaining wire is the common wire for that phase. Tape it off, set it aside and use the other two higher resistance wires.

Then repeat the process with the other set of 3 wires. When done, you should end up with two bundles of three wires each. Between the two sets you should now have four wires to use; and two wires that have been insulated from immediate use.


Thanks for responding . But I really got nothing  =(
would you please tell me more about this method ( that tells differences between bipolar and unipolar ) ???

Stepper motors come with 4 wires, 5 wires, 6 wires and 8 wires.

unipolar possible:  5 wires, 6 wires, 8 wires
bipolar possible 4 wires, 6 wires, 8 wires (series or parallel).

There are slow stepper motors with high impedance windings, often unipolar,
these are not optimized for speed but are easy to drive.

There are high-performance bipolar motors with low-impedance windings, usually
4 or 8-wire.  These are meant to be driven with chopper driver from a high voltage
supply.  The chopper drive is a current-control driver with automatic buck-regulation,
the high voltage supply allows back EMF from the motor to be overcome at high
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Bipolar stepper motors provide more torque and should be controlled with a proper stepper motor driver board - NOT a board that uses an L298 chip.

I don't know if the Pololu A4988 driver is suitable for your motor but if you look up the web page you will get a lot of information about how a typical stepper driver board is used.

Two or three hours spent thinking and reading documentation solves most programming problems.


Hi :
dewy721 : What if i get this reprap driver or I could drive those stepper motors anyway, then do i need any electronic hardware except arduino mega that i got ???? like C 10 breakout board ????

Go Up