Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: aive on Sep 19, 2018, 10:47 pm

Title: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: aive on Sep 19, 2018, 10:47 pm
Hello,

I'm using this bipolar stepper (https://www.pololu.com/product/1204) with A4988 driver (https://www.pololu.com/product/1182) on  CNC Shield Expansion Board (http://www.robotpark.com/A4988-Driver-CNC-Shield-Expansion-Board-for-Arduino) 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 (https://reprap.org/forum/read.php?13,355175)?


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  (https://www.tindie.com/products/EccentricWkshp/grblduino-mega-shield-grbl-11-arduino-cnc-shield/) also RAMPS 1.4 RepRap Mega Pololu Shield Board (http://qqtrading.com.my/cnc-shield-ramps-reprap-pololu-arduino-mega) and RepRap Arduino-Due Driver Shield (http://doku.radds.org/dokumentation/radds/)  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


 



Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: Robin2 on Sep 19, 2018, 11:27 pm
but  what is a-step/dir pins stepPin4 and dirPin4 for stepper 4 by this scheme (https://reprap.org/forum/read.php?13,355175)?
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
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: aive on Sep 19, 2018, 11:40 pm
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  (https://blog.protoneer.co.nz/wp-content/uploads/2013/07/Arduino-CNC-Shield-Scematics-V3.XX_.jpg)

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



Title: Control stepper motor with Arduino Uno
Post by: aive on Sep 20, 2018, 02:55 am
Hello

I want use Mema 8 bipolar stepper (https://www.pololu.com/product/1204) with A4988 driver (https://www.pololu.com/product/1182) on CNC Shield Board (http://www.robotpark.com/A4988-Driver-CNC-Shield-Expansion-Board-for-Arduino) with Arduino Uno or Due micro controller

With Arduino Uno, my connection is:



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


(https://i.stack.imgur.com/MzsCo.png)


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
Title: Re: Control stepper motor with Arduino Uno
Post by: Daenerys on Sep 20, 2018, 07:22 am
>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.
Title: Re: Control stepper motor with Arduino Uno
Post by: aive on Sep 20, 2018, 10:48 am
>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);
    }
  }
Title: Re: Control stepper motor with Arduino Uno
Post by: Robin2 on Sep 20, 2018, 12:25 pm
@aive, plesase don't double post (https://forum.arduino.cc/index.php?topic=569401.0). I have suggested to the Moderator to merge your Threads

...R
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: Robin2 on Sep 20, 2018, 12:27 pm
what can I use as shield for 8 motors,
I am not aware of any.

...R
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: MarkT on Sep 20, 2018, 01:35 pm
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  (https://www.tindie.com/products/EccentricWkshp/grblduino-mega-shield-grbl-11-arduino-cnc-shield/) also RAMPS 1.4 RepRap Mega Pololu Shield Board (http://qqtrading.com.my/cnc-shield-ramps-reprap-pololu-arduino-mega) and RepRap Arduino-Due Driver Shield (http://doku.radds.org/dokumentation/radds/)  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.
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: aive on Sep 20, 2018, 02:04 pm
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:

 (https://i.stack.imgur.com/rAJ9T.png)
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: Robin2 on Sep 20, 2018, 04:39 pm
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
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: aive on Sep 20, 2018, 05:05 pm
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




Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: Robin2 on Sep 20, 2018, 07:07 pm
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
Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: aive on Sep 21, 2018, 12:39 pm
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



Title: Re: Control 8 stepper motors with Arduino Uno or Due using CNC Shield
Post by: Robin2 on Sep 21, 2018, 02:11 pm
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