Show Posts
Pages: [1]
1  Using Arduino / Motors, Mechanics, and Power / Re: Old six wire stepper motor... Seagate -- Not sure what I have on: March 15, 2013, 05:07:43 pm
So could I use a pair of ULN2004AN darlington arrays to achieve all five phases?
4 through the first ULN2004AN and 1 through a second? -- seems like that would work?
2  Using Arduino / Motors, Mechanics, and Power / Re: Continuous Rotation Servo on: March 13, 2013, 11:16:16 pm
#7 -- Thank you for pointing that out. I  missed a very valuable step smiley
3  Using Arduino / Motors, Mechanics, and Power / Re: Old six wire stepper motor... Seagate -- Not sure what I have on: March 13, 2013, 10:06:58 pm
Hey thanks for all the replies... the PDF is now attached -- thanks for making me realize that hadn't gone as well.
Capital I
4  Using Arduino / Motors, Mechanics, and Power / two button + pot control of continous rotation servo -- on: March 13, 2013, 09:51:23 pm
Thanks to this form and all the replies I've gotten my continuous rotation servo working as I want using the code I put together below to drive my SM-S4303R servo at varying speeds both clockwise and anti-clockwise.
I did this with the standard Arduino servo library -- nothing fancy -- and feel free to comment and suggest improvement -- I've had my Arduino about 1 month.

Thank you all -- I hope my code will be useful to future readers!

Code:
// Ian Schlueter // March 2013 //
//
// A sketch to control a continuous servo using
// 1) two buttons, one incriments a state counter for rotate/stop, the other for direction of rotation
// 2) one analog sensor mapped to allow normal "zero to max" speed control regarless of direction
// 3) one three wire continuous rotating servo:  stop=90 : max clockwise=180 : max anticlockwise=0
//
//


#include <Servo.h>        //  load the standard arduino servo library

Servo servo1;             // create servo object
const int servo1Pin=3;    // constant servo 1 pin
const int rotStop = 92;   // send what value to servo to stop it?
const int ControlPin=A0;  // pin to map to control value for speed

const int but1Pin=4;      // pin for button 1
const int but2Pin=5;      // pin for button 2
int but1Count=0;          // global: button 1 initial counter value
int but2Count=0;          // global: button 2 counter counter value
int lastbut1Sensor=0;     // global: last reading of the button sensor -- so we don't act except once per press
int lastbut2Sensor=0;     // global: last reading of the button sensor -- so we don't act except once per press

const int freq1 = 50;     // how often to check the buttons 50ms*20=1s or 20 times a second
unsigned long timer1;     // Holds the next check time.


void setup()
  {
    pinMode(but1Pin, INPUT);    // buttons are inputs
    pinMode(but2Pin, INPUT);    // buttons are inputs
    pinMode(ControlPin, INPUT); // analog controlPin
    servo1.attach(servo1Pin);   // attach the servo to the servo pin
    timer1=millis();            // using the internal clock starting..... now....
//    Serial.begin(9600);       // serial data if needed, comment if not

  }



void loop()
{// ******** BEGIN Main Event LOOP *************
  int rotSpeed;
    if (millis() >= timer1)
    {
      timer1 += freq1;
    }
  butSet();
  if (but1Count == 0)
    servo1.write(rotStop);
  else
  {
//  Serial.print("rotSpeed on Return=");   // use if you are questioning the return from getSpeed)
//  Serial.println(getSpeed(rotSpeed));    //
  servo1.write(getSpeed(rotSpeed));        // write the speed from your analog input to servo1
  }

  
}


// ******** END Main Event LOOP *****************

// ******** Begin Functions

int butCheck()  //  Call this to serial print the button states, otherwise don't call it
 {
    Serial.print("State>");
    Serial.print(but1Count);
    Serial.print("<< -- BUT1 --- BUT2 -- >>");
    Serial.print(" state >");
    Serial.println(but2Count);
    
    
 }
 
void butSet()   //  check the status of our buttons and act accordingly
{  
      int but1Sensor= digitalRead(but1Pin);       // local sensor variable
      int but2Sensor= digitalRead(but2Pin);       // local sensor variable

      if (but1Sensor != lastbut1Sensor)           // Has the button changed since last we looked?
      {
        if (but1Sensor == HIGH)                   // is the button HIGH?
        {
          but1Count++;                            // count it if it's HIGH
        }
        lastbut1Sensor=but1Sensor;                // tell the world we just got HIGH
      }
      if (but1Count >= 2)                         // check to see if the count is too high
      {
        but1Count=0;                              // and set back to zero if it is
      }
       if (but2Sensor != lastbut2Sensor)          // has the button changed since last we looked?
      {
        if (but2Sensor == HIGH)                   // is it HIGH?
        {
          but2Count++;                            // count it if it's HIGH
        }
        lastbut2Sensor=but2Sensor;                // tell the world we just got HIGH
      }
      if (but2Count >=2)                          // check to see if the count is too high
      {
        but2Count=0;                              // and set back to zero if it is
      }
}

int getSpeed(int loopSpeed) // Get the speed to set the servo at based on but2Count
{
   int controlValue = analogRead(ControlPin);          // read from the control pin                    
   switch (but2Count)                                  // our count can be zero or 1
   {                                                    
     case 0:                                           // if it's zero rotate clockwise
      loopSpeed=map(controlValue, 0, 1023, 92, 180);  // continuous rotation at a speed between 90(stopped) and 180(max)
      break;
     case 1:                                           // if it's one rotate anticlockwise
      loopSpeed=map(controlValue, 0, 1023, 92, 0);    // continuous rotation at a speed between 90(stopped) and 0(max)
     break;                                      
   }
   return loopSpeed;                                  // return the proper speed for the proper direction
}  
 
    

  
5  Using Arduino / Motors, Mechanics, and Power / Old six wire stepper motor... Seagate -- Not sure what I have on: March 12, 2013, 07:23:38 pm
I have an old seagate stepper motor... I have have not been able to decide on the wiring.. I'm betting someone else already knows...

I've attached a PDF with a photo.. the below resistance pinnout table, and the multimeter doing the test.


*******RedBlueGreenYellowBrownOrange
Red*******0.030.030.0150.030.03
Blue0.03*******0.030.0150.030.03
Green0.030.03*******0.0150.030.03
Yellow0.0150.0150.015*******0.0150.015
Brown0.030.030.030.015*******0.03
Orange0.030.030.030.0150.03*******
I am interested both in what I have here and also how it would, and if it could, work with a http://www.seeedstudio.com/wiki/Motor_Shield_V1.0
Pages: [1]