Hi there,
first of all, i'm using a NEMA-23 bipolar stepper motor in combination with a TB6600 motor driver and an Arduino UNO.
I couldn't get them hooked up until now, because the 12 V power supply needed for the driver and motor isn't ready yet. But well, it's not needed for now.
As far as i understand, the motor driver just needs a 5V HIGH signal and a LOW signal from the Arduino to issue the next step (of course some more pins are needed for direction and enable).
So if i want to control the speed of the stepper, i have to vary the delay time between each HIGH and LOW signal sending from the Arduino right? So that means:
void loop() {
for (int i=0; i<6400; i++)
{
digitalWrite(DIR,LOW);
digitalWrite(ENA,HIGH);
digitalWrite(PUL,HIGH);
delayMicroseconds(50);
digitalWrite(PUL,LOW);
delayMicroseconds(50);
}
}
Should be slower than this:
void loop() {
for (int i=0; i<6400; i++)
{
digitalWrite(DIR,LOW);
digitalWrite(ENA,HIGH);
digitalWrite(PUL,HIGH);
delayMicroseconds(20);
digitalWrite(PUL,LOW);
delayMicroseconds(20);
}
}
right?
I assume everything i said until now is right. So let me first explain for what reason i need the stepper.
I'm currently on my bachelor thesis project and part of it is to create a python script, which students can use to control a stepper motor during lab time. The stepper is hooked up on a motion converter (sorry, english is not my native language) which converts the rotation to a translation. So rotating clockwise moves an object forward, rotating counter-clockwise moves it backward.
My goal is that the stepper moves the object in a "-cos(x) + 1" way.
What i mean is: it starts slow, gets faster and faster, until the pi/2 points, and gets slower and slower until it reaches the local maximum (which means stop moving) and then repeating the same thing backwards.
Because the stepper needs 200 steps for 1 revolution, and 3 revolutions are needed for going all the way forward (can't change that, it has to be 3 revolutions), assuming i use half step mode, i would need freaking 1200 different delay times for my Arduino script. Even as bytes, this would need a major portion of the RAM. And half step mode isn't really the best for a smooth motion right? (as i said before, couldn't test it for now, just assuming). So microstep is out of question if i do it this way.
My question is, is there a better way to achieve the same, or nearly the same result?