Go Down

Topic: Control 8 stepper motors with Arduino Uno or Due using CNC Shield (Read 501 times) previous topic - next topic

aive

Hello,

I'm using this bipolar stepper with A4988 driver on  CNC Shield Expansion Board with Arduino Due or Uno micro controller


First of all, I'm trying to figure out, how to control 4 steppers on CNC shield, if 3 is:


const int stepPin1 = 2;     // x-stp // stepper 1
const int dirPin1 = 5;        // x-dir

const int stepPin2 = 3;     // y-stp  // stepper 2
const int dirPin12 = 6;      // y-dir

const int stepPin3 = 4;    // z-stp  // stepper 3
const int dirPin3 = 7;       // z-dir

but  what is a-step/dir pins stepPin4 and dirPin4 for stepper 4 by this scheme?


And also, what should I use for Arduino Due or Uno,  in case if I need separate control for 8 stepper motors  at the same time.

I found  Mega Shield-GRBL 1.1 Arduino CNC Shield also RAMPS 1.4 RepRap Mega Pololu Shield Board and RepRap Arduino-Due Driver Shield  but it is only for 6 drivers, and except for the last, I'm not sure, if it is compatible with Arduino Due

Any advice, guide of example would be very helpful


 




Robin2

but  what is a-step/dir pins stepPin4 and dirPin4 for stepper 4 by this scheme?
I can't see how they are connected. You need to ask on the Reprap Forum.


Quote
And also, what should I use for Arduino Due or Uno,  in case if I need separate control for 8 stepper motors  at the same time.
I would suggest a Mega as it has lots of I/O pins and, like the Uno, it works at 5v. The Due works at 3.3v.

You can connect A4988 drivers to an Arduino without using a shield. The only purpose of the shield is convenience.

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

aive

I can't see how they are connected. You need to ask on the Reprap Forum.

I would suggest a Mega as it has lots of I/O pins and, like the Uno, it works at 5v. The Due works at 3.3v.

You can connect A4988 drivers to an Arduino without using a shield. The only purpose of the shield is convenience.

...R
Hello,

Here is a scheme

So, if I'm going to use Mega as controller, what can I use as shield for 8 motors, I know that I can use drivers with solder-able breadboard, but is not only convenience,  I need to make it compact without extra parts to place inside the assembly box




aive

#3
Sep 20, 2018, 02:55 am Last Edit: Sep 20, 2018, 03:07 am by aive
Hello

I want use Mema 8 bipolar stepper with A4988 driver on CNC Shield Board with Arduino Uno or Due micro controller

With Arduino Uno, my connection is:

  • jumper reset and sleep together
  • VDD to Arduino 3.3v or 5v
  • GND to Arduino GND (GND near VDD)
  • 1A and 1B to stepper coil 1 black/green wire
  • 2A and 2B to stepper coil 2 red/blue wire
  • VMOT to power source (9v battery + term)
  • GRD to power source (9v battery - term)


I've checked 2 power adapters with 9 and 12 V

I've tried use it with CNC shield as well as with breadboard, which connection shown below, I don't know why,  but motor does not moves





I'm using DC Jack for adapter  to stepper, back pin connected to the center pin plus, front pin  is ground  according to adapter -C+, the third leg is not used, I do not even know its purpose, maybe I did something wrong way

Any advice, guide or example would be helpful

Daenerys

>9v battery


Um....yeah you're gonna need something with a bit more oomph then that.

Try a 12V power supply instead of a 9V battery.

aive

#5
Sep 20, 2018, 10:48 am Last Edit: Sep 20, 2018, 12:15 pm by aive
>9v battery


Um....yeah you're gonna need something with a bit more oomph then that.

Try a 12V power supply instead of a 9V battery.
I've tried both 12V too, but nothing, with this code:

Code: [Select]

const int stepPin = 3;
const int dirPin = 4;
void setup() {
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
}
void loop() {
 digitalWrite(dirPin, HIGH);
 for(int x = 0; x < 200; x++) {
   digitalWrite(stepPin, HIGH);
   delayMicroseconds(500);
   digitalWrite(stepPin, LOW);
   delayMicroseconds(500);
 }
 delay(1000);
 digitalWrite(dirPin, LOW);
 for(int x = 0; x < 400; x++) {
   digitalWrite(stepPin, HIGH);
   delayMicroseconds(500);
   digitalWrite(stepPin, LOW);
   delayMicroseconds(500);
 }
 delay(1000);
}
 


and this, in this case pin 13 to step and pin 12 to dir:

Code: [Select]
 
int stp = 13; 
int dir = 12; 
int a = 0; 
void setup()
{
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
}
void loop()
{
  if (a < 200)
  {
    a++;
    digitalWrite(stp, HIGH);
    delay(10);
    digitalWrite(stp, LOW);
    delay(10);
  }
  else
  {
    digitalWrite(dir, HIGH);
    a++;
    digitalWrite(stp, HIGH);
    delay(10);
    digitalWrite(stp, LOW);
    delay(10);
    if (a>400)
    {
      a = 0;
      digitalWrite(dir, LOW);
    }
  }

Robin2

@aive, plesase don't double post. I have suggested to the Moderator to merge your Threads

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

Robin2

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

MarkT

And also, what should I use for Arduino Due or Uno,  in case if I need separate control for 8 stepper motors  at the same time.

I found  Mega Shield-GRBL 1.1 Arduino CNC Shield also RAMPS 1.4 RepRap Mega Pololu Shield Board and RepRap Arduino-Due Driver Shield  but it is only for 6 drivers, and except for the last, I'm not sure, if it is compatible with Arduino Due

Any advice, guide of example would be very helpful

Yes, I'd assume its 5V only unless definitely evidence to the contrary (and ditto for the A4988 breakouts).

That one with the A channel as well as XYZ seems to have it unassigned, you'd need to perhaps use some
of the unused analog pins with jumpers.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

aive

I am not aware of any.

...R
Yes, I'd assume its 5V only unless definitely evidence to the contrary (and ditto for the A4988 breakouts).

That one with the A channel as well as XYZ seems to have it unassigned, you'd need to perhaps use some
of the unused analog pins with jumpers.
Thank you for answers

Control works well with Arduino Uno, 12V power adapter and breadboard with driver. Pins for stepper 4 is

const int stepPin4 = 12; // a-stp
const int dirPin4 = 13; // a-dir

 I want  move it with command from C#

Problem 1:

It is not constantly working loaded code, but stepper motor becomes extremely hot very quickly

What could be the reason of this?

Problem 2:

Still can't move it with CNC shield, here is my connection:

 

Robin2

Control works well with Arduino Uno, 12V power adapter and breadboard with driver. Pins for stepper 4 is

const int stepPin4 = 12; // a-stp
const int dirPin4 = 13; // a-dir
Post the program that works in that situation


Quote
Problem 1:

It is not constantly working loaded code, but stepper motor becomes extremely hot very quickly

What could be the reason of this?
It is natural for stepper motors to be hot (uncomfortable to touch) as they draw full power even when stationary. Are you sure you have set the current limit on the A4988 to match your motor?

Quote
Problem 2:

Still can't move it with CNC shield, here is my connection
Post the program that you are using for that test.

Does the shield require an enable signal for each motor?

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

aive

Post the program that works in that situation

...R
load program:


Code: [Select]

 int stpPin = 12;
    int dirPin = 13;
    int a = 0;
    void setup()
    {
      pinMode(stpPin, OUTPUT);
      pinMode(dirPin, OUTPUT);
    }
   
    void loop()
    {
      if (a < 200)
      {
        a++;
        digitalWrite(stpPin, HIGH);
        delay(10);
        digitalWrite(stpPin, LOW);
        delay(10);
      }
      else
      {
        digitalWrite(dirPin, HIGH);
        a++;
        digitalWrite(stpPin, HIGH);
        delay(10);
        digitalWrite(stpPin, LOW);
        delay(10);
       
        if (a>400)
        {
          a = 0;
          digitalWrite(dirPin, LOW);
        }
      }
    }



Are you sure you have set the current limit on the A4988 to match your motor?



...R
maybe this is a reason, because I don't have multimeter here to check



Does the shield require an enable signal for each motor?

I'm not sure how to do it, maybe shield EN and GND need to be connected with jumpers





Robin2

load program:
You did not post the program that does not work? Or is it identical?

Treat yourself to a cheap digital multimeter it is pretty much essential. Get one that has the option of measuring up to 10 amps.

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

aive

You did not post the program that does not work? Or is it identical?

Treat yourself to a cheap digital multimeter it is pretty much essential. Get one that has the option of measuring up to 10 amps.

...R
Yes this is a simple program, it works, which I use to check both breadboard and CNC

Current limit decrease in manual with toothpick makes sense, with rotation about 25 degree, during 10 minutes it is practically cold but then temperature begins to increase

I'm not sure why, turning of working stepper with hand, somehow affects the work, steps begin to slow down the stroke, sometimes even to a full stop, as soon as I put it on the table, the rotation is stable, and shaft is very sensitive with contact, to stop rotation, enough touch it without pressure

Also what I found, above is one of two programs I use to check, one rotates with 360 degree full turn in one direction, another with change of direction on 360 degree. I can't stop movement by one or another way, depending on the load, even if I reset controller and load with Arduino IDE empty code,  it performs the previous program, continues rotation or moving  from side to side




Robin2

I'm sorry, but I can't make sense of Reply #13

It does not answer my question and it mentions several other things without enough detail to understand them.

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

Go Up