สร้างเว็บEngine by iGetWeb.com
Cart รายการสินค้า (0)

arduio ขับ stepping motor

arduio ขับ stepping motor

arduio ขับ stepping motor  

ถ้าเรามี stepping motor แบบ 4เส้น 5 เส้น หรือ 6 เส้นคุณก็สามารถควบคุมมันได้

โดยใช้ l298 module ขับตัว stepping โดยใช้ บอร์ด arduino ควบคุม

Port name Direction Description Usage
VMS GND / connect to external power supply(6V~35V) ENA(ENB) connected to H state will enable MOTORA(MOTORB) IN1(IN3) connected to 5V and IN2(IN4) to GND MOTORA(MOTORB) will move clockwise IN1(IN3) connected to GND and IN2(IN4) to 5V MOTORA(MOTORB) will move Anti-clockwise if you want to control speed you can connect the ENA(ENB) to PWM.
ENA Input TTL Compatible Enable Input:the L state disables the bridge A
IN1 Input TTL Compatible Inputs of the Bridge A
IN2 Input TTL Compatible Inputs of the Bridge A
ENB Input TTL Compatible Enable Input:the L state disables the bridge B
IN3 Input TTL Compatible Inputs of the Bridge B
IN4 Input TTL Compatible Inputs of the Bridge B
M)TORA Output Output of the Bridge A
MOTORB Output Output of the Bridge B
CSA(CSB) / use for testing electric current of Bridge A(Bridge B)
UR1 UR2 UR3 UR4 / pull-up resistor
5V +5V / 5V output
5V Chip Enable Jumper / if connected,5V chip will work.

ต่อขา arduino กับ l298 module ตามขาด้านล่างนี้เลยครับ

int ENA=2;//connected to Arduino's port 2
int IN1=3;//connected to Arduino's port 3
int IN2=4;//connected to Arduino's port 4
int ENB=5;//connected to Arduino's port 5
int IN3=6;//connected to Arduino's port 6
int IN4=7;//connected to Arduino's port 7
 
void setup()
{
 pinMode(ENA,OUTPUT);
 pinMode(ENB,OUTPUT);
 pinMode(IN1,OUTPUT);
 pinMode(IN2,OUTPUT);
 pinMode(IN3,OUTPUT);
 pinMode(IN4,OUTPUT);
 digitalWrite(ENA,HIGH);//enablae motorA
 digitalWrite(ENB,HIGH);//enable motorB
}
void loop()
{/*In the way of 4 beats to drive the stepping motor,A group connected to motorA,B
 B group connected to motorB,Suppose A representing the forward current of A group,
 A- representing the reverse current of A group,B representing the forward current of B group,
 B- representing the reverse current of B group.
 this way run as follow:
 AB    A-B    A-B-   AB-
 or
 AB   AB-    A-B-   A-B
 */
 digitalWrite(IN1,LOW);
 digitalWrite(IN2,HIGH);
 digitalWrite(IN3,HIGH);
 digitalWrite(IN4,LOW);
 delay(10);
 digitalWrite(IN1,LOW);
 digitalWrite(IN2,HIGH);
 digitalWrite(IN3,LOW);
 digitalWrite(IN4,HIGH);
 delay(10);
 digitalWrite(IN1,HIGH);
 digitalWrite(IN2,LOW);
 digitalWrite(IN3,LOW);
 digitalWrite(IN4,HIGH);
 delay(10);
 digitalWrite(IN1,HIGH);
 digitalWrite(IN2,LOW);
 digitalWrite(IN3,HIGH);
 digitalWrite(IN4,LOW);
 delay(10);
}
view