Subscribe to Arduino Academy and start learning today for FREE!

Stepper Motor Project

Since I’m waiting for some more parts to come in for my water level sensor I’m building for our aquaponics project, I thought I’d work on a stepper motor controller.

We use these controllers at work, and I wanted to get more experience with them. The ones at work are driven by a MS-Dos powered 486 computer, with a CIO-DIO24 interface card. These cards are obsolete, expensive ($159), and the PC’s are old, bulky, and difficult to upgrade to newer hardware. The code was written in assembly and compiled basic, source code no longer available, and doesn’t like newer, faster hardware.

The controller we are using is the SD200 Step Motor Drive Module. These are also obsolete, but still available. They retailed for about $135, but I’ve seen them online for less than $75.

There are 4 power connections. +5vdc and gnd for the controller, and +12-40vdc and gnd for the motor. Motor current may not exceed 2.5 amps. A low ESR, high ripple current 4700 μf capacitor is installed across the motor inputs, pins 13 & 18.

There are 3 inputs necessary, Enable, CW/CCW, and Pulse. Direction is controlled by applying high or low to the CW/CCW pin. Bring Enable high to activate the controller, and send a pwm signal to the Pulse pin.

Become the Maker you were born to be. Try Arduino Academy for FREE!

There is a startup sequence necessary:

1. Bring Enable low
2. Apply 5vdc
3. Apply motor voltage
4. Bring Enable high

To shutdown the motor:

1. Bring Enable low
2. Drop motor voltage
3. Drop 5vdc

There is overcurrent protection. If there is a short, or the motor pulls more than 2.5 amps, pin 11 (enable) will need to be pulled low, or the shutdown/startup procedure will need to be run to reset. I’ve written two sub routines, called startup and shutdown, and a third called reset, that I can call from within my program. I’ve installed transistors on pin 12 & pin 18 so that I can enable/disable module and motor power from these subroutines.

The stepper motor I’m using is a Applied Motion HT17-073.

More details to come!

Subscribe
Notify of
guest
2 Comments
Inline Feedbacks
View all comments
Unknown
6 years ago

HELLO GUYS, I NEED YOUR HELP. I HAVE THIS SAME BOARD WANT TO CONTROL 2 STEPPER MOTORS FOR A PROJECT AND SINCE I'M NOT A PROGRAMMER I CAN'T FIGURE OUT HOW TO SOLVE THIS PROBLEM.( AF_ stepper motor(200,1) HIGHLIGHTED WITH A MESSAGE – AF_stepper does not name a type.

const int buttonPin1 = 12; //JOG BUTTON CLOCKWISE
const int buttonPin2 = 11; //JOG BUTTON COUNTERCLOCKWISE

#include
#include

// Define the stepper and the pins it will use
AF_Steper motor1(200, 1);
AccelStepper stepper1
// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
void forwardstep(); {
motor1.onestep(FORWARD, SINGLE);
}
void backwardstep() {
motor1.onestep(BACKWARD, SINGLE);
}

AccelStepper stepper1(forwardstep, backwardstep); // use functions to step

// Define our three input button pins
#define LEFT_PIN A5
#define STOP_PIN A4
#define RIGHT_PIN A3

// Define our analog pot input pin
#define SPEED_PIN A0

// Define our maximum and minimum speed in steps per second (scale pot to these)
#define MAX_SPEED 500
#define MIN_SPEED 0.1

void setup() {
// The only AccelStepper value we have to set here is the max speeed, which is higher than we'll ever go
stepper1.setMaxSpeed(500.0);

// Set up the three button inputs, with pullups
pinMode(LEFT_PIN, INPUT_PULLUP);
pinMode(STOP_PIN, INPUT_PULLUP);
pinMode(RIGHT_PIN, INPUT_PULLUP);
}

void loop() {
static float current_speed = 0.0; // Holds current motor speed in steps/second
static int analog_read_counter = 1000; // Counts down to 0 to fire analog read
static char sign = 0; // Holds -1, 1 or 0 to turn the motor on/off and control direction
static int analog_value = 0; // Holds raw analog value.

// If a switch is pushed down (low), set the sign value appropriately
if (digitalRead(LEFT_PIN) == 0) {
sign = 1;
}
if (digitalRead(RIGHT_PIN) == 0) {
sign = -1;
}
if (digitalRead(STOP_PIN) == 0) {
sign = 0;
}

// We only want to read the pot every so often (because it takes a long time we don't
// want to do it every time through the main loop).
if (analog_read_counter > 0) {
analog_read_counter–;
}
else {
analog_read_counter = 3000;
// Now read the pot (from 0 to 1023)
analog_value = analogRead(SPEED_PIN);
// Give the stepper a chance to step if it needs to
stepper1.runSpeed();
// And scale the pot's value from min to max speeds
current_speed = sign * ((analog_value/1023.0) * (MAX_SPEED – MIN_SPEED)) + MIN_SPEED;
// Update the stepper to run at this new speed
stepper1.setSpeed(current_speed);
}

// This will run the stepper at a constant speed
stepper1.runSpeed();
}

Steve Spence
6 years ago

First issue, you misspelled stepper – "AF_Steper"

Archives

2
0
Would love your thoughts, please comment.x
()
x