Ok, we're not messing about now.
Yes, it was always a gamble that using a cheap 28BYJ-48 stepper motor with a laser cut home-made gear and a super-glued length of timing belt to make a continuous loop might not work. And it turns out it didn't.
Sure, we could add some kind of spring rollers to push the belt against the drive gear to help reduce slippage. But right at the very start of this project, we suspected this might happen...
Which means we're going to be driving our nema-17 stepper motor using an A4988 driver board.
const int stepPin = 8;
const int dirPin = 9;
int delay_ms = 1;
int potValue = 0;
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH);
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delay(delay_ms);
digitalWrite(stepPin,LOW);
delay(delay_ms);
getSpeed();
}
delay(100);
// change rotation direction
digitalWrite(dirPin,LOW);
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delay(delay_ms);
digitalWrite(stepPin,LOW);
delay(delay_ms);
getSpeed();
}
delay(100);
}
void getSpeed(){
// read the speed input pot and set the speed value as appropriate
potValue = analogRead(A0);
delay_ms = map(potValue, 0, 1023, 1, 25);
}
At slow speeds, the stepping becomes almost visible, and the noise from the motor becomes very noticeable. At higher speeds, the motor is less "noisy" but at its fastest, the motor is clearly moving too quickly for our purposes - probably great if you're driving a CNC or a 3d printer, to be able to move the head around so quickly, but for us, we'd much rather a slower "top speed" and a quieter operation.
There are driver boards out there that specialise in ultra-quiet operation. If it comes to it, we might give this some consideration. But before we do that, there is still one option available to us..... microstepping.
No comments:
Post a Comment