1. EasyDriver – Stepper Motor Driver

EasyDriver는 스텝 모터를 아주 간단하게 사용하게 해주는 드라이버로 7V~30V의 전원을 인가하면 어떤 스텝모터라도 사용할 수 있습니다. EasyDriver는 voltage regulator를 내장하고 있어서 5V, 3.3V 인터페이스를 선택해서 이용할 수 있으며 Bi-polar 방식의 모터와 4, 6, 8 선을 갖는 Bi-polar 방식의 모터를 지원합니다. MS1, MS2 핀을 통해 마이크로 스텝 컨트롤을 지원합니다. (모터의 1스텝을 더 작게 쪼개서 제어 가능)

EasyDriver의 진정한 미덕은 단 2개의 디지털 핀을 이용해서 모터를 안정적으로 구동시킬 수 있기 때문에 상대적으로 저용량의 스텝모터 구동에 가장 적합한 드라이버 모듈입니다. 

주의!!: 드라이버에 전원이 들어온 상태에서는 모터를 연결하거나 분리하지 마세요. A3967 IC 칩에 영구적인 손상을 입힐 수 있습니다.

Features:

  • A3967 microstepping driver
  • MS1 and MS2 pins broken out to change microstepping resolution to full, half, quarter and eighth steps (defaults to eighth)
  • Compatible with 4, 6, and 8 wire stepper motors of any voltage
  • Adjustable current control from 150mA/phase to 750mA/phase
  • Power supply range from 7V to 30V. The higher the voltage, the higher the torque at high speeds

2. 연결 방법

제어용 핀:

  • Dir –> 아두이노 digital pin 2 (회전방향 입력용 핀)
  • Stp –> 아두이노 digital pin 3 (회전량을 입력하는 핀, step 단위)

전원용 핀:

  • +V –> 모터에 입력할 전원의 (+), Voltage는 크게 입력되어도 상관없으나 max current 값은 맞춰줘야함. EasyDriver 보드에 있는 다이얼을 이용해서 max current를 설정할 수 있음.(150~750mA)
  • GND –> 모터 입력 전원의 (-)

3. 소스 코드 (스케치)

참조 페이지:

Schmalz Haus: http://www.schmalzhaus.com/EasyDriver/
SparkFun : https://www.sparkfun.com/products/10267
Luso Robotica : http://lusorobotica.com/index.php/topic,106.0.html
Bildr : http://bildr.org/2011/06/easydriver/

3-1.  (출처: Bildr)

//////////////////////////////////////////////////////////////////
//2011 bildr
//Released under the MIT License - Please reuse change and share
//Using the easy stepper with your arduino
//use rotate and/or rotateDeg to controll stepper motor
//speed is any number from .01 -> 1 with 1 being fastest - 
//Slower Speed == Stronger movement
/////////////////////////////////////////////////////////////////

#define DIR_PIN 2
#define STEP_PIN 3

void setup() { 
  pinMode(DIR_PIN, OUTPUT); 
  pinMode(STEP_PIN, OUTPUT); 
} 

void loop(){ 
  //rotate a specific number of degrees 
  rotateDeg(360, 1); 
  delay(1000);

  rotateDeg(-360, .1);  //reverse
  delay(1000); 

  //rotate a specific number of microsteps (8 microsteps per step)
  //a 200 step stepper would take 1600 micro steps for one full revolution
  rotate(1600, .5); 
  delay(1000); 

  rotate(-1600, .25); //reverse
  delay(1000); 
}

void rotate(int steps, float speed){ 
  //rotate a specific number of microsteps (8 microsteps per step) - (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  int dir = (steps > 0)? HIGH:LOW;
  steps = abs(steps);

  digitalWrite(DIR_PIN,dir); 

  float usDelay = (1/speed) * 70;

  for(int i=0; i < steps; i++){ 
    digitalWrite(STEP_PIN, HIGH); 
    delayMicroseconds(usDelay); 

    digitalWrite(STEP_PIN, LOW); 
    delayMicroseconds(usDelay); 
  } 
} 

void rotateDeg(float deg, float speed){ 
  //rotate a specific number of degrees (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  int dir = (deg > 0)? HIGH:LOW;
  digitalWrite(DIR_PIN,dir); 

  int steps = abs(deg)*(1/0.225);
  float usDelay = (1/speed) * 70;

  for(int i=0; i < steps; i++){ 
    digitalWrite(STEP_PIN, HIGH); 
    delayMicroseconds(usDelay); 

    digitalWrite(STEP_PIN, LOW); 
    delayMicroseconds(usDelay); 
  } 
}

3-2.  (출처:  Luso Robotica)

/********************************************************
**         More info about the project at:             **
**  http://lusorobotica.com/index.php?topic=106.0  **
**   by TigPT at [url=http://www.LusoRobotica.com]www.LusoRobotica.com[/url]  **
*********************************************************/
int dirPin = 2;
int stepperPin = 3;

void setup() {
  pinMode(dirPin, OUTPUT);
  pinMode(stepperPin, OUTPUT);
}

void step(boolean dir,int steps){
  digitalWrite(dirPin,dir);
  delay(50);
  for(int i=0;i<steps;i++){
    digitalWrite(stepperPin, HIGH);
    delayMicroseconds(100);
    digitalWrite(stepperPin, LOW);
    delayMicroseconds(100);
  }
}

void loop(){
  step(true,1600);
  delay(500);
  step(false,1600*5);
  delay(500);
}