Help with a switec stepper motor and controller

Hello everybody

I am making some gauges for my car. I started with a 360 servo but had trouble accurately positioning the needle.

After muchos googling i found and ordered a couple of these x25-589 and a x12-017 dual controller. They arrived today. woot woot
http://www.microcomponents.ch/products/switec/switec.html

The servos use a 1/180 gear reduction to get 1/3 of a degree rotation, so should make really nice accurate movements. I am pretty sure the servos will operate with the normal stepper motor arduino code.

It's the controller chip that has got me all confused. I have read through the datasheet pdf http://www.microcomponents.ch/downloads/switec/X12_017_05_SP_E.pdf and it suggests that i need to connect two output pins to the controller chip for each gauge i want to drive. It seems one pin controls the direction and the other i guess controls the number of turns of the shaft.

I keep re-reading the pdf but i am not sure what i should be sending down to the controller chip from the ardiuno. Any help would be very much appreciated. I am writing all this up into "make yourself a digital/analogue gauge" tutorial

from the pdf:

  • The rising edge of the f(scx) input signal moves the
    rotor by one microstep.
  • The input signal "CW/CCW" (clockwise / counterclockwise)
    controls the direction of rotation of the
    motor.
  • The input signal "RESET" at low resets the output
    driver sequence to position 1.

What is a f(scx) input signal?
To change direction would high be CW and low CCW?

ok i have given up on using the controller for the time being and wanted to drive it directly off the arduino. From what i have read else where it should behave just like a normal stepper.

I have rigged up a potentiometer to analogue pin 0 and wired the four stepper motor pins 1-4 to digital output pins 8,9,10 and 11.

I then loaded up the MotorKnob sketch that's in the reference but absolutely nothing happens on the stepper shaft.

Can anyone have a look at the datasheet (http://www.microcomponents.ch/downloads/switec/X25_xxx_02_SP_E.pdf) and tell me if what i am doing is on the right track.

I am really stuck on this.

Having a look at your code would prove more useful.

ok i didn't bother posting it because i haven't changed it from the code that comes with arduino

but here it is:

/*

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
// set the speed of the motor to 30 RPMs
stepper.setSpeed(30);
}

void loop()
{
// get the sensor value
int val = analogRead(0);

// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);

// remember the previous value of the sensor
previous = val;
}

This post suggests that the stepper i have should work with any bipolar/ four wire stepper motor controller.

http://www.adafruit.com/forums/viewtopic.php?f=25&t=8269&view=previous

Do i have to have a stepper motor controller?

I read this on another forum:
Bipolar stepper motors can be driven by using H-bridge circuit like SN754410 from Texas Instruments.

Does this mean that they have to be driven from another circuit or can they be driven directly from a arduino? sorry if this seems a stupid question but i am a bit confused.

Do i have to have a stepper motor controller?

It depends on the voltage and current requirements of the stepper motor. I have a mini-stepper that I drive directly from the Arduino. It is a 5V, low current motor. Driving it is simply a matter of hooking up the 4 wires to 4 pins, and setting the 4 pins HIGH or LOW correctly, in the correct order to make it step.

If the stepper motor is higher voltage, or draw more than 20 mA, or you want a simpler interface, the use of a motor controller is required.

it is low current typically drawing 15mA at 5v. So i won't need a controller, right?

there is a table on page 6 of the pdf i linked to above. It looks like it might be what i need but it doesn't make sense to me. Any chance you could take a look and see if it makes sense to you?

or something like:
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

I got confused by that chart. Prior to the chart is says that the motor operates on 0 to 5V logic. Well, great, that's what the Arduino outputs.

But then the chart shows negative voltage applied to some pins during parts of the full rotation cycle.

I don't know what to make of the chart.

bummer but thanks for looking.

the numbers along the top say they are rotor positions.

does it mean that to move the rotor to position 1
pin 1 high
pin 2&3 low
pin 4 high

but that would mean the shaft could only be in 6 positions.

from the pdf:
The M-S series consist of a "Lavet" type stepper
motor and a gear train. The integrated two step gear
train reduces the rotation by a factor of 180 whereby a
full step driving pulse results in a one degree rotation
of the pointer shaft.

does the gearing mean that sending it all 6 pin combinations would move 1 deg.

still not sure what the coil voltage means

Does anyone think this has a chance of working?

I have used the table of page 6 of the PDF datasheet for the motor. http://www.microcomponents.ch/downloads/switec/X25_xxx_02_SP_E.pdf

int motorPin1 = 8;
int motorPin2 = 9;
int motorPin3 = 10;
int motorPin4 = 11;
int delayTime = 500;

void setup() {
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
}

void loop() {

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(delayTime);

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);

digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(delayTime);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(delayTime);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, HIGH);
delay(delayTime);

digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(delayTime);
}

This is the most sense i can make of the table in the pdf but i have no idea what it will do if i run it. I guess i'll find out. Please reply if you know this will fry something.

ta toby

I would try this, I can't see it doing any harm.

do I?
The difference between 3 and 4 is that pin one drops low. everything else is the same. I'll double check.

Assuming i get the pin outs correct, what would you expect this code to do?

a) nothing at all
b) each iteration of the loop rotates the shaft 1/3 of a degree. continuous movement of the motor shaft until it hits the stop at 315 degrees.
c) you slap you palm to your face due to my lack of knowledge about steppers

mike you edited your post.

ok cool, i'll wire it up and see what happens.

nope no good. the above code does nothing.

I changed the delay as it seemed to want a 235hz pulse frequency. i am not sure if this is right or i need to divide it.

anyone got any ideas? Is it possible i have damaged the coils through hamfisted soldering? i was pretty neat.

nope no good. the above code does nothing.

I changed the delay as it seemed to want a 235hz pulse frequency. i am not sure if this is right or i need to divide it.

anyone got any ideas? Is it possible i have damaged the coils through hamfisted soldering? i was pretty neat.

no good still doesn't work. the shaft doesnt move at all.

i can measure a change in voltage between pin 1 and 2 that changes from +5 to 0 to -5v that matches the diagram.

The datasheet refers to a Start-Stop-Frequency FSS
I don't understand what this is. would it be represented by the delay between pulses?

would it be represented by the delay between pulses?

Yes but it says the rate is 200 Hz which is a time delay of 5mS. This is the maximum so any slower would be fine. As you have 500mS there should be defiantly no problem with going too fast.
Do you detect any twitching in the motor or any small noise that might suggest something is happening?

You could try measuring the current.

I couldn't measure any current between pins 1 & 2. I guess i must have damaged it when soldering. I did do it with a hangover and soldered directly to the pins. This time chopped a dil ic holder in half which fit nicely over the pins. I soldered my wire to the ic holder and plugged it in...

woot woot movement. the needle moved round nice and slowly. So that gets me what i need to write the rest of the program to display a temp scale.

thanks for the help