Using RAMPS 1.4 to control 2 stepper motors

Hello all (first post!),

I am trying to set up a wire cutting machine which consists of 2 bipolar, 4 wire stepper motors which I want to control from my Arduino.

Ideally I want to be able to send the Arduino a number of pulses from a PC via serial, which will then send that on to my stepper driver.

I am using an Arduino Mega 2560 with a RAMPS 1.4 board attached, and Pololu A4988 drivers. I thought I could just use 2 of the axes on the RAMPS board to control the motors, without using anything else. I would rather write my own Arduino sketch from scratch, rather than using one of the RAMPS libraries.

On closer inspection of the RAMPS board, it appears the step and direction pins are connected to the A0 and A1 pins respectively on the Arduino. However when I use a standard demo sketch for stepper motors, using the pins 54 and 55, nothing at all happens to the motor.

My question is, can I use the RAMPS board in this way? If so, what am I doing wrong?

I should mention I have connected a 24V power supply to the RAMPS board, however I'm not sure which of the 2 supplies to connect it to... Have tried both with same result (do I need to connect both?) :frowning:

// Pins for the RAMPS board
const int X_STEP_PIN         = 54;
const int X_DIR_PIN          = 55;
const int X_ENABLE_PIN       = 38;  // Active LOW

const int Y_STEP_PIN         = 60;
const int Y_DIR_PIN          = 61;
const int Y_ENABLE_PIN       = 56;  // Active LOW

const int Z_STEP_PIN         = 46;
const int Z_DIR_PIN          = 48;
const int Z_ENABLE_PIN       = 62;  // Active LOW

Set the ENABLE pin LOW to activate the stepper driver.
Set the DIR pin HIGH for one direction and LOW for the other.
Pulse the STEP pin HIGH briefly to take a step.

A delay between steps of roughly 500 to 1000 microsecond (1000 to 2000 pulses per second) should give you reasonable speed using the 16x microstepping (all three jumpers under the driver board installed).

Try to use the existing libraries. They exist for a reason. That reason is called "G code." It is 1000% easier to send "go 20mm" from the PC than trying to get a specific number of pulses in a specific time.

Thanks for your help, john, Morgan.

Found out what I was doing wrong was not setting the enable pin to LOW. Although I can't say I fully understand why I have to turn a pin LOW to make something turn on.

i am using the same project.
can u tell me weather i can connect my setup to pc using usb also when 12 volt external dc power supply is on and the two motors are connected?do this condition burn the board?because my board got burned when using ramps 1.4+arduino mega 2560+polulo step drive,while everything was set accordingly.

kumarmawana1:
can u tell me weather i can connect my setup to pc using usb also when 12 volt external dc power supply is on and the two motors are connected?

That's no problem. It is the normal way the board is used.

...R