Go Down

Topic: Controlling a stepper motor with a Ramps 1.4 shield (Read 299 times) previous topic - next topic

B41der

Hi,

we want to build a driving robot, which is powerd by 4 stepper motors (one for each wheel). Therefor we bought a kit which included an Arduino Mega 2560 replica, a Ramps 1.4 shield and 5 A4988 stepper driver (https://eckstein-shop.de/3D-Drucker-Set-Kit-fuer-RAMPS-14-RepRap-Mega-2560-5x-DRV8825-12864-LCD-Arduino). The motors are 4 Nema14 stepper motors (https://www.omc-stepperonline.com/de/nema-14-bipolar-1-8deg-40ncm-1-5a-4-2v-35x35x52mm-4-drahte.html). The power supply comes from a 3D-printer and delivers 12V 20A.
Now we have three questions:

1.: Which of the two contacts for the power supply on the shield do we use, the 11A+ or the 5A? We found on another website, that 5A is a minimum and not a maximum when using 12V, correct?

2.: How do we communivate with the motors in or sketch? We found a picture of the circuit (attached) and decided to use pins A0 and A1 because they are connected to X-Step and X-Dir. To controll the movement of the motors we installed the AccelStepper library and wrote a first test sketch:
Code: [Select]
#include <AccelStepper.h>

AccelStepper Motor(1, A0, A1);

void setup() {
  Motor.setMaxSpeed(2000);
  Motor.setSpeed(500);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  Motor.runSpeed();
  digitalWrite(LED_BUILTIN, HIGH);   
  delay(1000);                       
  digitalWrite(LED_BUILTIN, LOW);   
  delay(1000);
}

To be able to see wheter our code is running or not we included the LED switches on and off. But the motor is't moving at all and we can't mesure any voltage between any of the 4 pins for the motor.
Is something wrong with our sketch, or might our shield be damaged?

3.: We are sure that we put the stepper drivers on facing the right way, the jumpers underneath were already on the shield. In theory we know, that you can controll the number of steps per turn with these. But how do you know, if a jumper is set as "yes" or "no"?

Thank you for your help! Since this is our first project with an arduino etc. we are a bit stuck.

Benedikt, Fabian

Robin2

Try the first program in this Simple Stepper Code to test your motor. It is very simple and does not need any library. You will need to adjust the pins to match your RAMPS shield, but don't change anything else.

Have you correctly set the current limit on your stepper driver to match the motor?

Be VERY CAREFUL never to disconnect the wires between the motor and the stepper driver while the driver is powered up. The driver will be instantly destroyed.

Start your tests with no micro-stepping jumpers connected - that will give you full steps.

I don't think it matters which of the power inputs you connect to on the RAMPS shield - I think the high amp input is for driving 3D printer heaters. There is certainly no question of needing a minimum current.

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

B41der

Hey Robin, thanks for your reply! We are going to check out your Simple Stepper Code and the Stepper motor Basics and see if can figure it out.
One thing we defenitly haven't done is set the current limit on the stepper driver. Our motors need 1.5A and I just thought that would be fine with the stepper drivers. How do we check what the limit is set to?
We will read through your posts and then try again tomorrow.
Regarding the jumpers, a "no" (like i found in some tables) menas just having no jumper in that spot and a "yes" having a jumper, correct?

Thanks,
Benedikt

groundFungus

This Pololu page describes how to set the current limit on the A4988 stepper driver (with video).

Yes, an installed jumper is a 1 and not installed is 0.  The above linked page has the microstep truth table, too.

B41der

Thanks for the link. We followed the tutorial to set the limit on each driver one by one (we disconnected all the others before we started calibrating the next one). But somehow it seems we destroeyd our Arduino while setting the fourth one (little bit of smoke, very hot and we can't upoad any new sketches - we tried the Bilnk sketch to see if it still works). Is it possible that this happend, because there was still a sketch uploaded on the Arduino? Besides that we can't think of anything we did wrong. And is there any way to see, wether our shield and our drivers are still working?

We used our 12V 20A power supply

Thanks for your help so far, we already understand a lot more! (But apparently not enough... )
Benedikt


groundFungus

I don't know how you could kill the Uno while adjusting the driver.  What, exactly, got hot?

B41der

We are using a Mega. But the Microcontroller on the Mega is getting hot. When you connect the Arduino by itself to your computer with an USB-cable the On-LED and the Tx and Rx LEDs are constantly on, but it doesn't seem to run - the blink sketch anymore (we loaded that as a test again).

Robin2

We are using a Mega. But the Microcontroller on the Mega is getting hot.
Then you must have some seriously wrong connections - stop what you are doing.

Make a simple pencil drawing showing clearly how you have everything connected and post a photo of your drawing. See this  Simple Image Guide

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

MarkT

Now we have three questions:

1.: Which of the two contacts for the power supply on the shield do we use, the 11A+ or the 5A? We found on another website, that 5A is a minimum and not a maximum when using 12V, correct?
The schematic shows the 11A supply is only for heated bed, everything else is the 5A supply.  These are the fuse ratings of the fuses on the board.
Quote
2.: How do we communivate with the motors in or sketch? We found a picture of the circuit (attached) and decided to use pins A0 and A1 because they are connected to X-Step and X-Dir. To controll the movement of the motors we installed the AccelStepper library and wrote a first test sketch:
Code: [Select]
#include <AccelStepper.h>

AccelStepper Motor(1, A0, A1);

void setup() {
  Motor.setMaxSpeed(2000);
  Motor.setSpeed(500);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  Motor.runSpeed();
  digitalWrite(LED_BUILTIN, HIGH);   
  delay(1000);                       
  digitalWrite(LED_BUILTIN, LOW);   
  delay(1000);
}

To be able to see wheter our code is running or not we included the LED switches on and off. But the motor is't moving at all and we can't mesure any voltage between any of the 4 pins for the motor.
Is something wrong with our sketch, or might our shield be damaged?
Have you checked the jumpers for the X motor driver?  Use much smaller speed numbers and call setAcceleration() too in setup.  Try 100 for all values in the first instance, no higher.  Have you set the current for each DRV8825 module?  Checked the 5A fuse is intact?  Checked with a multimeter that power is getting to the DRV8825 module?  Checked continuity (with power off) between A0/A1 and the X motor step/direction pins?
Quote
3.: We are sure that we put the stepper drivers on facing the right way, the jumpers underneath were already on the shield. In theory we know, that you can controll the number of steps per turn with these. But how do you know, if a jumper is set as "yes" or "no"?
jumper bridges the contacts, its yes.
Quote
Thank you for your help! Since this is our first project with an arduino etc. we are a bit stuck.

Benedikt, Fabian
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up