go_away

Author Topic: Unipolar Stepper Motor  (Read 782 times)

0 Members and 1 Guest are viewing this topic.

Offline extreme.alyTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Unipolar Stepper Motor
« on: March 29, 2013, 12:33:47 PM »
Hello,

I recently bought a Unipolar Stepper Motor. It makes 7.5 degree of rotation per step (48 steps/rev).

I tried it on Arduino using ULN2003 with the Arduino's built-in Stepper.h library. It worked perfectly.

But the problem is, I don't want to use the built-in library. I want to make it work without the library. The reason for doing this is, I'll be using the same stepper motor on PIC and I think we don't have a library on PIC for this.

So I tested the following sequence:
1110
1101
1011
0111
And tested it with different delays after updating the new values. But the stepper motor did nothing but to vibrate about its original position. The bigger the delay, more jerky motion it produced.

Please help me make my own set of functions to control this stepper motor!

Here is the code I'm testing:
Code: [Select]
int motorPin1 = 7;
int motorPin2 = 8;
int motorPin3 = 9;
int motorPin4 = 10;
int delayTime = 100;

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, LOW);
  delay(delayTime);
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, HIGH);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  delay(delayTime);
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, HIGH);
  digitalWrite(motorPin4, LOW);
  delay(delayTime);
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, HIGH);
  delay(delayTime);
}
« Last Edit: March 29, 2013, 12:35:18 PM by extreme.aly »

Offline extreme.alyTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: Unipolar Stepper Motor
« Reply #1 on: March 29, 2013, 12:51:31 PM »
Opps, fixed the code in the next minute of posting the thread! :P

Switched motorPin2 and motorPin3!

But still I have a question. I don't get the same torque with this code as with the Library code. Why?

I tried another sequence:
0011
0010
0110
0100
1100
1000
1001
0001
This has even lesser torque =/

What's the best sequence? I need as much torque as possible!

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: Unipolar Stepper Motor
« Reply #2 on: March 29, 2013, 04:41:01 PM »
Microchip has some App Notes on using stepper motors. These do discussion the switching sequence and driver circuits. Look them up and read.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 109
Re: Unipolar Stepper Motor
« Reply #3 on: March 30, 2013, 01:16:48 PM »
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here