<p>I have been working with the <a href="https://reprap.org/wiki/MiniRambo" rel="nofollow noreferrer">MiniRambo Controller</a> to try to drive 3 stepper motors using the <a href="http://www.airspayce.com/mikem/arduino/AccelStepper/" rel="nofollow noreferrer">AccelStepper library</a>. The stepper motors are <a href="https://openbuildspartstore.com/nema-17-stepper-motor/" rel="nofollow noreferrer">NEMA 17</a>s with the following specifications:</p>

<p><a href="https://i.sstatic.net/P2GO7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/P2GO7.png" alt="NEMA 17 Stepper Motor Specifications"></a></p>

<p>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.</p>

<pre><code>#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();
}
</code></pre>

<p>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.</p>

<p>I calculated the value to <code>analogWrite</code> to my PWM pin by referencing the Marlin firmware which states the following for the MiniRambo:</p>

<pre><code>#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}
</code></pre>

<p>Another semi-important piece of information is that I am powering the MiniRambo with a <a href="https://openbuildspartstore.com/24v-meanwell-power-supply-bundle/" rel="nofollow noreferrer">24V/14.6A power supply</a>.</p>

<p>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 :)</p>

CC BY-SA 4.0
2019-11-10T18:44:57.410Z
You are asking to write the firmware from scratch, don't you?
Trish
CC BY-SA 4.0
2019-11-10T18:46:18.520Z
Yup, essentially. I want to write the code that coordinates the movement of the 3 stepper motors (x, y, and z axis) to draw a picture.
peachykeen
CC BY-SA 4.0
2019-11-11T08:26:14.747Z
ohhh, a plotter`firmware? https://www.thingiverse.com/search?sort=relevant&q=plotter&type=things&dwh=745dc91b3633ea0
Trish
CC BY-SA 4.0
2019-11-11T13:47:03.170Z
Right, similar to this link. But I would like to build it myself, hence my question.
peachykeen
CC BY-SA 4.0
2019-11-11T18:16:25.190Z
I have frequently gotten the stuttering you describe with a bad connection to the board, usually from poor/dislodged crimping on the wires between the motor to the board. Something to check
K Mmmm
CC BY-SA 4.0
2019-11-11T22:51:11.793Z
@KMmmm this was a good thought - I tried attaching the wires/crimps directly to the board rather than going through a plastic connector and the issue persists.
peachykeen
CC BY-SA 4.0
2019-11-12T14:24:18.267Z
@peachykeen sometimes cables break in the middle. Try with a short cable, which is fresh, as kind of a  "teststand".
Trish
CC BY-SA 4.0
2019-11-12T14:48:23.707Z
There could be a plethora of things you're doing wrong! That's way too much scope for a question like this? Are you sure the driver's aren't shutting down because of over current? Could they be resetting due to brown outs? Are you trying to drive them too fast? Are the motors good? Are the drivers good? Please state/give us answers to how you know everything has been hooked up properly.
user77232
CC BY-SA 4.0
2019-11-12T15:04:46.107Z
@user77232 I will try to answer your questions as best I can.

Too much current? Well I posted my calculation above.

Brown-outs? How would I test for this? My PS is brand new and when measured doesn't spike or drop.

Driving too  fast? I don't think so, I am at the lower end of the speed.

Are the drivers good? Well, I just got the controller, but perhaps I could  have burnt them out. Hence, my question about testing for a burnt out driver.

Hooked up properly? I followed the schematic on the wiki linked above. If you want a screenshot I can provide that too.
peachykeen
CC BY-SA 4.0
2019-11-12T15:32:23.880Z
Put 12v light bulbs on the output of the drivers to see if they blink when you give step commands.
user77232
CC BY-SA 4.0
2019-11-12T17:16:16.420Z
@user77232 Would I be able to use a multimeter here?
peachykeen
CC BY-SA 4.0
2019-11-13T04:09:55.313Z
@peachykeen, nope. Gotta use an Oscilloscope or a bulb
user77232
CC BY-SA 4.0
2019-11-15T20:40:30.820Z
I solved my issue. I read one of the diagrams wrong and hooked my wires up incorrectly. :(
peachykeen
<stepper-driver><stepper><motor><plotter>
Driving a Stepper Motor with a Mini-Rambo Controller
peachykeen
# Driving a Stepper Motor with a Mini-Rambo Controller

(Asked by: username_0 on 2019-11-10)

I have been working with the [MiniRambo Controller](https://reprap.org/wiki/MiniRambo) to try to drive 3 stepper motors using the [AccelStepper library](http://www.airspayce.com/mikem/arduino/AccelStepper/). The stepper motors are [NEMA 17](https://openbuildspartstore.com/nema-17-stepper-motor/)s with the following specifications:

[![NEMA 17 Stepper Motor Specifications](https://i.sstatic.net/P2GO7.png)](https://i.sstatic.net/P2GO7.png)

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](https://openbuildspartstore.com/24v-meanwell-power-supply-bundle/).

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 :)

**Tags:** stepper-driver, stepper, motor, plotter

> **Comments:**
> **username_1**: You are asking to write the firmware from scratch, don't you?  
> **username_0**: Yup, essentially. I want to write the code that coordinates the movement of the 3 stepper motors (x, y, and z axis) to draw a picture.  
> **username_1**: ohhh, a plotter`firmware? https://www.thingiverse.com/search?sort=relevant&q=plotter&type=things&dwh=745dc91b3633ea0  
> **username_0**: Right, similar to this link. But I would like to build it myself, hence my question.  
> **username_2**: I have frequently gotten the stuttering you describe with a bad connection to the board, usually from poor/dislodged crimping on the wires between the motor to the board. Something to check  
> **username_0**: @username_2 this was a good thought - I tried attaching the wires/crimps directly to the board rather than going through a plastic connector and the issue persists.  
> **username_1**: @username_0 sometimes cables break in the middle. Try with a short cable, which is fresh, as kind of a  "teststand".  
> **username_3**: There could be a plethora of things you're doing wrong! That's way too much scope for a question like this? Are you sure the driver's aren't shutting down because of over current? Could they be resetting due to brown outs? Are you trying to drive them too fast? Are the motors good? Are the drivers good? Please state/give us answers to how you know everything has been hooked up properly.  
> **username_0**: @username_3 I will try to answer your questions as best I can.  Too much current? Well I posted my calculation above.  Brown-outs? How would I test for this? My PS is brand new and when measured doesn't spike or drop.  Driving too  fast? I don't think so, I am at the lower end of the speed.  Are the drivers good? Well, I just got the controller, but perhaps I could  have burnt them out. Hence, my question about testing for a burnt out driver.  Hooked up properly? I followed the schematic on the wiki linked above. If you want a screenshot I can provide that too.  
> **username_3**: Put 12v light bulbs on the output of the drivers to see if they blink when you give step commands.  
> **username_0**: @username_3 Would I be able to use a multimeter here?  
> **username_3**: @username_0, nope. Gotta use an Oscilloscope or a bulb  
> **username_0**: I solved my issue. I read one of the diagrams wrong and hooked my wires up incorrectly. :(  

---

## 0 answers

