4 stepper and 2 servo with CNC shield

Can I use 4 stepper motor and 2 servo with CNC shield v3.0? With grbl I can use all 4 steppers but other 2 servo doesn't appear in that software and I'm a beginner. I have the CNC shield in that images:

I hope someone can help me, if you can't i can buy another arduino to use servos separately.

Thank you so much for the answer, and sorry for my bad english...

What software?

Are you using all of the limit switches? How about the analog input pins (Abort, Resume, Hold, Cool En)? You can use any of those pins for servos. Don't try to power servos from the Uno 5V though, power them with an external supply capable of delivering enough current for the servos.

cnc shield Uno pins

1 Like

Thank you so much for your reply. I found many software like grbl controller, grbl control panel but they are only for at least 4 axis and I can't add other axis.
Why I can't use the 5V on the shield? Is not a problem for me to add another power supply is only for information.

The Uno 5V, when supplied either by USB or by the on-board 5V regulator, is capable of supplying limited current. A servo under load can pull more current than can safely be supplied. That will cause unwanted resets.

Ok thank you so much. Do you know a software to control 4 stepper and two servo with that cnc?
Or should I write a code myself?

I know of no software or firmware for an Uno with CNC shield that controls 4 steppers and 2 servos like Grbl would so you will probably have to write the code yourself.

Libraries like AccelStepper library or the MobaTools stepper library will help.

Can you describe what your project will do? Maybe we can help you write the code.

1 Like

I won't disturb you too much. I build a robotic arm that has 4 stepper to move base and first three part of the arm. Two servo instead serve to move the hand. If you want more detailed description tell me.

Sounds like fun. If you need help we are here.

Thank you so much, if I need to, i'll get back to you

Anyone can help me. How can I define the pin that I'm using with cnc shield in my code. I'm try to using AccelStepper and Servo to write it. I need only simple back and forth movement.

The photo of the Uno in reply #2 shows how the pins on the CNC shield relate to the Uno pins.

@mariorossi26088 : The MobaTools library cannot only control steppers, but also servos. And it can move the servos slowly.

I'm trying to use MobaTools but i report many issues on my path. Can I control arduino moves with pc keyboard?? I assigned a pin for each servo and I imposed that on press of a key servo moves of x grades. How I can do that fuctionally? I used keyboard library and MobaTools library.
Another question, if I keep press the key, servo or stepper motor keep going or not?

What issues?

Post your code. Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Tell us what the code actually does and how that differs from what you want the code to do.

Which one? Post a link to the library.

If you code it that way.

Please realize that we cannot see your project. We have very little idea what you have, how it is connected and the programming. You will get the best help if we have all the information necessary to duplicate your project. That means code, schematic and data sheets for each component (as necessary).

Hi, this morning I've tried to compute a code and it almost work for servo, for stepper I haven't started yet because with cnc shield I don't know what pin are in use. I link the code there:

[code]
#include <Servo.h>


// Define servo motor
Servo Servo1;
Servo Servo2;
int ang1 = 90;
int ang2 = 90;

int k = 0;
char val = '0';


//Define stepper motor
//MoToStepper Stepper1(10, FULLSTEP);
//MoToStepper Stepper2(10, FULLSTEP);
//MoToStepper Stepper3(10, FULLSTEP);
//MoToStepper Stepper4(10, FULLSTEP);


void setup() {
  Serial.begin(115200);

  Servo1.attach(A0);
  Servo2.attach(A1);

  Servo1.write(ang1);
  Servo2.write(ang2);

  //  byte Stepper1.attach();
  //  byte Stepper2.attach();
  //  byte Stepper3.attach();
  //  byte Stepper4.attach();

}

void loop() {
  if (Serial.available())
  {
    val = Serial.read();
  }
  if (val == 't') {
    ang1 += 1;
    Servo1.write(ang1);
    delay(15);
  }

  if (val == 'g') {
    ang1 -= 1;
    Servo1.write(ang1);
    delay(15);
  }

  if (val == 'f') {
    ang2 += 1;
    Servo1.write(ang2);
    delay(5);
  }

  if (val == 'h') {
    ang2 -= 1;
    Servo1.write(ang2);
    delay(5);
  }
}
[/code]

I have two servo MG996R (MG996R Servo Motor Datasheet, Wiring Diagram & Features) and 4 stepper motor NEMA 17 (NEMA 17 Stepper Motor Datasheet, Wiring, Specs & Alternatives) with an Arduino Uno and a CNC shield v3.0.
I have to move all that motor just back and forth with pc keyboard, maybe in the future I automated it but not now.
Actually servos wake up and move left and right but randomly not at the press of a key.

I hope that subject is not offtopic.

Thank you so much.

You can repurpose pins on the Protoneer CNC Shield for servos as @groundFungus posted, but GRBL won't know what to do with them.

You need different software. Makelangelo 5 – Marginally Clever Robots uses two steppers and a servo by adapting https://marlinfw.org/ Marlin should be configurable for a CNC V3 shield for 4 steppers and multiple servos.

You are right, in fact I use Abort and hold and I'm writing the code myself because i haven't find a software for me.
Can you explain better that software please? If I can work smarter is better.

Oops--Marlin is too big to fit on an Uno.

Maybe this adaptation would be a viable starting point: https://www.instructables.com/How-to-Control-a-Servo-Using-GRBL/

Or, as a beginner, if you want to use Gcode, 4 axes and 2 servos, you may want to choose more capable hardware that already works with those. Almost any 3d printer hardware will do.

X axis step = 2, dir = 5
Y axis step = 3, dir = 6
Z axis step = 4, dir = 7
A axis step = 12, dir = 13
stepper enable = 8, active LOW (LOW to enable motors).

What stepper drivers are on the CNC shield? Have you set the coil current limits on the drivers (important).

What is the power supply for the servos?

I think one problem is, that the value of 'val' ( not a very descriptive name ... ) stays at the last received value and the corresponig 'if' is true with every loop cycle.
You should reset 'val' at the end of loop to a non valid value, or move all the if ( val ==... into the if block of Serial.available().
And you should check wether your angle value overflows ( becomes greater 180 or less than 0 )