Interfacing Arduino with SMCC-547 Stepper Motor Controller

This week I received a package from my favourite electronic component supplier Futurlec. It contained a very inexpensive stepper motor controller unit called an SMCC-547, made by a company in Thailand. The motor is small, has very little torque, and it has 18° steps, which is quite coarse as stepper motors go. Since I have no experience with stepper motors, I bought it thinking that I would be able to wire it up quickly to an Arduino microcontroller and play with it using Arduino’s Stepper Library.

Unfortunately, the library does not work for this controller. I have not found anything online that shows how to connect this to an Arduino, so I’m documenting it here, as much a reminder for me in case I want to go back to it, as for anyone else who can use it.

Tom Igoe’s stepper motor circuits page shows most motors as requiring a certain sequence of pulses on the four control wires of the motor:

Step wire 1 wire 2 wire 3 wire 4
1 High low high low
2 low high high low
3 low high low high
4 high low low high

However, all this does on the SMCC-547 is make the motor wiggle nervously.

By successively bringing each input HIGH I was able to learn that the correct logic for this controller is to bring the ABCD inputs high in order to make the motor rotate clockwise: A-B-C-D, and to make the motor rotate clockwise, do the inverse: D-C-B-A.

This required writing an Arduino sketch (program) from nothing, but after an hour or so I had this demonstration circuit running. A light sensor is connected to analog pin 0 on the Arduino. In the demonstration sketch, if there is lots of light on the sensor, the motor turns clockwise, and if the sensor is shaded, the motor turns counterclockwise. The sketch is shown below:

/*
Stepper Motor Demonstration
for SMCC-547 Stepper Module

by Michael LeBlanc
NSCAD University
mleblanc@nscad.ca

It checks analogPin(0) and if it is higher than 512,
it rotates the motor clockwise, otherwise counterclockwise.

August 27, 2009
*/

/*
**************** N O T E **************************************
This unit does not work with the stepper.h library.
It works by setting one pin high and the others low.
To rotate clockwise, set inputs high in order A-B-C-D,
and D-C-B-A rotates counterclockwise.
***************************************************************
*/

int analogPin = 0;
int activePin = 1;
int outputPin[5] = {0,10,11,12,13};

void setup()
{
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}

void rotateLeft()  // rotate counterclockwise routine
{
if (activePin == 4)
{
activePin = 1;
digitalWrite(outputPin[4], LOW);
digitalWrite(outputPin[1], HIGH);
}
else
{
digitalWrite(outputPin[activePin], LOW);
activePin = activePin + 1;
digitalWrite(outputPin[activePin], HIGH);
}
}

void rotateRight()   // rotate clockwise routine
{

if (activePin == 1)
{
activePin = 4;
digitalWrite(outputPin[1], LOW);
digitalWrite(outputPin[4], HIGH);
}
else
{
digitalWrite(outputPin[activePin], LOW);
activePin = activePin - 1;
digitalWrite(outputPin[activePin], HIGH);
}
}

void loop()
{
int v;
v = analogRead(analogPin);
//Serial.println(activePin);  // for debugging
if (v > 512) //choose any number between 0 and 1023
{
rotateRight();
}
else
{
rotateLeft();
}
delay(200); // this sets the speed of the motor
}

This sketch is somewhat “brute force,” but it works. A much more elegant solution would be to populate the array with 4-bit binary values and use bitwise shifting and boolean ANDing to assign each output pin of the Arduino a HIGH or LOW state; I found an example of this technique in the Arduino Playground.

Creative Commons License
Stepper Motor Demonstration for SMCC-547 Stepper Module by Michael B LeBlanc is licensed under a Creative Commons Attribution-Noncommercial 2.5 Canada License.

One thought on “Interfacing Arduino with SMCC-547 Stepper Motor Controller”

Leave a Reply

Your email address will not be published. Required fields are marked *