Pages: [1]   Go Down
Author Topic: Arduino Decimilia and Bipolar Stepper Motor  (Read 5300 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know what the fuss is all about Bipolar Stepper Motors from floppy drives...having to use H-Bridge chips and all.

I've done it for 3 different bipolar stepper motors, from 3 different kinds of floppy drives, just by knowing what Pulse Sequence to use....

Most commonly found in Floppy Drives i think is the PL15S-020..... switching sequence and details can be found on: http://www.eminebea.com/content/html/en/motor_list/pm_motor/pdf/pl15s020.pdf.....

Here's my code for it:

There's a 2-way-switch connected to Pin 4 on the board: One for Clockwise movement and the other for Anti-clockwise movement:

Pin 6 = Coil1a
Pin 7 = Coil1b
Pin 8 = Coil2a
Pin 9 = Coil2b
//---------------------------------------------------------------------------
//                    Author:             Kushan Vyas
//                    Qualification:     Electronics and Electrical Engineer
//                     Date:                3rd June 2008
//---------------------------------------------------------------------------

int motorPin1 = 6;
int motorPin2 = 7;
int motorPin3 = 8;
int motorPin4 = 9;
int SwitchPin = 4;
int LEDPin = 13;
int delayTime = 50;

void setup() {

  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);

  pinMode(LEDPin, OUTPUT);
 
  pinMode(SwitchPin, INPUT);
}

void loop() {
  if(digitalRead(SwitchPin) == LOW) {

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

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

    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
    delay(delayTime);
  
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
  }
  else if(digitalRead(SwitchPin) == HIGH) {

    digitalWrite(LEDPin, HIGH);

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

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

    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
    delay(delayTime);
  }
}
//------------------End of Code-----------------------

Any questions or queries are welcome....
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you mean to say you're wiring the stepper directly to the output pins?  Shouldn't you be concerned with back EMF damaging your board?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been experimenting quite a bit with stepper motors recently, and thought that I can help to clear up some confusion from a 'newbie' perspective.  

Although you can generate the step sequence with a micro-controller and send the output through the coils of a stepper, this may cause three main problems.  The first, as the previous poster noted, is that you have no protection to your board from the very high voltage (sighted up to 1000V some places) from the energizing of the motor coils. The second is that all but the smallest motors can run off the low current that is output from the board.  And lastly, using this method you need two output pins for each coil (one for each wire of the stepper). Which can be up to 8 pins per motor.

To solve these issues special controller and driver circuits are used to both isolate and simplify the control lines coming out from your micro-controller.  A really good explanation  of these topics can be read at: http://www.societyofrobots.com/member_tutorials/node/168

A lot of discussion about steppers seem to have an abundance of information, or just a list of parts with little reason for choosing each component.  The above tutorial should give a more round understanding of both the theory of steppers and a practical example of there use.

I would love to talk to someone who is using the Arduino to control multiple steppers and the solution that works best for them.

salernos
« Last Edit: October 21, 2008, 01:52:52 pm by salernos » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Salernos: I don't know how interested you are in the do-it-yourself aspect of wiring steppers, but someone out there (sorry to be so vague, can't seem to find the link) has produced a shield for the arduino that can power and interface steppers, DC motors, and servos.  Looked pretty useful to me, but I just don't need all that superfluous functionality.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

datalurkur:  
Yea I have seen a couple different motor shields specifically for the Arduino, but currently am running a hand rolled solution.  At first I used 4 d-flip-flops to generate a 'wave' step pattern.  Then I was able to reduce that down to two d-flip-flops based on the observation that for a 'full step' pattern two wires are always high.  This also allowed me to add a couple of xors to add direction control.  

With this sequence I run the four leads through a series of darlingtons (tip41 i think) to power the motor itself.

If anyone wants to see my layout I can create the schematic and post it up here.  

I would be interested to see if anyone has used the l297 chip with a series of darlingtons. I am looking into reducing some of my design with this chip.

salernos
« Last Edit: October 22, 2008, 12:31:00 pm by salernos » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

salernos

I would be interested in seeing your layout and schematic, and perhaps a code snipet.

kushan_2001 I would like to see your layout as well

SubMicro
« Last Edit: December 07, 2008, 09:05:12 pm by SubMicro » Logged

SubMicro
Electronics newbie & Home Machinist

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to drive two steppers (Soyo 6 volt 0.6 amp) simultaneously, with differing number of steps to each motor. I have been testing both the Adafruit motor shield (which can drive 2 steppers), and the Pololu A4983 stepper motor driver carrier (need one of these for each motor). Neither of these solve the problem of simultaneous operation. In both cases, you will need to use software to step motor A one step, then step motor B one step and keep looping until you have moved the desired number of steps. It gets a bit tricky if one motor needs to move a different number of steps than the other. Has anyone found a better solution?
Logged

Pages: [1]   Go Up
Jump to: