Posts

Showing posts from June, 2019

28BYJ-48 ステッピングモーターとULN2003とArduino Nano

Image
◆実動作 64*32=2048 STEP順方向回転したのち500msecディレイの処理に入って逆回転するデモ ◆ソース https://github.com/setapolo/arduino_sample_28BYJ-48/blob/master/28BYJ-48.ino # include < Stepper.h > // sample souce code for 28BYJ-48 (ULN2003) HALFMODE const int NUMBER_OF_STEPS = 64 ;//一周(360°)にかかるステップ数 const float GEAR_RATIO = 63.68395 ; //ギア比 int current_steps = 0 ; int cw= 1 ; Stepper stepper (NUMBER_OF_STEPS, 8 , 10 , 9 , 11 );//コンストラクタ void setup () {  stepper. setSpeed ( 300 );//RPM } void loop () {  stepper. step (cw);//1ループで動かすステップ数 1または-1としている  current_steps++;  if (current_steps > (NUMBER_OF_STEPS * (GEAR_RATIO/ 2 ))){  delay ( 500 );   current_steps = 0 ;   cw = cw * - 1 ; //逆方向にしている  } } 下記の情報ふまえ上記の動作確認ソースとした ◆配線 配線はこちらのサイトを参考にさせていただいた https://iot.keicode.com/arduino/arduino-stepper-28byj-48.php ◆28BYJ-48のデータシート(英語) http://robocraft.ru/files/datasheet/28BYJ-48.pdf Speed Variation Ratio 1/64 Stride Angle 5.625° /64   ◆28BYJ-48のデータ