Help with stepper motor control on Arduino Mega with Ramp 1.4 Sheild

Hello Everyone,

I am making this post to hopefully get help with using a Ramp 1.4 shield and a Arduino Mega to control a stepper motors for a robot arm project I want to work on. I chose it since it is able to drive 5 stepper motors which is how many I plan to have on my arm, but I have been struggling on how to get the ramps to work at all.

I tested my stepper motor drivers (A4988) with all my motors on a breadboard with a 12V power supply and I got it to work just fine with the Accelstepper library. How ever when I put the components on the board and try to use it nothing happens at all even with the Ramps 1.4 test code from their website. At this point I just want to see the board do anything at all.

Another note to make is that when I have the ramp hooked up with my computer and try to turn on the 12V power supply, it crashes my laptop completely and I have to restart it.

So I am not sure if I am doing anything wrong or if my board is fried. Any help or suggestions would be of great help.

Here the test code straight from Ramp 1.4 website.

#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15

#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19

#define E_STEP_PIN 26
#define E_DIR_PIN 28
#define E_ENABLE_PIN 24

#define Q_STEP_PIN 36
#define Q_DIR_PIN 34
#define Q_ENABLE_PIN 30

#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13

#define FAN_PIN 9

#define PS_ON_PIN 12
#define KILL_PIN -1

#define HEATER_0_PIN 10
#define HEATER_1_PIN 8
#define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 14 // ANALOG NUMBERING

void setup() {
pinMode(FAN_PIN , OUTPUT);
pinMode(HEATER_0_PIN , OUTPUT);
pinMode(HEATER_1_PIN , OUTPUT);
pinMode(LED_PIN , OUTPUT);

pinMode(X_STEP_PIN , OUTPUT);
pinMode(X_DIR_PIN , OUTPUT);
pinMode(X_ENABLE_PIN , OUTPUT);

pinMode(Y_STEP_PIN , OUTPUT);
pinMode(Y_DIR_PIN , OUTPUT);
pinMode(Y_ENABLE_PIN , OUTPUT);

pinMode(Z_STEP_PIN , OUTPUT);
pinMode(Z_DIR_PIN , OUTPUT);
pinMode(Z_ENABLE_PIN , OUTPUT);

pinMode(E_STEP_PIN , OUTPUT);
pinMode(E_DIR_PIN , OUTPUT);
pinMode(E_ENABLE_PIN , OUTPUT);

pinMode(Q_STEP_PIN , OUTPUT);
pinMode(Q_DIR_PIN , OUTPUT);
pinMode(Q_ENABLE_PIN , OUTPUT);

digitalWrite(X_ENABLE_PIN , LOW);
digitalWrite(Y_ENABLE_PIN , LOW);
digitalWrite(Z_ENABLE_PIN , LOW);
digitalWrite(E_ENABLE_PIN , LOW);
digitalWrite(Q_ENABLE_PIN , LOW);
}

void loop () {

if (millis() %1000 <500)
digitalWrite(LED_PIN, HIGH);
else
digitalWrite(LED_PIN, LOW);

if (millis() %1000 <300) {
digitalWrite(HEATER_0_PIN, HIGH);
digitalWrite(HEATER_1_PIN, LOW);
digitalWrite(FAN_PIN, LOW);
} else if (millis() %1000 <600) {
digitalWrite(HEATER_0_PIN, LOW);
digitalWrite(HEATER_1_PIN, HIGH);
digitalWrite(FAN_PIN, LOW);
} else {
digitalWrite(HEATER_0_PIN, LOW);
digitalWrite(HEATER_1_PIN, LOW);
digitalWrite(FAN_PIN, HIGH);
}

if (millis() %10000 <5000) {
digitalWrite(X_DIR_PIN , HIGH);
digitalWrite(Y_DIR_PIN , HIGH);
digitalWrite(Z_DIR_PIN , HIGH);
digitalWrite(E_DIR_PIN , HIGH);
digitalWrite(Q_DIR_PIN , HIGH);
}
else {
digitalWrite(X_DIR_PIN , LOW);
digitalWrite(Y_DIR_PIN , LOW);
digitalWrite(Z_DIR_PIN , LOW);
digitalWrite(E_DIR_PIN , LOW);
digitalWrite(Q_DIR_PIN , LOW);
}

digitalWrite(X_STEP_PIN , HIGH);
digitalWrite(Y_STEP_PIN , HIGH);
digitalWrite(Z_STEP_PIN , HIGH);
digitalWrite(E_STEP_PIN , HIGH);
digitalWrite(Q_STEP_PIN , HIGH);
delay(1);

digitalWrite(X_STEP_PIN , LOW);
digitalWrite(Y_STEP_PIN , LOW);
digitalWrite(Z_STEP_PIN , LOW);
digitalWrite(E_STEP_PIN , LOW);
digitalWrite(Q_STEP_PIN , LOW);
}

Good!

Aj aj aj. Troublesome. Please post a datasheet link to the Ramps board. It's not that commonly used.

That's alarming. Never heard of a computer affected like that.
Sorry but You need to provide schematics, the wiring diagram. Please don't post Fritzing position pictures.

Go back to simple tests, if You can, and check. Impossible to say from here.

Please check up how to use "code tags". Some help in this link, section: code.... How to get the best out of this forum - Development Tools / IDE 1.x - Arduino Forum

Format your code.

For reference...

Disconnect everything and share any instructions received with the shield.

What websites are you referring to?

There is a lot of info on RAMPS here RAMPS 1.4 - RepRap

If you PC crashes, it's either a faulty board, or miswired. Unfortunately most (or all) of the connectors on RAMPS are not polarised, and it can be easy to misconnect. In theory, the 12V supply is independent of the 5V, and 12V only goes to the MOSFETS.

It's also possible there is an issue with the 12V supply. An isolated power brick would be best, people have had problems with the open-frame type PSUs commonly used.

Thank you guys for the support to help, and please excuse my lack of forum etiquette. This was my first post on here.

Addressing the replies you all gave me, the website I have been referencing is https://reprap.org/wiki/RAMPS_1.4 . Straight from there the schematics for the board is below.



No instructions came with the shield when I received it. So I tried to follow the wiki page to set it up. I used a isolated power brick with the setup that I made sure to set to 12V DC and powered the Arduino (after I loaded it with the test code) with a 8.6V barrel jack since it would crash my laptop if directly connected. I also checked the polarity before plugging it in. Nothing happens when I power it up. Below is a picture of how I have it set up just with one stepper & driver for testing, but as I have said nothing happens. I am not sure if their is a way to test if it is a faulty board or what my next step from here should be, but if someone has a idea please let me know.

Here is the test code from the Wiki posted correctly:

#define X_STEP_PIN         54
#define X_DIR_PIN          55
#define X_ENABLE_PIN       38
#define X_MIN_PIN           3
#define X_MAX_PIN           2

#define Y_STEP_PIN         60
#define Y_DIR_PIN          61
#define Y_ENABLE_PIN       56
#define Y_MIN_PIN          14
#define Y_MAX_PIN          15

#define Z_STEP_PIN         46
#define Z_DIR_PIN          48
#define Z_ENABLE_PIN       62
#define Z_MIN_PIN          18
#define Z_MAX_PIN          19

#define E_STEP_PIN         26
#define E_DIR_PIN          28
#define E_ENABLE_PIN       24

#define Q_STEP_PIN         36
#define Q_DIR_PIN          34
#define Q_ENABLE_PIN       30

#define SDPOWER            -1
#define SDSS               53
#define LED_PIN            13

#define FAN_PIN            9

#define PS_ON_PIN          12
#define KILL_PIN           -1

#define HEATER_0_PIN       10
#define HEATER_1_PIN       8
#define TEMP_0_PIN          13   // ANALOG NUMBERING
#define TEMP_1_PIN          14   // ANALOG NUMBERING

void setup() {
  pinMode(FAN_PIN , OUTPUT);
  pinMode(HEATER_0_PIN , OUTPUT);
  pinMode(HEATER_1_PIN , OUTPUT);
  pinMode(LED_PIN  , OUTPUT);
  
  pinMode(X_STEP_PIN  , OUTPUT);
  pinMode(X_DIR_PIN    , OUTPUT);
  pinMode(X_ENABLE_PIN    , OUTPUT);
  
  pinMode(Y_STEP_PIN  , OUTPUT);
  pinMode(Y_DIR_PIN    , OUTPUT);
  pinMode(Y_ENABLE_PIN    , OUTPUT);
  
  pinMode(Z_STEP_PIN  , OUTPUT);
  pinMode(Z_DIR_PIN    , OUTPUT);
  pinMode(Z_ENABLE_PIN    , OUTPUT);
  
  pinMode(E_STEP_PIN  , OUTPUT);
  pinMode(E_DIR_PIN    , OUTPUT);
  pinMode(E_ENABLE_PIN    , OUTPUT);
  
  pinMode(Q_STEP_PIN  , OUTPUT);
  pinMode(Q_DIR_PIN    , OUTPUT);
  pinMode(Q_ENABLE_PIN    , OUTPUT);
  
   digitalWrite(X_ENABLE_PIN    , LOW);
   digitalWrite(Y_ENABLE_PIN    , LOW);
   digitalWrite(Z_ENABLE_PIN    , LOW);
   digitalWrite(E_ENABLE_PIN    , LOW);
   digitalWrite(Q_ENABLE_PIN    , LOW);
}

void loop () {
  
  if (millis() %1000 <500) 
    digitalWrite(LED_PIN, HIGH);
  else
    digitalWrite(LED_PIN, LOW);
  
  if (millis() %1000 <300) {
    digitalWrite(HEATER_0_PIN, HIGH);
    digitalWrite(HEATER_1_PIN, LOW);
    digitalWrite(FAN_PIN, LOW);
  } else if (millis() %1000 <600) {
    digitalWrite(HEATER_0_PIN, LOW);
    digitalWrite(HEATER_1_PIN, HIGH);
    digitalWrite(FAN_PIN, LOW);
  } else  {
    digitalWrite(HEATER_0_PIN, LOW);
    digitalWrite(HEATER_1_PIN, LOW);
    digitalWrite(FAN_PIN, HIGH);
  }
 
  if (millis() %10000 <5000) {
    digitalWrite(X_DIR_PIN    , HIGH);
    digitalWrite(Y_DIR_PIN    , HIGH);
    digitalWrite(Z_DIR_PIN    , HIGH);
    digitalWrite(E_DIR_PIN    , HIGH);
    digitalWrite(Q_DIR_PIN    , HIGH);
  }
  else {
    digitalWrite(X_DIR_PIN    , LOW);
    digitalWrite(Y_DIR_PIN    , LOW);
    digitalWrite(Z_DIR_PIN    , LOW);
    digitalWrite(E_DIR_PIN    , LOW);
    digitalWrite(Q_DIR_PIN    , LOW);
  } 
 
  digitalWrite(X_STEP_PIN    , HIGH);
  digitalWrite(Y_STEP_PIN    , HIGH);
  digitalWrite(Z_STEP_PIN    , HIGH);
  digitalWrite(E_STEP_PIN    , HIGH);
  digitalWrite(Q_STEP_PIN    , HIGH); 
  delay(1);
  
  digitalWrite(X_STEP_PIN    , LOW);
  digitalWrite(Y_STEP_PIN    , LOW);
  digitalWrite(Z_STEP_PIN    , LOW);
  digitalWrite(E_STEP_PIN    , LOW);
  digitalWrite(Q_STEP_PIN    , LOW);  
}

Can you post a close-up view of the ramps board? Hard to see any details from the picture.

Are you absolutely certain that the stepper driver board is installed correctly?

Does the ramps board have D1 installed? That diode is what connects the 12V supply with Vin of the Arduino, if you want to power the arduino from the 12V supply.

Here is the close up, I removed the driver in orientation I had it. From everything I could find the driver was installed in the correct direction (Potentiometer facing away from the power in). Plus I bench tested it on a breadboard and it works. Both Diodes are installed on the board as well.

Are you feeding 5V into the barrel jack? That is the input to the voltage regulator, it should be about 7V to 12v, not 5V. You should not need that anyway, the ramps board sends 12V to Vin of the Arduino through the D1 diode.

My mistake, I was feeding it with a 8.6V barrel jack to the Arduino. Still when I plug in only the 12V supply nothing happens besides the lights on the Arduino turning on and LED1 flashing quickly.

(Withdrawn - sorry misread schematic)

However, at least your code appears to be running, which suggests there is an issue on the motor side.

Did you set the current limiting on the stepper driver board? Also, make sure the wiring between the ramps board and the motor is correct.

I tried the test code here, it does appear to work running a single stepper motor as you are doing. The ramps board flashes four LEDs, one connected to pin 13 of the Mega (same as the onboard LED of the Mega itself), as well as the LEDs showing power for the heater and fan connectors (labeled D8/D9/D10 on the ramps board).

There is an error in the code, the following lines use the wrong pin numbers.

#define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 14 // ANALOG NUMBERING

The numbers should be either A13 & A14, or 67 & 68.
This will not affect the functioning of the sketch because those pins are not used for the tests.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.