Hello all, I am working on building a toroid winder which I am using a arduino and a 28byj-48.
It takes 4 full revolutions of the stepper motor to equal one turn on the winder itself. I wanted to be able to send the amounts of turns to the arduino via serial connection since I do not have a arduino display yet. What I have currently works however if I want say 200 turns (1,638,400 steps) it stops at only 1 or 2 turns. Any clues as to what I am doing wrong here?
// Arduino stepper motor control code
#include <Stepper.h> // Include the header file
// change this to the number of steps on your motor #define STEPS 32 #define STEPS_PER_OUTPUT_REVOLUTION 32 * 64 //2048
// create an instance of the stepper class using the steps and pins
Stepper stepper(STEPS, 8, 10, 9, 11);
I have several of those steppers. I would recommend using a different method to measure each full turn. The ones I have seem to skip steps rather frequently with tension applied. I can rotate ten full turns one way. Then reverse direction 10 full turns. Sometimes the motor would be off by 1/4 turn or more. It could be partly due to the cheap driver boards that came with mine though.
bond007:
Any thoughts on how I could implement this?
Despite the name, the return type of Serial.parseInt() is long, which can hold a maximum value of 2147483647. So as far as getting the number of steps from Serial Monitor to your Arduino board, all you need to do is change the type of the val variable to long.
However, there is also the issue that the type of stepper.step()'s parameter is int. So you can't pass a value of greater than 32767 to that function. You'll need to modify your code so that it calls stepper.step() multiple times to trigger more steps than 32767.