Configuring CNC shield V3 for use with Dragonframe animation software

Well, I am at a loss to explain what is going on. I loaded the modified firmware and the 2 motors that I have connected respond properly to all the commands that I send from serial monitor. That is the best that I can do since I don't have a spare CNC shield or the DFMoco software.

Type "hi" (without quotes) into serial monitor and send. What, if anything, is returned in the serial monitor? Please copy and paste the response, if there is any.

hi 1 4 1.2.7

Ok, I know that the firmware is talking to serial monitor so communication is good.

Now try zm 1. What is returned? Should be mp 1 0.

yep exactly that but twice
mp 1 0
mp 1 0

So still no movement with mm 1 1000 or mm 2 1000?

If no movement, my next suggestion is to load Robin2's simple stepper code from the link in my earlier post and confirm that the steppers work in isolation. I know that they worked before with Grbl, but it never hurts to make sure. Don't change the wiring, just make sure the sketch has the right pins for step and dir and the enable pin [pin 8] is output and LOW.

There is no movement although I do get updates in the serial monitor about the motor position.

I just trying Robin’s Simple Stepper code now.

I have changed the step and direction pins to 2 and 5 respectively (the driver is currently plugged into the “x” socket of the CNC shield).

I can’t see anything in the sketch about pin 8 enable. Should I be adding lines to define it? Something like:

byte enablePin = 8;


pinMode(enablePin, OUTPUT);

Or am I just stupid :slight_smile:

If I add the above lines and another like so:

digitalWrite(enablePin, LOW);

so the code looks like this:

// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing

byte enablePin = 8;
byte directionPin = 2;
byte stepPin = 5;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps

void setup() { 

  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  digitalWrite(enablePin, LOW);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(enablePin, OUTPUT);
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
    digitalWrite(stepPin, LOW);
    digitalWrite(ledPin, !digitalRead(ledPin));

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    // delayMicroseconds(pulseWidthMicros); // probably not needed
    digitalWrite(stepPin, LOW);
    digitalWrite(ledPin, !digitalRead(ledPin));

void loop() { 

Then I get some noise coming from the motor - but no movement. I have tried tweaking the voltage on the driver and still nothing

aha I got the direction and step pins the wrong way round - I switched them and the code is now working just fine!

the simple stepper code that is

groundFungus thank you so much for your help.

After analysing the Simple stepper sketch I realised that the code that the guy provided did indeed specify the correct pins for step and direction controls, but he had neglected to the the code for the enable pins!

So I just added lines in to define the enable pins and set the pinmode to OUTPUT and everything works great now!

I feel like I've learned a lot here (a lot more than I bargained for) and you've helped me get over a couple of weeks of frustration. Now I can finally get on with making my slider and (ultimately) making my film, Phew!

So thanks again!

Happy that you got it working and happy to help. I would be interested to see your finished film, if possible. Karma for reporting back with the solution. You never know, but it may help someone in the future.

Happy that you got it working and happy to help. I would be interested to see your finished film, if possible. Karma for reporting back with the solution. You never know, but it may help someone in the future.

Yes please ! I've read the entire thread, compared the DFMoco sketch with the CNC specs, and I can't figure it out

I can't find any place with obvious pin definition in the code.

Hi, can you post the Arduino Sketch that worked for you? I have the same problems.
Best regards Lukas

OK, in the case where the code is too long it is acceptable to attach the code. I looked at the code that you attached, but didn’t go all the way through so didn’t realize that it would not fit.

Per the link that you attached you need to make these changes.
Search the file for “set output pins” and insert the CNC shield pin definitions so it looks like this.

motors[0].stepPin = 2;

motors[0].dirPin = 5;
motors[1].stepPin = 3;
motors[1].dirPin = 6;
motors[2].stepPin = 4;
motors[2].dirPin = 7;
motors[3].stepPin = 12;
motors[3].dirPin = 13;

// set output pins
  for (int i = 0; i < MOTOR_COUNT; i++)
    pinMode(motors[i].stepPin, OUTPUT);
    pinMode(motors[i].dirPin, OUTPUT);

and the lines in the #else section right before "* Serial output specialization" should be:

#define MOTOR0_STEP_PIN B00000100

#define MOTOR1_STEP_PIN B00001000

#define MOTOR2_STEP_PIN B00010000

#define MOTOR3_STEP_PIN B00010000

Replace what is there with the above.

Those changes are supposed to configure the program to work with the CNC shield.

After managing to understand the code a little bit better, I tried this answer.

The pins are definitly right (checked on schematics and on the real deal) BUT whenever I upload the code with the above lines : literally nothing happens. With the vanilla code, motors will start buzzing and whistling but if I add the “motors[0].stepPin” bit, : all go silent.

danielroberthope discovered that the original code did not enable the steppers in the code (see reply #26). The enable pins are, it seems, hard wired LOW in the original author's circuit.

Add the parts like in your last reply (#33) and also add:

const byte enablePin = 8;

right before setup() (make a global variable to hold the enable pin number).

and in setup():

pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, LOW);

That will enable the steppers.

For others : The two posts above with the four bits of codes are the complete solution

Just follow groundFungus instructions and be happy.

Thanks mate.


I did a search for “setup” and there are a bunch of them, so I don’t know where to add the code (reply #34).

Do you have the final script that works?
Can you post it?


Do you have the final script that works?


Can you post it?

Not at this time. I don't know the copyright status of the original code. I don't want to get in trouble for posting copyrighted material without permission.

There is only one setup() function in an Arduino sketch. So search for "void setup()" (it should be around line 568).

It should look like this after you add the enable pin stuff

// add stepper enable pin
const byte enablePin = 8;
   setup() gets called once, at the start of the program.
void setup()
  pinMode(enablePin, OUTPUT);
  digitalWrite(enablePin, LOW);

So should I add that last bit of code to the original sketch in your first entry, or the one that is in "Reply #10"?

FYI, I don't have Arduino or shield yet. I was about to embark on a custom build like described by the Dragonframe tech. I found this so am very excited. I've programed Pololu and Mach3 before but am new to Arduino. I'll order a couple boards tonight. just that one more question above to get me started.

Thanks Much.

Yes, the code in reply #10 plus the code in reply #37. #10 adds the CNC shield pins and #37 the enable pin.