Pages: [1]   Go Down
Author Topic: help with 2-phase bipolar stepper?  (Read 2179 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody:

I've posted a plea for help on my blog, and I'd really appreciate any help you could offer! I plan to drive this puppy with Arduino, but I have to figure out how to put together a stepper driver first. Can anybody help me with that?

Thanks!

Adam
« Last Edit: March 17, 2009, 08:12:23 am by adamohern » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34188
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try looking at:-
http://www.thebox.myzen.co.uk/Workshop/Motors_4.html
Logged

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

if your stepper requires low current is possible use l293
Logged

Rural Arizona
Offline Offline
Edison Member
*
Karma: 7
Posts: 1711
Incorrigible tinkerer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I really ought to charge you for this,  because you've piqued my curiosity,  and now I'll be forced to order some of the little beggars   smiley-wink

If you look at the timing diagram on Goldmine's schematic,  you should be able to drive the motor by reproducing the outputs of the flip-flops with digital pins.

Notice that two of the 3 phases are simply inverses of each other.  So,  you can drive the motor with two pins:  one through a pair of buffers from a '365 going to the blue wire,  and one that drives the red wire through a pair of '365 buffers and the yellow wire through a pair of '366 buffers.

Here's the code to run it:

Code:
/*
 * Driver for small steppers from Goldmine Electronics
 * (catalog # G14197)
 */
 
#define NUM_MOTORS 2
// Change these lines to select the desired pins
#define MOTOR_0_BLUE 8
#define MOTOR_0_RED  9
#define MOTOR_1_BLUE 10
#define MOTOR_1_RED 11

const byte Blue_pin[NUM_MOTORS] = { MOTOR_0_BLUE, MOTOR_1_BLUE } ;
const byte Red_pin[NUM_MOTORS] = { MOTOR_0_RED, MOTOR_1_RED } ;

const int Blue_seq[4] = { LOW, LOW, HIGH, HIGH } ;
const int Red_seq[4] = { LOW, HIGH, HIGH, LOW } ;
byte Motor_index[NUM_MOTORS] = { 0, 0 };

void setup()
{
      byte i;
      for (i = 0; i < NUM_MOTORS; i++)
            {
            pinMode(Blue_pin[i], OUTPUT);
            pinMode(Red_pin[i], OUTPUT);
            digitalWrite(Blue_pin[i], LOW);
            digitalWrite(Red_pin[i], LOW);
            }
}

void loop()
{
      /*
       * Insert code here that will call motor_left and motor_right
       * to spin the motor as desired
       */

}

      // The "& 3" in the motor movement routines constrains the
      // value of Motor_index[motor] to a range of 0 through 3,  wrapping
      // it correctly when it goes out of range.
void motor_left(byte motor)
{
      Motor_index[motor] = (Motor_index[motor] - 1) & 3;
      digitalWrite(Blue_pin[motor], Blue_seq[Motor_index[motor]]);
      digitalWrite(Red_pin[motor], Red_seq[Motor_index[motor]]);
}

void motor_right(byte motor)
{
      Motor_index[motor] = (Motor_index[motor] + 1) & 3;
      digitalWrite(Blue_pin[motor], Blue_seq[Motor_index[motor]]);
      digitalWrite(Red_pin[motor], Red_seq[Motor_index[motor]]);
}

In theory,  you could run a couple of motors directly off the Arduino,  but I would caution against that:  I'm not convinced that the motor is really drawing 20mA per phase because it's supposed to,  and not because it maxed out the drive capability of the pin.  It could be overtaxing that PIC chip and shortening its life.

You should probably also add a pair of protective diodes (one with anode to ground,  one with cathode to +5) to each motor winding to absorb the inductive kickback.

Ran
Logged

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

Would it be possible to run these motors(I assume they are part G14197 on electronic goldmine) using the stepper library in the arduino IDE?  There is an example code in the 0017 Arduino IDE called motorKnob.  Would it be possible to run these motors using that code?  If possible, how would you need to wire it and what modifications to the code would be necessary.
« Last Edit: August 06, 2010, 05:48:54 pm by Leviathan34 » Logged

Rural Arizona
Offline Offline
Edison Member
*
Karma: 7
Posts: 1711
Incorrigible tinkerer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Would it be possible to run these motors using that code?

I haven't tried it yet, but it appears some people have had some success wiring it as a bipolar stepper:  see this article.  Note:  I think there may be some bad guesses by people who posted comments in reply to the article.  At least one appeared wrong, at first look.
Logged

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

hey there,

I was playing with a motor like that earlier, it had a mirror attached
I thought it was a 3 phase stepper with a common ground but one of the coil was 120 ohm while the other two were 60 ohm

I tried a couple things but I got tired I cut the white wire, and hook the red/yellow coil to pin 1 and 2, then the blue/red coil to 3 and 4 and just ran the stepper demo sketch and OMG, it just worked (after changing the pins of course)

it's probably sourcing way too much current from the avr but it didn't let the magic smoke out so I won't have to send it refilled at the factory yay !!

good times !
Logged

Pages: [1]   Go Up
Jump to: