I have been working with the MiniRambo Controller to try to drive 3 stepper motors using the AccelStepper library. The stepper motors are NEMA 17s with the following specifications:
I am trying to avoid using Marlin Firmware because I want to first make a 2D printer (i.e. a "drawbot") using my own code before upgrading my build to be a 3D printer. Thus far, I have the following for code, where the pin mappings were taken from the Marline firmware and checked against the schematic on the wiki linked above.
#include "AccelStepper.h"
#include "Wire.h"
#define X_STEP_PIN 37
#define X_DIR_PIN 48
#define X_MIN_PIN 12
#define X_MAX_PIN -1
#define X_ENABLE_PIN 29
#define X_MS1_PIN 40
#define X_MS2_PIN 41
#define Y_STEP_PIN 36
#define Y_DIR_PIN 49
#define Y_MIN_PIN 11
#define Y_MAX_PIN -1
#define Y_ENABLE_PIN 28
#define Y_MS1_PIN 69
#define Y_MS2_PIN 39
#define Z_STEP_PIN 35
#define Z_DIR_PIN 47
#define Z_MIN_PIN 10
#define Z_MAX_PIN 23
#define Z_ENABLE_PIN 27
#define Z_MS1_PIN 68
#define Z_MS2_PIN 67
#define E0_STEP_PIN 34
#define E0_DIR_PIN 43
#define E0_ENABLE_PIN 26
#define E0_MS1_PIN 65
#define E0_MS2_PIN 66
#define MOTOR_CURRENT_PWM_XY_PIN 46
#define MOTOR_CURRENT_PWM_Z_PIN 45
#define MOTOR_CURRENT_PWM_E_PIN 44
#define LED_PIN 13
#define ELECTRONICS "RAMBo13a"
AccelStepper stepper(1, Y_STEP_PIN, Y_DIR_PIN); // 1 = Driver
void setup() {
analogWrite(46,166);
stepper.setMaxSpeed(200);
stepper.setSpeed(50);
stepper.setAcceleration(10);
stepper.setEnablePin(Y_ENABLE_PIN);
stepper.setPinsInverted(false, false, true); //invert logic of enable pin
stepper.enableOutputs();
}
void loop() {
stepper.runToNewPosition(0);
stepper.moveTo(500);
while (stepper.currentPosition() != 300)
stepper.run();
}
Currently, my motors will move on very rare, seemingly unpredictable occasions. When they do move, they tick once and then stop moving. Since I still see some of this behavior from time-to-time I don't think I have burnt out my drivers - but who knows. The MiniRambo uses four A4982 stepper motor drivers.
I calculated the value to analogWrite
to my PWM pin by referencing the Marlin firmware which states the following for the MiniRambo:
#define MOTOR_CURRENT_PWM_XY_PIN 46
#define MOTOR_CURRENT_PWM_Z_PIN 45
#define MOTOR_CURRENT_PWM_E_PIN 44
// Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
#ifndef MOTOR_CURRENT_PWM_RANGE
#define MOTOR_CURRENT_PWM_RANGE 2000
#endif
#define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250}
Another semi-important piece of information is that I am powering the MiniRambo with a 24V/14.6A power supply.
Any help getting my motors to spin would be greatly appreciated! Further, if you know of a way to test my motor driver to see if it burnt out, I would like to hear about it! When explaining, please keep in mind that I am totally new to the space and not very familiar with much of the electronics (more of a software person). Thank you in advance for your help :)