A4988 Step Motor Sürücü Kartı ile NEMA Step Motor Kullanımı

Gerekli Malzemeler
1 adet a4988 step motor sürücü kartı ve heatsink
1 adet NEMA 17 step motor
1 adet arduino UNO
1 adet 12v 2A batarya/güç kaynağı
1 adet 16v 100uf kapasitör
1 adet 1K Ohm direnç
Breadboard ve kablo
Bağlantı Şeması
Arduino Kodu
//MUCİT PİLOT 2020
const int dirPin = 3;
const int stepPin = 4;
const int bir_turdaki_adim = 200;
void setup()
{
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
// HIGH yaparsak saat yönünde döner
digitalWrite(dirPin, HIGH);
// 1 turdaki adım sayısı kadar adım attırıp 360 derece döndürüyoruz
for(int x = 0; x < bir_turdaki_adim; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000); // 1 saniye beklettik
// dönüş yönünü saat yönü tersine çevirdik
digitalWrite(dirPin, LOW);
for(int x = 0; x < bir_turdaki_adim; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000);
}
Video
Yorumlar
Yorum Gönder