Hi everyone!
So I am building up a bender machine, taking this webpage as a reference:
-http://howtomechatronics.com/projects/arduino-3d-wire-bending-machine/
The changes made were:
- Changing the frame to a metal one to make the machine more sturdy
- In consequence of it, we changed the motors to:
- We changed the Motor drivers to a TB6600 so the Nema 23's and the Nema 17 could have the power needed, because of voltage and current.
- Power supply was also changed to a 24V one so the motors can have the power required and for the "peak" stage for each of the motors (I already calculated this, if you want more info just pin me)
In the end this is the circuit diagram (made on OneNote, soon it will be fixed)
So the problem here it is that if I connect a motor individually like in this diagram:
With the following code (im using Accelstepper library):
#include <AccelStepper.h>
// Define the stepper motors and the pins the will use
AccelStepper feederStepper(2, 13, 12); // (Type:driver, STEP, DIR)
AccelStepper benderStepper(2, 9, 8);
//AccelStepper zAxisStepper(2, 8, 7);
void setup() {
Serial.begin(9600);
Serial.println("Testing the Stepper Motors");
feederStepper.setMaxSpeed(2000);
Serial.println("feeder stepper set max speed");
feederStepper.setAcceleration(4000);
Serial.println("feeder stepper set max speed");
//zAxisStepper.setMaxSpeed(100);
//zAxisStepper.setAcceleration(20);
//zAxisStepper.moveTo(500);
benderStepper.setMaxSpeed(2000);
benderStepper.setAcceleration(4000);
}
void loop() {
delay(500); // wait for a second
Serial.println("first delay passed");
feederStepper.moveTo(9000);
feederStepper.run();
benderStepper.moveTo(9000);
benderStepper.run();
Serial.println("run command sent");
delay(500); // wait for a second
Serial.println("second delay passed");
benderStepper.runToNewPosition(0);
benderStepper.disableOutputs();
feederStepper.runToNewPosition(0);
feederStepper.disableOutputs();
Serial.println("motor stop sent");
delay(500); // wait for a second
//digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
//if (zAxisStepper.distanceToGo() == 0)
//{
//zAxisStepper.moveTo(-zAxisStepper.currentPosition());
//zAxisStepper.run();
//digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
//delay(1000); // wait for a second
//}
//digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
//if (benderStepper.distanceToGo() == 0)
//{
//benderStepper.moveTo(-benderStepper.currentPosition());
//digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
//delay(1000);
}
If you observe, the code has some stuff commented, so we can test one motor at a time.
For one motor is ok, but if I try to connect two motors at the same time, it dosent run. But the most interesting behavior is that if you connect two motors, it will work the motor on the lower pins (ex. pin 1 and pin 2) and if you move the pins to other ones or switch the motors from the pins, it will continue with that behavior. Im really out of ideas.
If you need more information about the project, just contact me.