主角就是这东东:
真值表(其实没什么用)
很简单,插线就是了,直接用USB电源,供电不足,还有可能烧笔记本的U口,可以用充电宝+下面这个调整电压的小模块
这样既方便又安全。
上官方例程:
Arduino--示例--stepper --MotorKnob简化一下, 其中引脚2,3,4,5对应板上IN1-4
/*
* MotorKnob
*
* A stepper motor follows the turns of a potentiometer
* (or other sensor) on analog input 0.
*
* http://www.arduino.cc/en/Reference/Stepper
* This example code is in the public domain.
*/
#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 720
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 2, 3, 4, 5);
void setup()
{
// 设置电机的转速:每分钟为90步
pinMode(LED_BUILTIN, OUTPUT);
stepper.setSpeed(30);
// 初始化串口,用于调试输出信息
Serial.begin(9600);
Serial.print("stemp testing start....\r\n");
}
void loop()
{
// 顺时针旋转一周
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("CW");
stepper.step(1000); //4步模式下旋转一周用2048 步。digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
// 逆时针旋转半周
Serial.println("CCW");
stepper.step(-1000); //4步模式下旋转一周用2048 步。
delay(500);
}
主控板用的ProMini
下载之后,晃晃悠悠跑起来了,不能换向,而且还抖得厉害,软件调整参数,感觉就是不太对,左查查,右查查,百思不得解,后来看到灯闪的顺序有点奇怪,又有文章提示可以换线序试一下,好吧,试一试,将2-3换了一下,这样看起来更合理。
果不其然,可以正常正转反转,扭力看起来也比较合理,毕竟加了1/64减速齿轮。
转速看起来64的倍数都可以,测试下极限,64, 640, 1280, 也就这样了,再快就只剩抖了:)不过,这2003驱动真心不行,电机发热的厉害,比之前用的驱动模块差得远了,用来搞搞玩具还可以,代替舵机啥的。