Motoduino這塊板子也可以控制步進馬達(stepper motor), 方法很簡單, 手上這顆是二相激磁四線式步進馬達, 電壓 5V, 精度1.8度, 電流 0.3A, 四線接法: 紅線接M1+, 棕色接M1-, 藍色接 M2-, 黃色接 M2+. 影片中實驗是順時針走 200步(200x1.8度=360)剛好一圈,逆時針走200步回原點.
影片請參考這裡 : http://www.youtube.com/watch?v=AIZBQgjQ3rQ
使用材料:
1. Motoduino
2. Stepper Motor (KH42JM2B011) 5V, 0.3A, 1.8 Deg.
The Sketch(for Motoduino):
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
const int Motor_E1 = 5; // digital pin 5 of Arduino (PWM)
const int Motor_E2 = 6; // digital pin 6 of Arduino (PWM)
const int Motor_M1 = 7; // digital pin 7 of Arduino
const int Motor_M2 = 8; // digital pin 8 of Arduino
//Stepper myStepper(stepsPerRevolution, 8,9,10,11);
Stepper myStepper(stepsPerRevolution, Motor_M1, Motor_M2);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
pinMode(Motor_M1, OUTPUT);
pinMode(Motor_M2, OUTPUT);
digitalWrite( Motor_E1, HIGH); // speed control
digitalWrite( Motor_E2, HIGH); // speed control
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
Blog: http://sinocgtchen.blogspot.com
Motoduino : http://motoduino.com
Youtube: http://www.youtube.com/user/sinocgtchen
My Email: sinocgtchen@gmail.com
影片請參考這裡 : http://www.youtube.com/watch?v=AIZBQgjQ3rQ
使用材料:
1. Motoduino
2. Stepper Motor (KH42JM2B011) 5V, 0.3A, 1.8 Deg.
The Sketch(for Motoduino):
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
const int Motor_E1 = 5; // digital pin 5 of Arduino (PWM)
const int Motor_E2 = 6; // digital pin 6 of Arduino (PWM)
const int Motor_M1 = 7; // digital pin 7 of Arduino
const int Motor_M2 = 8; // digital pin 8 of Arduino
//Stepper myStepper(stepsPerRevolution, 8,9,10,11);
Stepper myStepper(stepsPerRevolution, Motor_M1, Motor_M2);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
pinMode(Motor_M1, OUTPUT);
pinMode(Motor_M2, OUTPUT);
digitalWrite( Motor_E1, HIGH); // speed control
digitalWrite( Motor_E2, HIGH); // speed control
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
Blog: http://sinocgtchen.blogspot.com
Motoduino : http://motoduino.com
Youtube: http://www.youtube.com/user/sinocgtchen
My Email: sinocgtchen@gmail.com
請問也可以控制四相六線的步進馬達嗎?
回覆刪除請問有辦法用Arduino(UNO板)控這種四線的步進馬達嗎?
回覆刪除