Hey, I am currently working on a small 3 axis robot arm with 28BYJ_48 stepper motors and it runs but the motors run one by one rather than simultaneously as I wanted too.
So, I was wondering if it is possible to run 3 28BYJ_48 stepper motors off an Arduino Uno board and have them move simultaneously?
Here is my code, I can bet its not the cleanest or most efficient code (This is only my second year of teaching myself arduino). Please be kind
#include <TinyStepper_28BYJ_48.h>
//Stepper One Pins
const int Stepper1_IN1 = 2;
const int Stepper1_IN2 = 3;
const int Stepper1_IN3 = 4;
const int Stepper1_IN4 = 5;
//Stepper Two Pins
const int Stepper2_IN1 = 6;
const int Stepper2_IN2 = 7;
const int Stepper2_IN3 = 8;
const int Stepper2_IN4 = 9;
//Stepper Three Pins
const int Stepper3_IN1 = 10;
const int Stepper3_IN2 = 11;
const int Stepper3_IN3 = 12;
const int Stepper3_IN4 = 13;
TinyStepper_28BYJ_48 stepper1;
TinyStepper_28BYJ_48 stepper2;
TinyStepper_28BYJ_48 stepper3;
void setup() {
 // put your setup code here, to run once:
 stepper1.connectToPins(Stepper1_IN1, Stepper1_IN2, Stepper1_IN3, Stepper1_IN4);
 stepper2.connectToPins(Stepper2_IN1, Stepper2_IN2, Stepper2_IN3, Stepper2_IN4);
 stepper3.connectToPins(Stepper3_IN1, Stepper3_IN2, Stepper3_IN3, Stepper3_IN4);
Â
 Serial.begin(9600);
}
//Top motor max distance is 800
// middle motor max distance is >600
void loop() {
 prog_start();
 //
 //
 //
 //
 // Program to run goes here:
 // Distance is mesured in degrees
 s1(90);
 s2(90);
 s3(90);
 delay(500);
 s1(-90);
 s2(-90);
 s3(-90);
 //
 //
 //
 //
 prog_end();
Â
}
void dec1(){
 //Stepper One || Wrist
 //Max Rotation = 360
 stepper1.setSpeedInStepsPerSecond(256);
 stepper1.setAccelerationInStepsPerSecondPerSecond(512);
}
void dec2(){
 //Stepper Two || Elbow
 //Max Rotation = 270
 stepper2.setSpeedInStepsPerSecond(256);
 stepper2.setAccelerationInStepsPerSecondPerSecond(512);
}
void dec3(){
 //Stepper Three || Base
 //Max Rotation = 270
 stepper3.setSpeedInStepsPerSecond(256);
 stepper3.setAccelerationInStepsPerSecondPerSecond(512);
}
int s1(int pos1){
 if (pos1 > 360 || pos1 < -360){
  Serial.println("Value to large");
 }
 else{
  stepper1.moveToPositionInSteps(pos1 *5.5555555);
  Serial.println(pos1);
 }
}
int s2(int pos2){
 if (pos2 > 150 || pos2 < -150){
  Serial.println("Value to large");
 }
 else{
  stepper2.moveToPositionInSteps(pos2 *5.5555555);
  Serial.println(pos2);
 }
}
int s3(int pos3){
 if (pos3 > 90 || pos3 < -90){
  Serial.println("Value to large");
 }
 else{
  stepper3.moveToPositionInSteps(pos3 *5.5555555);
  Serial.println(pos3);
 }
}
int prog_start(){
 dec1();
 dec2();
 dec3();
 stepper1.moveToPositionInSteps(0);
 stepper1.moveToPositionInSteps(0);Â
 stepper3.moveToPositionInSteps(0);
 delay(1000);
 Serial.println("Start Programm: ");
Â
Â
}
int prog_end(){
 Serial.print("Proggram end");
 s3(0);
 s2(0);
 s1(0);
 delay(5000);
}
I am still working on a proper way to control it, any suggestions would be appreciated.